Commit 872fdf8630 for ffmpeg
commit 872fdf8630330d125a052359cde45d242d209b36
Author: Baptiste Coudurier <baptiste.coudurier@gmail.com>
Date: Sat Nov 21 17:26:10 2026 -0800
avcodec/dvdec: honor progressive 1080-line DV field order
Use the coded profile height for field flags at reduced resolution
and honor progressive field order supplied by the container.
Co-authored-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Baptiste Coudurier <baptiste.coudurier@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index 02dfdf40c4..3072817bb6 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -665,12 +665,16 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, AVFrame *frame,
/* Determine the codec's field order from the packet */
if ( *vsc_pack == DV_VIDEO_CONTROL ) {
- if (avctx->height == 720) {
+ if (sys->height == 720) {
frame->flags &= ~AV_FRAME_FLAG_INTERLACED;
frame->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST;
- } else if (avctx->height == 1080) {
- frame->flags |= AV_FRAME_FLAG_INTERLACED;
- frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * ((vsc_pack[3] & 0x40) == 0x40);
+ } else if (sys->height == 1080) {
+ /* SMPTE 370M has no interlace flag, progressive frames are
+ * coded as two fields and only signaled by the container */
+ if (avctx->field_order != AV_FIELD_PROGRESSIVE) {
+ frame->flags |= AV_FRAME_FLAG_INTERLACED;
+ frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * ((vsc_pack[3] & 0x40) == 0x40);
+ }
} else {
frame->flags |= AV_FRAME_FLAG_INTERLACED * ((vsc_pack[3] & 0x10) == 0x10);
frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * !(vsc_pack[3] & 0x40);