Hello,

here's a quick summary of this patch:

- hopefully fixed autodetection of aspect ratio
- judder at certain combinations of aspect ratios and resolutions on
interlaced displays is now eliminated.

The story leading to this patch is in the thread:
http://mail.directfb.org/pipermail/directfb-dev/2005-October/000808.html

I think I understood now how aspect ratio scaling was meant to work in
df_xine, for example I'm assuming that the ctx->video structure just
stores the values of the video's width, height and aspect ratio between
subsequent calls to dfx_output_cb in order to detect changes, and that
the input argument 'ratio' is actually the _requested_ aspect ratio of
the video frame, how it should look like (disregarding if we have square
pixels or not on the ctx->screen, so I think the calculations should
take all this into account.

With this version of the patch, the keys "R + 0|1|2|3|4" work normally
again, and in "auto" mode, there actually shouldn't be necessary to
change the aspect ratio, if my calculations are all correct.
Furthermore, I no longer get jerky video on my TV-out (for Matrox G400
hard-coded at 720x576 non-square, therefore 5:4 looking stretched just
as 4:3) and with DVB resolutions of [EMAIL PROTECTED]:3, [EMAIL PROTECTED]:3 or
[EMAIL PROTECTED]:9 I got very different judder-regarding results when cycling
through display aspect ratios in df_xine. Now all this is fixed, I get
correct aspect ratios and no judder at all these resolutions on my
interlaced TV. I also tried the patch *with* deinterlacing on the first
head of my G400 and I think it's ok with all these resolutions too.

So please give it a try, on TVs and / or normal monitors. I might try to
generate some test interlaced videos based on
http://www.kingcot.eclipse.co.uk/unichrome/tvoutTest.html but adding
also a circular pattern and a square grid on them, at all these typical
resolutions and aspect ratios to make sure. Or does somebody know of
such test videos already?

Cheers,
Lucian
diff -Naur DirectFB-extra-9999_orig/samples/df_xine/context.c 
DirectFB-extra-9999/samples/df_xine/context.c
--- DirectFB-extra_orig/samples/df_xine/context.c       2005-10-24 
20:37:40.000000000 +0200
+++ DirectFB-extra/samples/df_xine/context.c    2005-10-24 20:40:05.000000000 
+0200
@@ -51,7 +51,9 @@
 {
      DFXCore         *this        = (DFXCore*) data;
      DFXVideoContext *ctx         = &this->ctx;
-     bool             update_area = (ctx->video.ratio != ratio);
+     double      calc_frame_ratio = (double) width / (double) height;
+     double      normalized_ratio = (ratio * ctx->screen.ratio) / 
calc_frame_ratio;
+     bool             update_area = (ctx->video.ratio != normalized_ratio);
 
      if (ctx->update                 ||
          ctx->video.width  != width  ||
@@ -64,7 +66,7 @@
 
      if (ctx->caps & DLCAPS_SCREEN_LOCATION) {
           if (update_area) {
-               if (ctx->screen.ratio <= ratio) {
+               if (normalized_ratio > ratio) {
                     float h = (double) ctx->screen.width / ratio;
 
                     ctx->layer->SetScreenLocation( ctx->layer,
@@ -108,7 +110,7 @@
                     }
                }
                
-               if (ctx->screen.ratio <= ratio) {
+              if (normalized_ratio <= ratio) {
                     ctx->drect.w = ctx->screen.width;
                     ctx->drect.h = (double) ctx->screen.width / ratio;
                } else {
@@ -131,7 +133,7 @@
 
      ctx->video.width  = width;
      ctx->video.height = height;
-     ctx->video.ratio  = ratio;
+     ctx->video.ratio  = normalized_ratio;
      ctx->video.format = format;
      ctx->update       = false;
 }
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to