Skip to content

Commit eb8f298

Browse files
committed
lavc/qsvdec: fix some h264 interlaced clips regression
1. field_order of some h264 interlaced video (e.g: cama3_vtc_b.avc) is marked as AV_FIELD_UNKNOWN in h264_parser.c. This is not a completed frames. So only set the MFX_BITSTREAM_COMPLETE_FRAME when it is progressive. 2. some clips have both progressive and interlaced frames (e.g.CAPAMA3_Sand_F.264), the parsed field_order maybe changed druing the decoding progress. Signed-off-by: Zhong Li <zhong.li@intel.com>
1 parent 698d861 commit eb8f298

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

libavcodec/qsvdec.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,7 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext *q,
310310
bs.DataLength = avpkt->size;
311311
bs.MaxLength = bs.DataLength;
312312
bs.TimeStamp = avpkt->pts;
313-
if (avctx->field_order == AV_FIELD_UNKNOWN ||
314-
avctx->field_order == AV_FIELD_PROGRESSIVE)
313+
if (avctx->field_order == AV_FIELD_PROGRESSIVE)
315314
bs.DataFlag |= MFX_BITSTREAM_COMPLETE_FRAME;
316315
}
317316

@@ -497,6 +496,7 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q,
497496
pkt->data, pkt->size, pkt->pts, pkt->dts,
498497
pkt->pos);
499498

499+
avctx->field_order = q->parser->field_order;
500500
/* TODO: flush delayed frames on reinit */
501501
if (q->parser->format != q->orig_pix_fmt ||
502502
FFALIGN(q->parser->coded_width, 16) != FFALIGN(avctx->coded_width, 16) ||
@@ -521,7 +521,6 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q,
521521
avctx->height = q->parser->height;
522522
avctx->coded_width = FFALIGN(q->parser->coded_width, 16);
523523
avctx->coded_height = FFALIGN(q->parser->coded_height, 16);
524-
avctx->field_order = q->parser->field_order;
525524
avctx->level = q->avctx_internal->level;
526525
avctx->profile = q->avctx_internal->profile;
527526

0 commit comments

Comments
 (0)