[mythtv] Problems with latest CVS & DVB & Unichrome

Daniel Thor Kristjansson danielk at mrl.nyu.edu
Sun Feb 6 15:46:29 UTC 2005


On Sun, 6 Feb 2005, Ivor Hewitt wrote:
]And finally.... the bob-deint appears to effectively just working as one field 
]deinterlacing on the epia-m. :(

Hmmm, if that's really the case I don't know what it is. If it's just 
that the fields are not offset properly, that's because we disabled the 
bob offset on the epia, thinking that might be the problem...

I've attached a second debug patch that lets you enable or disable the 
offset. I've re-enabled it by default (it's the ENABLE_DEINT_ON_VLD 
define).

Let me know if that works, with the AvFormatDecoder::Reset() change of 
course.

-- Daniel
-------------- next part --------------
Index: libs/libmythtv/videoout_xvmc.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/videoout_xvmc.cpp,v
retrieving revision 1.42
diff -u -r1.42 videoout_xvmc.cpp
--- libs/libmythtv/videoout_xvmc.cpp	3 Feb 2005 23:58:11 -0000	1.42
+++ libs/libmythtv/videoout_xvmc.cpp	6 Feb 2005 15:37:43 -0000
@@ -86,6 +86,14 @@
 #define GUID_IA44  0x34344941
 #define GUID_AI44  0x34344149
 
+#define ENABLE_DEINT_ON_VLD      1 /* enable bobdeint offset on VLD       */
+#define ENABLE_LOCK_HACK         1 /* release locks to give more time to decoder      */
+#define ENABLE_SCALING           1 /* draw only needed portion of second frame        */
+#define ENABLE_VLD_HACK          1 /* wait for paint to finish before releasing locks */
+#define ENABLE_NEW_FRAME_DISCARD 1 /* discard frames more logically       */
+#define DISABLE_AUTOPAINT        1 /* disable autopaint to remove bug 166 */
+#define ENABLE_BOB_DEBUG         1 /* extra debugging during VB_PLAYBACK  */
+
 struct XvMCData
 {
     Window XJ_root;
@@ -513,7 +521,7 @@
         return false;
     }
 
-    InitColorKey(true);
+    InitColorKey(DISABLE_AUTOPAINT);
 
     if (gContext->GetNumSetting("UseOutputPictureControls", 0))
     {
@@ -551,8 +559,12 @@
 
                 if (turnoffautopaint)
                     XvSetPortAttribute(data->XJ_disp, xv_port, xv_atom, 0);
-                else 
-                    XvSetPortAttribute(data->XJ_disp, xv_port, xv_atom, 1);
+                else
+                {
+                    ret = XvSetPortAttribute(data->XJ_disp, xv_port, xv_atom, 1);
+                    if (ret == Success)
+                        data->needdrawcolor = false;
+                }
             }
         }
         XFree(attributes);
@@ -933,7 +945,6 @@
         {
             field = 2;
             halfLineSrc = (int) round(((float)disphoff)/imgh - 0.001f);
-            //src_h -= (halfLineSrc) ? 2 : 0;
         }
     }
 
@@ -963,25 +974,46 @@
     // away from the decoding process, and coming back from a pause can
     // result in a very low buffer situation, causing jerky playback.
     // Let's just hope that the XvMC driver's a bit threadsafe.
+#if ENABLE_LOCK_HACK
     if (field != 3)
         pthread_mutex_unlock(&lock);
+#endif
 
     int yoff = dispyoff;
     int hoff = disphoff;
-    if (!hasVLDAcceleration())
+
+    if (2 == field)
     {
-        yoff += halfLineSrc;
-        hoff -= halfLineSrc;
+#if ENABLE_DEINT_ON_VLD
+        if (!hasVLDAcceleration())
+#endif
+        {
+            yoff += halfLineSrc;
+#if ENABLE_SCALING
+            hoff -= 2 * halfLineSrc;
+            src_h -= (halfLineSrc) ? 2 : 0;
+#endif
+        }
+#if ENABLE_BOB_DEBUG
+        VERBOSE(VB_PLAYBACK,
+                QString("XvPut img_h(%1-%6) dest y(%2+%4) h(%3-%5)")
+                .arg(imgh).arg(yoff).arg(hoff)
+                .arg(halfLineSrc).arg(2 * halfLineSrc)
+                .arg(2 * ((halfLineSrc) ? 1 : 0))); /* 2* for imgh coords */
+#endif
     }
 
     XvMCPutSurface(data->XJ_disp, surf, data->XJ_curwin,
                    imgx, imgy, imgw, src_h,
                    dispxoff, yoff, dispwoff, hoff, field);
 
