[FFmpeg-cvslog] avcodec/dvdec: correctly set interlaced and tff

Baptiste Coudurier git at videolan.org
Wed Nov 6 18:42:20 EET 2019


ffmpeg | branch: master | Baptiste Coudurier <baptiste.coudurier at gmail.com> | Fri Jun 28 10:33:05 2019 -0700| [33203a08e0a26598cb103508327a1dc184b27bc6] | committer: Baptiste Coudurier

avcodec/dvdec: correctly set interlaced and tff

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=33203a08e0a26598cb103508327a1dc184b27bc6
---

 libavcodec/dvdec.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index 89864f2edc..daa8c74328 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -542,12 +542,19 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, void *data,
 
     if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
         return ret;
-    frame.f->interlaced_frame = 1;
-    frame.f->top_field_first  = 0;
 
     /* Determine the codec's field order from the packet */
     if ( *vsc_pack == dv_video_control ) {
-        frame.f->top_field_first = !(vsc_pack[3] & 0x40);
+        if (avctx->height == 720) {
+            frame.f->interlaced_frame = 0;
+            frame.f->top_field_first = 0;
+        } else if (avctx->height == 1080) {
+            frame.f->interlaced_frame = 1;
+            frame.f->top_field_first = (vsc_pack[3] & 0x40) == 0x40;
+        } else {
+            frame.f->interlaced_frame = (vsc_pack[3] & 0x10) == 0x10;
+            frame.f->top_field_first = !(vsc_pack[3] & 0x40);
+        }
     }
 
     s->buf = buf;



More information about the ffmpeg-cvslog mailing list