avcodec: use the new AVFrame interlace flags in all decoders and encoders

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2023-04-11 15:02:14 -03:00
parent 2df4e054d4
commit 2f561ba953
34 changed files with 130 additions and 107 deletions

View File

@ -1087,8 +1087,8 @@ finish:
dst += dst_linesize; dst += dst_linesize;
} }
} else { } else {
av_log(avctx, AV_LOG_DEBUG, "interlaced frame ? %d", pic->interlaced_frame); av_log(avctx, AV_LOG_DEBUG, "interlaced frame ? %d", !!(pic->flags & AV_FRAME_FLAG_INTERLACED));
pic->interlaced_frame = 1; pic->flags |= AV_FRAME_FLAG_INTERLACED;
low = s->plane[plane].subband[0]; low = s->plane[plane].subband[0];
high = s->plane[plane].subband[7]; high = s->plane[plane].subband[7];
output = s->plane[plane].l_h[6]; output = s->plane[plane].l_h[6];
@ -1284,7 +1284,7 @@ finish:
dst += dst_linesize; dst += dst_linesize;
} }
} else { } else {
pic->interlaced_frame = 1; pic->flags |= AV_FRAME_FLAG_INTERLACED;
low = s->plane[plane].l_h[7]; low = s->plane[plane].l_h[7];
high = s->plane[plane].subband[14]; high = s->plane[plane].subband[14];
output = s->plane[plane].l_h[6]; output = s->plane[plane].l_h[6];

View File

@ -543,9 +543,9 @@ static inline CopyRet copy_frame(AVCodecContext *avctx,
av_image_copy_plane(dst, dStride, src, sStride, bwidth, height); av_image_copy_plane(dst, dStride, src, sStride, bwidth, height);
} }
frame->interlaced_frame = interlaced; frame->flags |= AV_FRAME_FLAG_INTERLACED * !!interlaced;
if (interlaced) if (interlaced)
frame->top_field_first = !bottom_first; frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * !bottom_first;
frame->pts = pkt_pts; frame->pts = pkt_pts;

View File

