[mythtv] bugfix patch for XvMC deinterlacing
Daniel Thor Kristjansson
danielk at cat.nyu.edu
Mon Jul 19 14:47:12 EDT 2004
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
-------------- next part --------------
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;
More information about the mythtv-dev
mailing list