On Tue, 2005-11-22 at 22:39 -0500, Daniel Kristjansson wrote:
> Can someone verify that this works?

Here's an update.

I believe it gets rid of the double compensation for scaling in the last
patch. I've tested with various non-square pixel videos of different
aspect ratios and sizes and with square pixel videos videos of different
aspect ratios. But I haven't tested yet with non-square display pixels
nor with chromakey OSD because I need to reboot for that.

-- Daniel
Index: libs/libmythtv/videooutbase.cpp
===================================================================
--- libs/libmythtv/videooutbase.cpp	(revision 8010)
+++ libs/libmythtv/videooutbase.cpp	(working copy)
@@ -509,6 +509,7 @@
     visible = GetVisibleOSDBounds(visible_aspect, font_scaling);
 }
 
+static float sq(float a) { return a*a; }
 /**
  * \fn VideoOutput::GetVisibleOSDBounds(float&) const
  * \brief Returns visible portions of total OSD bounds
@@ -537,14 +538,24 @@
         tl += s;
         br -= (s * 2);
     }
+    QRect vb(tl, br);
 
     // set the physical aspect ratio of the displayable area
-    float dispPixelAdj = (GetDisplayAspect() * XJ_height) / XJ_width;
-    visible_aspect = XJ_aspect * dispPixelAdj;
+    float dispPixelAdj = (GetDisplayAspect() * disph) / dispw;
+    VERBOSE(VB_IMPORTANT, "XJ_aspect:      "<<XJ_aspect);
+    VERBOSE(VB_IMPORTANT, "videoAspect:    "<<videoAspect);
+    VERBOSE(VB_IMPORTANT, "display_aspect: "<<display_aspect
+            <<" dpa: "<<dispPixelAdj);
+    // now adjust for scaling of the video
+    float vs = ((float)vb.width())/vb.height();
+    VERBOSE(VB_IMPORTANT, "vb scale:       "<<vs);
+    visible_aspect = (vs/XJ_aspect) * dispPixelAdj;
+    VERBOSE(VB_IMPORTANT, "visible_aspect: "<<visible_aspect);
 
     // this can be used to account for Zooming letterbox modes
-    font_scaling = 1.0f;
-    return QRect(tl, br);
+    font_scaling = 1.0/sqrt(2.0/(sq(visible_aspect / 1.3333f) + 1.0));
+    VERBOSE(VB_IMPORTANT, "font_scaling: "<<font_scaling);
+    return vb;
 }
 
 /**
@@ -806,7 +817,7 @@
     //printf("After: %dx%d%+d%+d\n", dispwoff, disphoff, dispxoff, 
     //dispyoff);
 
-#if 0
+#if 1
     printf("VideoOutput::MoveResize:\n");
     printf("Img(%d,%d %d,%d)\n", imgx, imgy, imgw, imgh);
     printf("Disp(%d,%d %d,%d)\n", dispxoff, dispyoff, dispwoff, disphoff);
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

Reply via email to