+#if ENABLE_LOCK_HACK
     if (field != 3)
         pthread_mutex_lock(&lock);
+#endif
 
-/*  Doesn't seem necessary.
+#if ENABLE_VLD_HACK
+    //Doesn't seem necessary.
     if (data->p_render_surface_visible && 
         (data->p_render_surface_visible != showingsurface))
     {
@@ -998,27 +1030,41 @@
             XvMCGetSurfaceStatus(data->XJ_disp, surf, &status);
         }
     }
-*/
+#endif
 
     data->p_render_surface_visible = data->p_render_surface_to_show;
 
+#if ENABLE_NEW_FRAME_DISCARD
     if (data->curosd && data->curosd != osdframe)
     {
         DiscardFrame(data->curosd);
         data->curosd = NULL;
     }
+#else
+    if (!m_deinterlacing || (m_deinterlacing && field == 2))
+        data->p_render_surface_to_show = NULL;
+#endif
 
     if (osdframe)
     {
         data->p_render_surface_visible = osdren;
+#if ENABLE_NEW_FRAME_DISCARD
         data->curosd = osdframe;
+#else
+        if (data->curosd)
+            DiscardFrame(data->curosd);
+        data->curosd = osdframe;
+        render->p_osd_target_surface_render = NULL;
+#endif
     } 
  
+#if ENABLE_NEW_FRAME_DISCARD
     if (!m_deinterlacing || (m_deinterlacing && scan != kScan_Interlaced))
     {
         data->p_render_surface_to_show = NULL;
         render->p_osd_target_surface_render = NULL;
     }
+#endif
 
     pthread_mutex_unlock(&lock);
 }
@@ -1110,12 +1156,16 @@
     // boboff assumes the smallest interlaced resolution is 480 lines
     int boboff = (int) round(((float)disphoff)/480 - 0.001f);
     boboff = (m_deinterlacing && m_deintfiltername == "bobdeint") ? boboff : 0;
+#if ENABLE_BOB_DEBUG
+    VERBOSE(VB_PLAYBACK, QString("disphoff(%1) boboff(%2) ndc(%3)")
+            .arg(disphoff).arg(boboff).arg((data->needdrawcolor?"yes":"no")));
+#endif
 
     if (data->needdrawcolor)
     {
         XSetForeground(data->XJ_disp, data->XJ_gc, data->colorkey);
         XFillRectangle(data->XJ_disp, data->XJ_curwin, data->XJ_gc,
-                       dispx, dispy+boboff, dispw, disph);
+                       dispx, dispy+boboff, dispw, disph - 2 * boboff);
     }
 
     XSetForeground(data->XJ_disp, data->XJ_gc, XJ_black);
@@ -1128,11 +1178,11 @@
                        (dispx+dispw)-(dispxoff+dispwoff), disph);
     if (dispyoff+boboff > dispy) // top of screen
         XFillRectangle(data->XJ_disp, data->XJ_curwin, data->XJ_gc, 
-                       dispx, dispy, dispw, dispyoff+boboff-dispy);
-    if (dispyoff+disphoff < dispy+disph) // bottom of screen
+                       dispx, dispy, dispw, dispyoff + boboff - dispy);
+    if (dispyoff + disphoff < dispy + disph + boboff) // bottom of screen
         XFillRectangle(data->XJ_disp, data->XJ_curwin, data->XJ_gc, 
-                       dispx, dispyoff+disphoff, 
-                       dispw, (dispy+disph)-(dispyoff+disphoff));
+                       dispx, dispyoff + disphoff - boboff,
+                       dispw, (dispy + disph + boboff) - (dispyoff + disphoff));
 
     if (sync)
         XSync(data->XJ_disp, false);


More information about the mythtv-dev mailing list