[mythtv] bugfix patch for XvMC deinterlacing

Brandon Beattie brandon+myth at linuxis.us
Sun Aug 1 01:55:06 EDT 2004


Just curious,

 After a week of testing this patch is working very well.  It has been
some time since I have tried XvMC and am very impressed with how wel it
is working now.  

 I have noticed 2 problems with my myth box if XvMC is enabled.  The
first is that at the end of watching a show, or hitting escape
(basically anytime you quit watching) mythfrontend segfaults. 

 The second problem is that the frontend will hang with "waiting for
video buffer" and sometimes "prebuffering pause" errors when I hit fast
forward too quickly, or just at some odd moments.  I was trying to get
to the end of one show and setting bookmarks.  I saved one then tried
fast forwarding, which it did then froze after a couple seconds.  Upon
going back to watch again, myth froze with the errors when it started
playback at the saved possition.

 Any ideas?
 '
 --Brandon

On Mon, Jul 19, 2004 at 02:47:12PM -0400, Daniel Thor Kristjansson wrote:
> 
> I think I may have fixed the lack of XvMC poor-man's deinterlacing for
> 1080i content. SetVideoParams was never being called with kScan_Detect.
> 
> This patch should fix it for MPEG files. Please let me know if it works
> for you as I don't have HDTV 1080i content to test with.
> 
> -- Daniel
> Index: libs/libmythtv/NuppelVideoPlayer.cpp
> ===================================================================
> RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/NuppelVideoPlayer.cpp,v
> retrieving revision 1.350
> diff -u -r1.350 NuppelVideoPlayer.cpp
> --- libs/libmythtv/NuppelVideoPlayer.cpp	3 Jul 2004 16:48:49 -0000	1.350
> +++ libs/libmythtv/NuppelVideoPlayer.cpp	19 Jul 2004 18:37:50 -0000
> @@ -437,10 +437,24 @@
>          audioOutput->Reconfigure(audio_bits, audio_channels, audio_samplerate);
>  }
>  
> +static inline QString toQString(FrameScanType scan) {
> +    switch (scan) {
> +        case kScan_Ignore: return QString("Ignore Scan");
> +        case kScan_Detect: return QString("Detect Scan");
> +        case kScan_Interlaced:  return QString("Interlaced Scan");
> +        case kScan_Progressive: return QString("Progressive Scan");
> +        default: return QString("Unknown Scan");
> +    }
> +}
> +
>  FrameScanType NuppelVideoPlayer::detectInterlace(FrameScanType newScan, 
>                                                   FrameScanType scan,
>                                                   float fps, int video_height) 
>  {
> +    QString dbg = QString("detectInterlace(") + toQString(newScan) +
> +        QString(", ") + toQString(scan) + QString(", ") + QString("%1").arg(fps) +
> +        QString(", ") + QString("%1").arg(video_height) + QString(") ->");
> +
>      if (kScan_Ignore != newScan || kScan_Detect == scan) 
>      {
>          // The scanning mode should be decoded from the stream, but if it
> @@ -453,10 +467,14 @@
>              scan = kScan_Progressive;
>          else if (video_height <= 640) // HACK, 320x240 looks bad...
>              scan = kScan_Progressive;
> +	else if (video_height >= 1080) // ATSC 1080i
> +	    scan = kScan_Interlaced;
>  
>          if (kScan_Detect != newScan)
>              scan = newScan;
> -    }
> +    };
> +
> +    VERBOSE(VB_PLAYBACK, dbg+toQString(scan));
>  
>      return scan;
>  }
> @@ -477,14 +495,15 @@
>      }
>  
>      video_size = video_height * video_width * 3 / 2;
> -    keyframedist = keyframedistance;
> +    if (keyframedist>0) 
> +	keyframedist = keyframedistance;
>  
>      if (aspect > 0.0f)
>          video_aspect = aspect;
>  
>      m_scan = detectInterlace(scan, m_scan, video_frame_rate, video_height);
>      VERBOSE(VB_PLAYBACK, QString("Interlaced: %1  video_height: %2  fps: %3")
> -                                .arg(scan).arg(video_height).arg(fps));
> +                                .arg(toQString(m_scan)).arg(video_height).arg(fps));
>  
>  }
>  
> Index: libs/libmythtv/avformatdecoder.cpp
> ===================================================================
> RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/avformatdecoder.cpp,v
> retrieving revision 1.88
> diff -u -r1.88 avformatdecoder.cpp
> --- libs/libmythtv/avformatdecoder.cpp	25 Jun 2004 23:31:58 -0000	1.88
> +++ libs/libmythtv/avformatdecoder.cpp	19 Jul 2004 18:37:51 -0000
> @@ -346,7 +346,7 @@
>  
>                  m_parent->SetVideoParams(ALIGN(enc->width, 16), 
>                                           ALIGN(enc->height, 16), fps, 
> -                                         keyframedist, aspect_ratio);
> +                                         keyframedist, aspect_ratio, kScan_Detect);
>               
>                  enc->error_resilience = FF_ER_COMPLIANT;
>                  enc->workaround_bugs = FF_BUG_AUTODETECT;
> @@ -951,7 +951,7 @@
>                      {
>                          m_parent->SetVideoParams(ALIGN(width, 16),
>                                                   ALIGN(height, 16), fps,
> -                                                 keyframedist, aspect);
> +                                                 keyframedist, aspect, kScan_Detect);
>                          m_parent->ReinitVideo();
>                          current_width = width;
>                          current_height = height;

> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


-- 


More information about the mythtv-dev mailing list