@ -631,10 +631,11 @@ FF_DISABLE_DEPRECATION_WARNINGS
FF_ENABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS
#endif #endif
frame->interlaced_frame = !parsed_frame.is_deinterlacing && !parsed_frame.dispinfo.progressive_frame; if (!parsed_frame.is_deinterlacing && !parsed_frame.dispinfo.progressive_frame)
frame->flags |= AV_FRAME_FLAG_INTERLACED;
if (frame->interlaced_frame) if ((frame->flags & AV_FRAME_FLAG_INTERLACED) && parsed_frame.dispinfo.top_field_first)
frame->top_field_first = parsed_frame.dispinfo.top_field_first; frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
} else if (ctx->decoder_flushing) { } else if (ctx->decoder_flushing) {
ret = AVERROR_EOF; ret = AVERROR_EOF;
} else { } else {

View File

@ -570,6 +570,8 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
} }
if (!ret) { if (!ret) {
frame->interlaced_frame = !!(frame->flags & AV_FRAME_FLAG_INTERLACED);
frame->top_field_first = !!(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST);
frame->best_effort_timestamp = guess_correct_pts(avctx, frame->best_effort_timestamp = guess_correct_pts(avctx,
frame->pts, frame->pts,
frame->pkt_dts); frame->pkt_dts);

View File

@ -195,8 +195,9 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
} }
if (buf[5] & 2) { /* interlaced */ if (buf[5] & 2) { /* interlaced */
ctx->cur_field = first_field ? buf[5] & 1 : !ctx->cur_field; ctx->cur_field = first_field ? buf[5] & 1 : !ctx->cur_field;
frame->interlaced_frame = 1; frame->flags |= AV_FRAME_FLAG_INTERLACED;
frame->top_field_first = first_field ^ ctx->cur_field; if (first_field ^ ctx->cur_field)
frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
av_log(ctx->avctx, AV_LOG_DEBUG, av_log(ctx->avctx, AV_LOG_DEBUG,
"interlaced %d, cur field %d\n", buf[5] & 3, ctx->cur_field); "interlaced %d, cur field %d\n", buf[5] & 3, ctx->cur_field);
} else { } else {
@ -298,7 +299,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
ctx->mb_width = (ctx->width + 15)>> 4; ctx->mb_width = (ctx->width + 15)>> 4;
ctx->mb_height = AV_RB16(buf + 0x16c); ctx->mb_height = AV_RB16(buf + 0x16c);
if ((ctx->height + 15) >> 4 == ctx->mb_height && frame->interlaced_frame) if ((ctx->height + 15) >> 4 == ctx->mb_height && (frame->flags & AV_FRAME_FLAG_INTERLACED))
ctx->height <<= 1; ctx->height <<= 1;
av_log(ctx->avctx, AV_LOG_VERBOSE, "%dx%d, 4:%s %d bits, MBAFF=%d ACT=%d\n", av_log(ctx->avctx, AV_LOG_VERBOSE, "%dx%d, 4:%s %d bits, MBAFF=%d ACT=%d\n",
@ -316,7 +317,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
} }
ctx->data_offset = 0x280; ctx->data_offset = 0x280;
} }
if ((ctx->mb_height << frame->interlaced_frame) > (ctx->height + 15) >> 4) { if ((ctx->mb_height << !!(frame->flags & AV_FRAME_FLAG_INTERLACED)) > (ctx->height + 15) >> 4) {
av_log(ctx->avctx, AV_LOG_ERROR, av_log(ctx->avctx, AV_LOG_ERROR,
"mb height too big: %d\n", ctx->mb_height); "mb height too big: %d\n", ctx->mb_height);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
@ -530,7 +531,7 @@ static int dnxhd_decode_macroblock(const DNXHDContext *ctx, RowContext *row,
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
if (frame->interlaced_frame) { if (frame->flags & AV_FRAME_FLAG_INTERLACED) {
dct_linesize_luma <<= 1; dct_linesize_luma <<= 1;
dct_linesize_chroma <<= 1; dct_linesize_chroma <<= 1;
} }
@ -539,7 +540,7 @@ static int dnxhd_decode_macroblock(const DNXHDContext *ctx, RowContext *row,
dest_u = frame->data[1] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444)); dest_u = frame->data[1] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444));
dest_v = frame->data[2] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444)); dest_v = frame->data[2] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444));
if (frame->interlaced_frame && ctx->cur_field) { if ((frame->flags & AV_FRAME_FLAG_INTERLACED) && ctx->cur_field) {
dest_y += frame->linesize[0]; dest_y += frame->linesize[0];
dest_u += frame->linesize[1]; dest_u += frame->linesize[1];
dest_v += frame->linesize[2]; dest_v += frame->linesize[2];
@ -659,7 +660,7 @@ decode_coding_unit:
ctx->buf = buf + ctx->data_offset; ctx->buf = buf + ctx->data_offset;
avctx->execute2(avctx, dnxhd_decode_row, picture, NULL, ctx->mb_height); avctx->execute2(avctx, dnxhd_decode_row, picture, NULL, ctx->mb_height);
if (first_field && picture->interlaced_frame) { if (first_field && (picture->flags & AV_FRAME_FLAG_INTERLACED)) {
buf += ctx->cid_table->coding_unit_size; buf += ctx->cid_table->coding_unit_size;
buf_size -= ctx->cid_table->coding_unit_size; buf_size -= ctx->cid_table->coding_unit_size;
first_field = 0; first_field = 0;

View File

@ -1251,7 +1251,8 @@ static void dnxhd_load_picture(DNXHDEncContext *ctx, const AVFrame *frame)
ctx->thread[i]->dct_uv_offset = ctx->m.uvlinesize*8; ctx->thread[i]->dct_uv_offset = ctx->m.uvlinesize*8;
} }
ctx->cur_field = frame->interlaced_frame && !frame->top_field_first; ctx->cur_field = (frame->flags & AV_FRAME_FLAG_INTERLACED) &&
!(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST);
} }
static int dnxhd_encode_picture(AVCodecContext *avctx, AVPacket *pkt, static int dnxhd_encode_picture(AVCodecContext *avctx, AVPacket *pkt,

View File

@ -670,14 +670,14 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, AVFrame *frame,
/* Determine the codec's field order from the packet */ /* Determine the codec's field order from the packet */
if ( *vsc_pack == DV_VIDEO_CONTROL ) { if ( *vsc_pack == DV_VIDEO_CONTROL ) {
if (avctx->height == 720) { if (avctx->height == 720) {
frame->interlaced_frame = 0; frame->flags &= ~AV_FRAME_FLAG_INTERLACED;
frame->top_field_first = 0; frame->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST;
} else if (avctx->height == 1080) { } else if (avctx->height == 1080) {
frame->interlaced_frame = 1; frame->flags |= AV_FRAME_FLAG_INTERLACED;
frame->top_field_first = (vsc_pack[3] & 0x40) == 0x40; frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * ((vsc_pack[3] & 0x40) == 0x40);
} else { } else {
frame->interlaced_frame = (vsc_pack[3] & 0x10) == 0x10; frame->flags |= AV_FRAME_FLAG_INTERLACED * ((vsc_pack[3] & 0x10) == 0x10);
frame->top_field_first = !(vsc_pack[3] & 0x40); frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * !(vsc_pack[3] & 0x40);
} }
} }

View File

@ -1048,9 +1048,9 @@ static inline int dv_write_pack(enum DVPackType pack_id, DVEncContext *c,
int fs; int fs;
if (c->avctx->height >= 720) if (c->avctx->height >= 720)
fs = c->avctx->height == 720 || c->frame->top_field_first ? 0x40 : 0x00; fs = c->avctx->height == 720 || (c->frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST) ? 0x40 : 0x00;
else else
fs = c->frame->top_field_first ? 0x00 : 0x40; fs = (c->frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST) ? 0x00 : 0x40;
if (DV_PROFILE_IS_HD(c->sys) || if (DV_PROFILE_IS_HD(c->sys) ||
(int)(av_q2d(c->avctx->sample_aspect_ratio) * (int)(av_q2d(c->avctx->sample_aspect_ratio) *

View File

@ -192,6 +192,11 @@ int ff_encode_get_frame(AVCodecContext *avctx, AVFrame *frame)
av_frame_move_ref(frame, avci->buffer_frame); av_frame_move_ref(frame, avci->buffer_frame);
if (frame->interlaced_frame)
frame->flags |= AV_FRAME_FLAG_INTERLACED;
if (frame->top_field_first)
frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
return 0; return 0;
} }

View File

@ -217,13 +217,13 @@ static int decode_slice_header(const FFV1Context *f, FFV1Context *fs)
ps = get_symbol(c, state, 0); ps = get_symbol(c, state, 0);
if (ps == 1) { if (ps == 1) {
f->cur->interlaced_frame = 1; f->cur->flags |= AV_FRAME_FLAG_INTERLACED;
f->cur->top_field_first = 1; f->cur->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
} else if (ps == 2) { } else if (ps == 2) {
f->cur->interlaced_frame = 1; f->cur->flags |= AV_FRAME_FLAG_INTERLACED;
f->cur->top_field_first = 0; f->cur->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST;
} else if (ps == 3) { } else if (ps == 3) {
f->cur->interlaced_frame = 0; f->cur->flags &= ~AV_FRAME_FLAG_INTERLACED;
} }
f->cur->sample_aspect_ratio.num = get_symbol(c, state, 0); f->cur->sample_aspect_ratio.num = get_symbol(c, state, 0);
f->cur->sample_aspect_ratio.den = get_symbol(c, state, 0); f->cur->sample_aspect_ratio.den = get_symbol(c, state, 0);
@ -881,9 +881,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
if (f->version < 3 && avctx->field_order > AV_FIELD_PROGRESSIVE) { if (f->version < 3 && avctx->field_order > AV_FIELD_PROGRESSIVE) {
/* we have interlaced material flagged in container */ /* we have interlaced material flagged in container */
p->interlaced_frame = 1; p->flags |= AV_FRAME_FLAG_INTERLACED;
if (avctx->field_order == AV_FIELD_TT || avctx->field_order == AV_FIELD_TB) if (avctx->field_order == AV_FIELD_TT || avctx->field_order == AV_FIELD_TB)
p->top_field_first = 1; p->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
} }
f->avctx = avctx; f->avctx = avctx;

View File

@ -916,10 +916,10 @@ static void encode_slice_header(FFV1Context *f, FFV1Context *fs)
put_symbol(c, state, f->plane[j].quant_table_index, 0); put_symbol(c, state, f->plane[j].quant_table_index, 0);
av_assert0(f->plane[j].quant_table_index == f->context_model); av_assert0(f->plane[j].quant_table_index == f->context_model);
} }
if (!f->cur_enc_frame->interlaced_frame) if (!(f->cur_enc_frame->flags & AV_FRAME_FLAG_INTERLACED))
put_symbol(c, state, 3, 0); put_symbol(c, state, 3, 0);
else else
put_symbol(c, state, 1 + !f->cur_enc_frame->top_field_first, 0); put_symbol(c, state, 1 + !(f->cur_enc_frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST), 0);
put_symbol(c, state, f->cur_enc_frame->sample_aspect_ratio.num, 0); put_symbol(c, state, f->cur_enc_frame->sample_aspect_ratio.num, 0);
put_symbol(c, state, f->cur_enc_frame->sample_aspect_ratio.den, 0); put_symbol(c, state, f->cur_enc_frame->sample_aspect_ratio.den, 0);
if (f->version > 3) { if (f->version > 3) {

View File

@ -1155,9 +1155,10 @@ static int h264_export_frame_props(H264Context *h)
const SPS *sps = h->ps.sps; const SPS *sps = h->ps.sps;
H264Picture *cur = h->cur_pic_ptr; H264Picture *cur = h->cur_pic_ptr;
AVFrame *out = cur->f; AVFrame *out = cur->f;
int interlaced_frame = 0, top_field_first = 0;
int ret; int ret;
out->interlaced_frame = 0; out->flags &= ~AV_FRAME_FLAG_INTERLACED;
out->repeat_pict = 0; out->repeat_pict = 0;
/* Signal interlacing information externally. */ /* Signal interlacing information externally. */
@ -1181,15 +1182,15 @@ static int h264_export_frame_props(H264Context *h)
break; break;
case H264_SEI_PIC_STRUCT_TOP_FIELD: case H264_SEI_PIC_STRUCT_TOP_FIELD:
case H264_SEI_PIC_STRUCT_BOTTOM_FIELD: case H264_SEI_PIC_STRUCT_BOTTOM_FIELD:
out->interlaced_frame = 1; interlaced_frame = 1;
break; break;
case H264_SEI_PIC_STRUCT_TOP_BOTTOM: case H264_SEI_PIC_STRUCT_TOP_BOTTOM:
case H264_SEI_PIC_STRUCT_BOTTOM_TOP: case H264_SEI_PIC_STRUCT_BOTTOM_TOP:
if (FIELD_OR_MBAFF_PICTURE(h)) if (FIELD_OR_MBAFF_PICTURE(h))
out->interlaced_frame = 1; interlaced_frame = 1;
else else
// try to flag soft telecine progressive // try to flag soft telecine progressive
out->interlaced_frame = h->prev_interlaced_frame; interlaced_frame = !!h->prev_interlaced_frame;
break; break;
case H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP: case H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
case H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: case H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
@ -1208,35 +1209,34 @@ static int h264_export_frame_props(H264Context *h)
if ((pt->ct_type & 3) && if ((pt->ct_type & 3) &&
pt->pic_struct <= H264_SEI_PIC_STRUCT_BOTTOM_TOP) pt->pic_struct <= H264_SEI_PIC_STRUCT_BOTTOM_TOP)
out->interlaced_frame = (pt->ct_type & (1 << 1)) != 0; interlaced_frame = ((pt->ct_type & (1 << 1)) != 0);
} else { } else {
/* Derive interlacing flag from used decoding process. */ /* Derive interlacing flag from used decoding process. */
out->interlaced_frame = FIELD_OR_MBAFF_PICTURE(h); interlaced_frame = !!FIELD_OR_MBAFF_PICTURE(h);
} }
h->prev_interlaced_frame = out->interlaced_frame; h->prev_interlaced_frame = interlaced_frame;
if (cur->field_poc[0] != cur->field_poc[1]) { if (cur->field_poc[0] != cur->field_poc[1]) {
/* Derive top_field_first from field pocs. */ /* Derive top_field_first from field pocs. */
out->top_field_first = cur->field_poc[0] < cur->field_poc[1]; top_field_first = (cur->field_poc[0] < cur->field_poc[1]);
} else { } else {
if (sps->pic_struct_present_flag && h->sei.picture_timing.present) { if (sps->pic_struct_present_flag && h->sei.picture_timing.present) {
/* Use picture timing SEI information. Even if it is a /* Use picture timing SEI information. Even if it is a
* information of a past frame, better than nothing. */ * information of a past frame, better than nothing. */
if (h->sei.picture_timing.pic_struct == H264_SEI_PIC_STRUCT_TOP_BOTTOM || if (h->sei.picture_timing.pic_struct == H264_SEI_PIC_STRUCT_TOP_BOTTOM ||
h->sei.picture_timing.pic_struct == H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP) h->sei.picture_timing.pic_struct == H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP)
out->top_field_first = 1; top_field_first = 1;
else } else if (interlaced_frame) {
out->top_field_first = 0;
} else if (out->interlaced_frame) {
/* Default to top field first when pic_struct_present_flag /* Default to top field first when pic_struct_present_flag
* is not set but interlaced frame detected */ * is not set but interlaced frame detected */
out->top_field_first = 1; top_field_first = 1;
} else { } // else
/* Most likely progressive */ /* Most likely progressive */
out->top_field_first = 0;
}
} }
out->flags |= (AV_FRAME_FLAG_INTERLACED * interlaced_frame) |
(AV_FRAME_FLAG_TOP_FIELD_FIRST * top_field_first);
ret = ff_h2645_sei_to_frame(out, &h->sei.common, AV_CODEC_ID_H264, h->avctx, ret = ff_h2645_sei_to_frame(out, &h->sei.common, AV_CODEC_ID_H264, h->avctx,
&sps->vui, sps->bit_depth_luma, sps->bit_depth_chroma, &sps->vui, sps->bit_depth_luma, sps->bit_depth_chroma,
cur->poc + (unsigned)(h->poc_offset << 5)); cur->poc + (unsigned)(h->poc_offset << 5));

View File

@ -111,8 +111,11 @@ static HEVCFrame *alloc_frame(HEVCContext *s)
for (j = 0; j < frame->ctb_count; j++) for (j = 0; j < frame->ctb_count; j++)
frame->rpl_tab[j] = (RefPicListTab *)frame->rpl_buf->data; frame->rpl_tab[j] = (RefPicListTab *)frame->rpl_buf->data;
frame->frame->top_field_first = s->sei.picture_timing.picture_struct == AV_PICTURE_STRUCTURE_TOP_FIELD; if (s->sei.picture_timing.picture_struct == AV_PICTURE_STRUCTURE_TOP_FIELD)
frame->frame->interlaced_frame = (s->sei.picture_timing.picture_struct == AV_PICTURE_STRUCTURE_TOP_FIELD) || (s->sei.picture_timing.picture_struct == AV_PICTURE_STRUCTURE_BOTTOM_FIELD); frame->frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
if ((s->sei.picture_timing.picture_struct == AV_PICTURE_STRUCTURE_TOP_FIELD) ||
(s->sei.picture_timing.picture_struct == AV_PICTURE_STRUCTURE_BOTTOM_FIELD))
frame->frame->flags |= AV_FRAME_FLAG_INTERLACED;
if (s->avctx->hwaccel) { if (s->avctx->hwaccel) {
const AVHWAccel *hwaccel = s->avctx->hwaccel; const AVHWAccel *hwaccel = s->avctx->hwaccel;

View File

@ -196,9 +196,9 @@ static void reconfig_encoder(AVCodecContext *ctx, const AVFrame *frame)
if (x4->avcintra_class < 0) { if (x4->avcintra_class < 0) {
if (x4->params.b_interlaced && x4->params.b_tff != frame->top_field_first) { if (x4->params.b_interlaced && x4->params.b_tff != !!(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)) {
x4->params.b_tff = frame->top_field_first; x4->params.b_tff = !!(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST);
x264_encoder_reconfig(x4->enc, &x4->params); x264_encoder_reconfig(x4->enc, &x4->params);
} }
if (x4->params.vui.i_sar_height*ctx->sample_aspect_ratio.num != ctx->sample_aspect_ratio.den * x4->params.vui.i_sar_width) { if (x4->params.vui.i_sar_height*ctx->sample_aspect_ratio.num != ctx->sample_aspect_ratio.den * x4->params.vui.i_sar_width) {
@ -339,7 +339,7 @@ static int setup_roi(AVCodecContext *ctx, x264_picture_t *pic, int bit_depth,
av_log(ctx, AV_LOG_WARNING, "Adaptive quantization must be enabled to use ROI encoding, skipping ROI.\n"); av_log(ctx, AV_LOG_WARNING, "Adaptive quantization must be enabled to use ROI encoding, skipping ROI.\n");
} }
return 0; return 0;
} else if (frame->interlaced_frame) { } else if (frame->flags & AV_FRAME_FLAG_INTERLACED) {
if (!x4->roi_warned) { if (!x4->roi_warned) {
x4->roi_warned = 1; x4->roi_warned = 1;
av_log(ctx, AV_LOG_WARNING, "interlaced_frame not supported for ROI encoding yet, skipping ROI.\n"); av_log(ctx, AV_LOG_WARNING, "interlaced_frame not supported for ROI encoding yet, skipping ROI.\n");

View File

@ -68,14 +68,16 @@ static int m101_decode_frame(AVCodecContext *avctx, AVFrame *frame,
return ret; return ret;
frame->pict_type = AV_PICTURE_TYPE_I; frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1; frame->key_frame = 1;
frame->interlaced_frame = ((avctx->extradata[3*4] & 3) != 3); if ((avctx->extradata[3*4] & 3) != 3) {
if (frame->interlaced_frame) frame->flags |= AV_FRAME_FLAG_INTERLACED;
frame->top_field_first = avctx->extradata[3*4] & 1; if (avctx->extradata[3*4] & 1)
frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
}
for (y = 0; y < avctx->height; y++) { for (y = 0; y < avctx->height; y++) {
int src_y = y; int src_y = y;
if (frame->interlaced_frame) if (frame->flags & AV_FRAME_FLAG_INTERLACED)
src_y = ((y&1)^frame->top_field_first) ? y/2 : (y/2 + avctx->height/2); src_y = ((y&1) ^ !!(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)) ? y/2 : (y/2 + avctx->height/2);
if (bits == 8) { if (bits == 8) {
uint8_t *line = frame->data[0] + y*frame->linesize[0]; uint8_t *line = frame->data[0] + y*frame->linesize[0];
memcpy(line, buf + src_y*stride, 2*avctx->width); memcpy(line, buf + src_y*stride, 2*avctx->width);

View File

@ -441,8 +441,8 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
s->height < ((s->orig_height * 3) / 4)) { s->height < ((s->orig_height * 3) / 4)) {
s->interlaced = 1; s->interlaced = 1;
s->bottom_field = s->interlace_polarity; s->bottom_field = s->interlace_polarity;
s->picture_ptr->interlaced_frame = 1; s->picture_ptr->flags |= AV_FRAME_FLAG_INTERLACED;
s->picture_ptr->top_field_first = !s->interlace_polarity; s->picture_ptr->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * !s->interlace_polarity;
height *= 2; height *= 2;
} }

View File

@ -622,8 +622,10 @@ static int ffmal_copy_frame(AVCodecContext *avctx, AVFrame *frame,
MMALDecodeContext *ctx = avctx->priv_data; MMALDecodeContext *ctx = avctx->priv_data;
int ret = 0; int ret = 0;
frame->interlaced_frame = ctx->interlaced_frame; if (ctx->interlaced_frame)
frame->top_field_first = ctx->top_field_first; frame->flags |= AV_FRAME_FLAG_INTERLACED;
if (ctx->top_field_first)
frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
if (avctx->pix_fmt == AV_PIX_FMT_MMAL) { if (avctx->pix_fmt == AV_PIX_FMT_MMAL) {
if (!ctx->pool_out) if (!ctx->pool_out)

View File

@ -530,7 +530,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s)
if (s->progressive_sequence) if (s->progressive_sequence)
put_bits(&s->pb, 1, 0); /* no repeat */ put_bits(&s->pb, 1, 0); /* no repeat */
else else
put_bits(&s->pb, 1, s->current_picture_ptr->f->top_field_first); put_bits(&s->pb, 1, !!(s->current_picture_ptr->f->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST));
/* XXX: optimize the generation of this flag with entropy measures */ /* XXX: optimize the generation of this flag with entropy measures */
s->frame_pred_frame_dct = s->progressive_sequence; s->frame_pred_frame_dct = s->progressive_sequence;

View File

@ -1101,7 +1101,7 @@ int ff_mpeg4_encode_picture_header(MpegEncContext *s)
} }
put_bits(&s->pb, 3, 0); /* intra dc VLC threshold */ put_bits(&s->pb, 3, 0); /* intra dc VLC threshold */
if (!s->progressive_sequence) { if (!s->progressive_sequence) {
put_bits(&s->pb, 1, s->current_picture_ptr->f->top_field_first); put_bits(&s->pb, 1, !!(s->current_picture_ptr->f->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST));
put_bits(&s->pb, 1, s->alternate_scan); put_bits(&s->pb, 1, s->alternate_scan);
} }
// FIXME sprite stuff // FIXME sprite stuff

View File

@ -331,15 +331,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
s->current_picture_ptr = pic; s->current_picture_ptr = pic;
// FIXME use only the vars from current_pic // FIXME use only the vars from current_pic
s->current_picture_ptr->f->top_field_first = s->top_field_first; s->current_picture_ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * !!s->top_field_first;
if (s->codec_id == AV_CODEC_ID_MPEG1VIDEO || if (s->codec_id == AV_CODEC_ID_MPEG1VIDEO ||
s->codec_id == AV_CODEC_ID_MPEG2VIDEO) { s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
if (s->picture_structure != PICT_FRAME) if (s->picture_structure != PICT_FRAME)
s->current_picture_ptr->f->top_field_first = s->current_picture_ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST *
(s->picture_structure == PICT_TOP_FIELD) == s->first_field; ((s->picture_structure == PICT_TOP_FIELD) == s->first_field);
} }
s->current_picture_ptr->f->interlaced_frame = !s->progressive_frame && s->current_picture_ptr->f->flags |= AV_FRAME_FLAG_INTERLACED * (!s->progressive_frame &&
!s->progressive_sequence; !s->progressive_sequence);
s->current_picture_ptr->field_picture = s->picture_structure != PICT_FRAME; s->current_picture_ptr->field_picture = s->picture_structure != PICT_FRAME;
s->current_picture_ptr->f->pict_type = s->pict_type; s->current_picture_ptr->f->pict_type = s->pict_type;

View File

@ -2634,7 +2634,7 @@ static int nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
pic_params.outputBitstream = in_surf->output_surface; pic_params.outputBitstream = in_surf->output_surface;
if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) { if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) {
if (frame->top_field_first) if (frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)
pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_TOP_BOTTOM; pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_TOP_BOTTOM;
else else
pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_BOTTOM_TOP; pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FIELD_BOTTOM_TOP;

View File

@ -841,7 +841,7 @@ static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s,
p->pict_type = AV_PICTURE_TYPE_I; p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1; p->key_frame = 1;
p->interlaced_frame = !!s->interlace_type; p->flags |= AV_FRAME_FLAG_INTERLACED * !!s->interlace_type;
if ((ret = populate_avctx_color_fields(avctx, p)) < 0) if ((ret = populate_avctx_color_fields(avctx, p)) < 0)
return ret; return ret;

View File

@ -252,8 +252,9 @@ static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
ctx->scan = ctx->progressive_scan; // permuted ctx->scan = ctx->progressive_scan; // permuted
} else { } else {
ctx->scan = ctx->interlaced_scan; // permuted ctx->scan = ctx->interlaced_scan; // permuted
ctx->frame->interlaced_frame = 1; ctx->frame->flags |= AV_FRAME_FLAG_INTERLACED;
ctx->frame->top_field_first = ctx->frame_type == 1; if (ctx->frame_type == 1)
ctx->frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
} }
if (ctx->alpha_info) { if (ctx->alpha_info) {
@ -706,7 +707,7 @@ static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int
dest_u = pic->data[1] + (slice->mb_y << 4) * chroma_stride + (slice->mb_x << mb_x_shift); dest_u = pic->data[1] + (slice->mb_y << 4) * chroma_stride + (slice->mb_x << mb_x_shift);
dest_v = pic->data[2] + (slice->mb_y << 4) * chroma_stride + (slice->mb_x << mb_x_shift); dest_v = pic->data[2] + (slice->mb_y << 4) * chroma_stride + (slice->mb_x << mb_x_shift);
if (ctx->frame_type && ctx->first_field ^ ctx->frame->top_field_first) { if (ctx->frame_type && ctx->first_field ^ !!(ctx->frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)) {
dest_y += pic->linesize[0]; dest_y += pic->linesize[0];
dest_u += pic->linesize[1]; dest_u += pic->linesize[1];
dest_v += pic->linesize[2]; dest_v += pic->linesize[2];

View File

@ -746,7 +746,8 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
if (avctx->profile >= FF_PROFILE_PRORES_4444) /* 4444 or 4444 Xq */ if (avctx->profile >= FF_PROFILE_PRORES_4444) /* 4444 or 4444 Xq */
frame_flags |= 0x40; /* 444 chroma */ frame_flags |= 0x40; /* 444 chroma */
if (ctx->is_interlaced) { if (ctx->is_interlaced) {
if (pict->top_field_first || !pict->interlaced_frame) { /* tff frame or progressive frame interpret as tff */ if ((pict->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST) || !(pict->flags & AV_FRAME_FLAG_INTERLACED)) {
/* tff frame or progressive frame interpret as tff */
av_log(avctx, AV_LOG_DEBUG, "use interlaced encoding, top field first\n"); av_log(avctx, AV_LOG_DEBUG, "use interlaced encoding, top field first\n");
frame_flags |= 0x04; /* interlaced tff */ frame_flags |= 0x04; /* interlaced tff */
is_top_field_first = 1; is_top_field_first = 1;

View File

@ -585,7 +585,7 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic,
if (ctx->pictures_per_frame == 1) if (ctx->pictures_per_frame == 1)
line_add = 0; line_add = 0;
else else
line_add = ctx->cur_picture_idx ^ !pic->top_field_first; line_add = ctx->cur_picture_idx ^ !(pic->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST);
if (ctx->force_quant) { if (ctx->force_quant) {
qmat = ctx->quants[0]; qmat = ctx->quants[0];
@ -838,7 +838,7 @@ static int find_slice_quant(AVCodecContext *avctx,
if (ctx->pictures_per_frame == 1) if (ctx->pictures_per_frame == 1)
line_add = 0; line_add = 0;
else else
line_add = ctx->cur_picture_idx ^ !ctx->pic->top_field_first; line_add = ctx->cur_picture_idx ^ !(ctx->pic->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST);
mbs = x + mbs_per_slice; mbs = x + mbs_per_slice;
for (i = 0; i < ctx->num_planes; i++) { for (i = 0; i < ctx->num_planes; i++) {
@ -1045,7 +1045,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
frame_flags = ctx->chroma_factor << 6; frame_flags = ctx->chroma_factor << 6;
if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT)
frame_flags |= pic->top_field_first ? 0x04 : 0x08; frame_flags |= (pic->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST) ? 0x04 : 0x08;
bytestream_put_byte (&buf, frame_flags); bytestream_put_byte (&buf, frame_flags);
bytestream_put_byte (&buf, 0); // reserved bytestream_put_byte (&buf, 0); // reserved

View File

@ -828,9 +828,9 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext *q,
outsurf->Info.PicStruct & MFX_PICSTRUCT_FRAME_TRIPLING ? 4 : outsurf->Info.PicStruct & MFX_PICSTRUCT_FRAME_TRIPLING ? 4 :
outsurf->Info.PicStruct & MFX_PICSTRUCT_FRAME_DOUBLING ? 2 : outsurf->Info.PicStruct & MFX_PICSTRUCT_FRAME_DOUBLING ? 2 :
outsurf->Info.PicStruct & MFX_PICSTRUCT_FIELD_REPEATED ? 1 : 0; outsurf->Info.PicStruct & MFX_PICSTRUCT_FIELD_REPEATED ? 1 : 0;
frame->top_field_first = frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST *
outsurf->Info.PicStruct & MFX_PICSTRUCT_FIELD_TFF; !!(outsurf->Info.PicStruct & MFX_PICSTRUCT_FIELD_TFF);
frame->interlaced_frame = frame->flags |= AV_FRAME_FLAG_INTERLACED *
!(outsurf->Info.PicStruct & MFX_PICSTRUCT_PROGRESSIVE); !(outsurf->Info.PicStruct & MFX_PICSTRUCT_PROGRESSIVE);
frame->pict_type = ff_qsv_map_pictype(aframe.frame->dec_info.FrameType); frame->pict_type = ff_qsv_map_pictype(aframe.frame->dec_info.FrameType);
//Key frame is IDR frame is only suitable for H264. For HEVC, IRAPs are key frames. //Key frame is IDR frame is only suitable for H264. For HEVC, IRAPs are key frames.

View File

@ -1947,8 +1947,8 @@ static int submit_frame(QSVEncContext *q, const AVFrame *frame,
qf->surface.Info = q->param.mfx.FrameInfo; qf->surface.Info = q->param.mfx.FrameInfo;
qf->surface.Info.PicStruct = qf->surface.Info.PicStruct =
!frame->interlaced_frame ? MFX_PICSTRUCT_PROGRESSIVE : !(frame->flags & AV_FRAME_FLAG_INTERLACED) ? MFX_PICSTRUCT_PROGRESSIVE :
frame->top_field_first ? MFX_PICSTRUCT_FIELD_TFF : (frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST) ? MFX_PICSTRUCT_FIELD_TFF :
MFX_PICSTRUCT_FIELD_BFF; MFX_PICSTRUCT_FIELD_BFF;
if (frame->repeat_pict == 1) if (frame->repeat_pict == 1)
qf->surface.Info.PicStruct |= MFX_PICSTRUCT_FIELD_REPEATED; qf->surface.Info.PicStruct |= MFX_PICSTRUCT_FIELD_REPEATED;
@ -2402,7 +2402,7 @@ static int encode_frame(AVCodecContext *avctx, QSVEncContext *q,
goto free; goto free;
} }
if (ret == MFX_WRN_INCOMPATIBLE_VIDEO_PARAM && frame && frame->interlaced_frame) if (ret == MFX_WRN_INCOMPATIBLE_VIDEO_PARAM && frame && (frame->flags & AV_FRAME_FLAG_INTERLACED))
print_interlace_msg(avctx, q); print_interlace_msg(avctx, q);
ret = 0; ret = 0;

View File

@ -234,8 +234,9 @@ static int raw_decode(AVCodecContext *avctx, AVFrame *frame,
return res; return res;
if (context->tff >= 0) { if (context->tff >= 0) {
frame->interlaced_frame = 1; frame->flags |= AV_FRAME_FLAG_INTERLACED;
frame->top_field_first = context->tff; if (context->tff == 1)
frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
} }
if ((res = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0) if ((res = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0)
@ -459,9 +460,9 @@ static int raw_decode(AVCodecContext *avctx, AVFrame *frame,
} }
if (avctx->field_order > AV_FIELD_PROGRESSIVE) { /* we have interlaced material flagged in container */ if (avctx->field_order > AV_FIELD_PROGRESSIVE) { /* we have interlaced material flagged in container */
frame->interlaced_frame = 1; frame->flags |= AV_FRAME_FLAG_INTERLACED;
if (avctx->field_order == AV_FIELD_TT || avctx->field_order == AV_FIELD_TB) if (avctx->field_order == AV_FIELD_TT || avctx->field_order == AV_FIELD_TB)
frame->top_field_first = 1; frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
} }
*got_frame = 1; *got_frame = 1;

View File

@ -404,8 +404,10 @@ static int rkmpp_retrieve_frame(AVCodecContext *avctx, AVFrame *frame)
frame->colorspace = mpp_frame_get_colorspace(mppframe); frame->colorspace = mpp_frame_get_colorspace(mppframe);
mode = mpp_frame_get_mode(mppframe); mode = mpp_frame_get_mode(mppframe);
frame->interlaced_frame = ((mode & MPP_FRAME_FLAG_FIELD_ORDER_MASK) == MPP_FRAME_FLAG_DEINTERLACED); if ((mode & MPP_FRAME_FLAG_FIELD_ORDER_MASK) == MPP_FRAME_FLAG_DEINTERLACED)
frame->top_field_first = ((mode & MPP_FRAME_FLAG_FIELD_ORDER_MASK) == MPP_FRAME_FLAG_TOP_FIRST); frame->flags |= AV_FRAME_FLAG_INTERLACED;
if ((mode & MPP_FRAME_FLAG_FIELD_ORDER_MASK) == MPP_FRAME_FLAG_TOP_FIRST)
frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
mppformat = mpp_frame_get_fmt(mppframe); mppformat = mpp_frame_get_fmt(mppframe);
drmformat = rkmpp_get_frameformat(mppformat); drmformat = rkmpp_get_frameformat(mppformat);

View File

@ -871,7 +871,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
frame->key_frame = 1; frame->key_frame = 1;
frame->pict_type = AV_PICTURE_TYPE_I; frame->pict_type = AV_PICTURE_TYPE_I;
frame->interlaced_frame = !!c->interlaced; if (c->interlaced)
frame->flags |= AV_FRAME_FLAG_INTERLACED;
*got_frame = 1; *got_frame = 1;

View File

@ -207,9 +207,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *pic,
if (avctx->field_order > AV_FIELD_PROGRESSIVE) { if (avctx->field_order > AV_FIELD_PROGRESSIVE) {
/* we have interlaced material flagged in container */ /* we have interlaced material flagged in container */
pic->interlaced_frame = 1; pic->flags |= AV_FRAME_FLAG_INTERLACED;
if (avctx->field_order == AV_FIELD_TT || avctx->field_order == AV_FIELD_TB) if (avctx->field_order == AV_FIELD_TT || avctx->field_order == AV_FIELD_TB)
pic->top_field_first = 1; pic->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
} }
*got_frame = 1; *got_frame = 1;

View File

@ -60,10 +60,10 @@ static void fill_vaapi_pic(VAPictureHEVC *va_pic, const HEVCFrame *pic, int rps_
if (pic->flags & HEVC_FRAME_FLAG_LONG_REF) if (pic->flags & HEVC_FRAME_FLAG_LONG_REF)
va_pic->flags |= VA_PICTURE_HEVC_LONG_TERM_REFERENCE; va_pic->flags |= VA_PICTURE_HEVC_LONG_TERM_REFERENCE;
if (pic->frame->interlaced_frame) { if (pic->frame->flags & AV_FRAME_FLAG_INTERLACED) {
va_pic->flags |= VA_PICTURE_HEVC_FIELD_PIC; va_pic->flags |= VA_PICTURE_HEVC_FIELD_PIC;
if (!pic->frame->top_field_first) if (!(pic->frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST))
va_pic->flags |= VA_PICTURE_HEVC_BOTTOM_FIELD; va_pic->flags |= VA_PICTURE_HEVC_BOTTOM_FIELD;
} }
} }

View File

@ -233,7 +233,7 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir)
luty = v->last_luty; luty = v->last_luty;
lutuv = v->last_lutuv; lutuv = v->last_lutuv;
use_ic = v->last_use_ic; use_ic = v->last_use_ic;
interlace = s->last_picture.f->interlaced_frame; interlace = !!(s->last_picture.f->flags & AV_FRAME_FLAG_INTERLACED);
} }
} else { } else {
srcY = s->next_picture.f->data[0]; srcY = s->next_picture.f->data[0];
@ -242,7 +242,7 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir)
luty = v->next_luty; luty = v->next_luty;
lutuv = v->next_lutuv; lutuv = v->next_lutuv;
use_ic = v->next_use_ic; use_ic = v->next_use_ic;
interlace = s->next_picture.f->interlaced_frame; interlace = !!(s->next_picture.f->flags & AV_FRAME_FLAG_INTERLACED);
} }
if (!srcY || !srcU) { if (!srcY || !srcU) {
@ -482,13 +482,13 @@ void ff_vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg)
srcY = s->last_picture.f->data[0]; srcY = s->last_picture.f->data[0];
luty = v->last_luty; luty = v->last_luty;
use_ic = v->last_use_ic; use_ic = v->last_use_ic;
interlace = s->last_picture.f->interlaced_frame; interlace = !!(s->last_picture.f->flags & AV_FRAME_FLAG_INTERLACED);
} }
} else { } else {
srcY = s->next_picture.f->data[0]; srcY = s->next_picture.f->data[0];
luty = v->next_luty; luty = v->next_luty;
use_ic = v->next_use_ic; use_ic = v->next_use_ic;
interlace = s->next_picture.f->interlaced_frame; interlace = !!(s->next_picture.f->flags & AV_FRAME_FLAG_INTERLACED);
} }
if (!srcY) { if (!srcY) {
@ -708,14 +708,14 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir)
srcV = s->last_picture.f->data[2]; srcV = s->last_picture.f->data[2];
lutuv = v->last_lutuv; lutuv = v->last_lutuv;
use_ic = v->last_use_ic; use_ic = v->last_use_ic;
interlace = s->last_picture.f->interlaced_frame; interlace = !!(s->last_picture.f->flags & AV_FRAME_FLAG_INTERLACED);
} }
} else { } else {
srcU = s->next_picture.f->data[1]; srcU = s->next_picture.f->data[1];
srcV = s->next_picture.f->data[2]; srcV = s->next_picture.f->data[2];
lutuv = v->next_lutuv; lutuv = v->next_lutuv;
use_ic = v->next_use_ic; use_ic = v->next_use_ic;
interlace = s->next_picture.f->interlaced_frame; interlace = !!(s->next_picture.f->flags & AV_FRAME_FLAG_INTERLACED);
} }
if (!srcU) { if (!srcU) {
@ -884,13 +884,13 @@ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int dir, int dir2, int avg)
srcV = s->next_picture.f->data[2]; srcV = s->next_picture.f->data[2];
lutuv = v->next_lutuv; lutuv = v->next_lutuv;
use_ic = v->next_use_ic; use_ic = v->next_use_ic;
interlace = s->next_picture.f->interlaced_frame; interlace = !!(s->next_picture.f->flags & AV_FRAME_FLAG_INTERLACED);
} else { } else {
srcU = s->last_picture.f->data[1]; srcU = s->last_picture.f->data[1];
srcV = s->last_picture.f->data[2]; srcV = s->last_picture.f->data[2];
lutuv = v->last_lutuv; lutuv = v->last_lutuv;
use_ic = v->last_use_ic; use_ic = v->last_use_ic;
interlace = s->last_picture.f->interlaced_frame; interlace = !!(s->last_picture.f->flags & AV_FRAME_FLAG_INTERLACED);
} }
if (!srcU) if (!srcU)
return; return;
@ -1034,7 +1034,7 @@ void ff_vc1_interp_mc(VC1Context *v)
srcU = s->next_picture.f->data[1]; srcU = s->next_picture.f->data[1];
srcV = s->next_picture.f->data[2]; srcV = s->next_picture.f->data[2];
interlace = s->next_picture.f->interlaced_frame; interlace = !!(s->next_picture.f->flags & AV_FRAME_FLAG_INTERLACED);
src_x = s->mb_x * 16 + (mx >> 2); src_x = s->mb_x * 16 + (mx >> 2);
src_y = s->mb_y * 16 + (my >> 2); src_y = s->mb_y * 16 + (my >> 2);

View File

@ -1078,8 +1078,8 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict,
} }
v->s.current_picture_ptr->field_picture = v->field_mode; v->s.current_picture_ptr->field_picture = v->field_mode;
v->s.current_picture_ptr->f->interlaced_frame = (v->fcm != PROGRESSIVE); v->s.current_picture_ptr->f->flags |= AV_FRAME_FLAG_INTERLACED * (v->fcm != PROGRESSIVE);
v->s.current_picture_ptr->f->top_field_first = v->tff; v->s.current_picture_ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * !!v->tff;
// process pulldown flags // process pulldown flags
s->current_picture_ptr->f->repeat_pict = 0; s->current_picture_ptr->f->repeat_pict = 0;