Commit 59a53842 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  mpegvideo: operate with pointers to AVFrames instead of whole structs

Conflicts:
	libavcodec/h261dec.c
	libavcodec/h263dec.c
	libavcodec/intrax8.c
	libavcodec/mpeg12enc.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo.h
	libavcodec/mpegvideo_enc.c
	libavcodec/mpegvideo_motion.c
	libavcodec/mpegvideo_xvmc.c
	libavcodec/msmpeg4.c
	libavcodec/ratecontrol.c
	libavcodec/vaapi.c
	libavcodec/vc1dec.c
	libavcodec/vdpau_vc1.c

See: fc567ac4Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 60ef0c6f f6774f90
......@@ -44,14 +44,14 @@ static void fill_picture_parameters(AVCodecContext *avctx,
int is_field = s->picture_structure != PICT_FRAME;
memset(pp, 0, sizeof(*pp));
pp->wDecodedPictureIndex = ff_dxva2_get_surface_index(ctx, &current_picture->f);
pp->wDecodedPictureIndex = ff_dxva2_get_surface_index(ctx, current_picture->f);
pp->wDeblockedPictureIndex = 0;
if (s->pict_type != AV_PICTURE_TYPE_I)
pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->last_picture.f);
pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, s->last_picture.f);
else
pp->wForwardRefPictureIndex = 0xffff;
if (s->pict_type == AV_PICTURE_TYPE_B)
pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->next_picture.f);
pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, s->next_picture.f);
else
pp->wBackwardRefPictureIndex = 0xffff;
pp->wPicWidthInMBminus1 = s->mb_width - 1;
......@@ -258,7 +258,7 @@ static int dxva2_mpeg2_end_frame(AVCodecContext *avctx)
if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
return -1;
ret = ff_dxva2_common_end_frame(avctx, &s->current_picture_ptr->f,
ret = ff_dxva2_common_end_frame(avctx, s->current_picture_ptr->f,
&ctx_pic->pp, sizeof(ctx_pic->pp),
&ctx_pic->qm, sizeof(ctx_pic->qm),
commit_bitstream_and_slice_buffer);
......
......@@ -51,13 +51,13 @@ static void fill_picture_parameters(AVCodecContext *avctx,
memset(pp, 0, sizeof(*pp));
pp->wDecodedPictureIndex =
pp->wDeblockedPictureIndex = ff_dxva2_get_surface_index(ctx, &current_picture->f);
pp->wDeblockedPictureIndex = ff_dxva2_get_surface_index(ctx, current_picture->f);
if (s->pict_type != AV_PICTURE_TYPE_I && !v->bi_type)
pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->last_picture.f);
pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, s->last_picture.f);
else
pp->wForwardRefPictureIndex = 0xffff;
if (s->pict_type == AV_PICTURE_TYPE_B && !v->bi_type)
pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->next_picture.f);
pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, s->next_picture.f);
else
pp->wBackwardRefPictureIndex = 0xffff;
if (v->profile == PROFILE_ADVANCED) {
......@@ -283,7 +283,7 @@ static int dxva2_vc1_end_frame(AVCodecContext *avctx)
if (ctx_pic->bitstream_size <= 0)
return -1;
ret = ff_dxva2_common_end_frame(avctx, &v->s.current_picture_ptr->f,
ret = ff_dxva2_common_end_frame(avctx, v->s.current_picture_ptr->f,
&ctx_pic->pp, sizeof(ctx_pic->pp),
NULL, 0,
commit_bitstream_and_slice_buffer);
......
......@@ -617,8 +617,8 @@ retry:
}
// for skipping the frame
s->current_picture.f.pict_type = s->pict_type;
s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I;
s->current_picture.f->pict_type = s->pict_type;
s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;
if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) ||
(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) ||
......@@ -641,10 +641,10 @@ retry:
}
ff_MPV_frame_end(s);
av_assert0(s->current_picture.f.pict_type == s->current_picture_ptr->f.pict_type);
av_assert0(s->current_picture.f.pict_type == s->pict_type);
av_assert0(s->current_picture.f->pict_type == s->current_picture_ptr->f->pict_type);
av_assert0(s->current_picture.f->pict_type == s->pict_type);
if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0)
if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0)
return ret;
ff_print_debug_info(s, s->current_picture_ptr, pict);
......
......@@ -394,7 +394,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if (buf_size == 0) {
/* special case for last picture */
if (s->low_delay == 0 && s->next_picture_ptr) {
if ((ret = av_frame_ref(pict, &s->next_picture_ptr->f)) < 0)
if ((ret = av_frame_ref(pict, s->next_picture_ptr->f)) < 0)
return ret;
s->next_picture_ptr = NULL;
......@@ -455,7 +455,7 @@ retry:
/* We need to set current_picture_ptr before reading the header,
* otherwise we cannot store anyting in there */
if (s->current_picture_ptr == NULL || s->current_picture_ptr->f.data[0]) {
if (s->current_picture_ptr == NULL || s->current_picture_ptr->f->data[0]) {
int i = ff_find_unused_picture(s, 0);
if (i < 0)
return i;
......@@ -531,8 +531,8 @@ retry:
s->gob_index = ff_h263_get_gob_height(s);
// for skipping the frame
s->current_picture.f.pict_type = s->pict_type;
s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I;
s->current_picture.f->pict_type = s->pict_type;
s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;
/* skip B-frames if we don't have reference frames */
if (s->last_picture_ptr == NULL &&
......@@ -640,15 +640,15 @@ frame_end:
if (!s->divx_packed && avctx->hwaccel)
ff_thread_finish_setup(avctx);
av_assert1(s->current_picture.f.pict_type == s->current_picture_ptr->f.pict_type);
av_assert1(s->current_picture.f.pict_type == s->pict_type);
av_assert1(s->current_picture.f->pict_type == s->current_picture_ptr->f->pict_type);
av_assert1(s->current_picture.f->pict_type == s->pict_type);
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0)
if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0)
return ret;
ff_print_debug_info(s, s->current_picture_ptr, pict);
ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1);
} else if (s->last_picture_ptr != NULL) {
if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0)
if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0)
return ret;
ff_print_debug_info(s, s->last_picture_ptr, pict);
ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_QSCALE_TYPE_MPEG1);
......
......@@ -303,7 +303,7 @@ static int x8_setup_spatial_predictor(IntraX8Context * const w, const int chroma
int quant;
w->dsp.setup_spatial_compensation(s->dest[chroma], s->edge_emu_buffer,
s->current_picture.f.linesize[chroma>0],
s->current_picture.f->linesize[chroma>0],
&range, &sum, w->edges);
if(chroma){
w->orient=w->chroma_orient;
......@@ -612,7 +612,7 @@ static int x8_decode_intra_mb(IntraX8Context* const w, const int chroma){
dc_level+= (w->predicted_dc*divide_quant + (1<<12) )>>13;
dsp_x8_put_solidcolor( av_clip_uint8((dc_level*dc_quant+4)>>3),
s->dest[chroma], s->current_picture.f.linesize[!!chroma]);
s->dest[chroma], s->current_picture.f->linesize[!!chroma]);
goto block_placed;
}
......@@ -636,15 +636,15 @@ static int x8_decode_intra_mb(IntraX8Context* const w, const int chroma){
}
if(w->flat_dc){
dsp_x8_put_solidcolor(w->predicted_dc, s->dest[chroma], s->current_picture.f.linesize[!!chroma]);
dsp_x8_put_solidcolor(w->predicted_dc, s->dest[chroma], s->current_picture.f->linesize[!!chroma]);
}else{
w->dsp.spatial_compensation[w->orient]( s->edge_emu_buffer,
s->dest[chroma],
s->current_picture.f.linesize[!!chroma] );
s->current_picture.f->linesize[!!chroma] );
}
if(!zeros_only)
w->wdsp.idct_add (s->dest[chroma],
s->current_picture.f.linesize[!!chroma],
s->current_picture.f->linesize[!!chroma],
s->block[0] );
block_placed:
......@@ -655,7 +655,7 @@ block_placed:
if(s->loop_filter){
uint8_t* ptr = s->dest[chroma];
int linesize = s->current_picture.f.linesize[!!chroma];
int linesize = s->current_picture.f->linesize[!!chroma];
if(!( (w->edges&2) || ( zeros_only && (w->orient|4)==4 ) )){
w->dsp.h_loop_filter(ptr, linesize, w->quant);
......@@ -670,12 +670,12 @@ block_placed:
static void x8_init_block_index(MpegEncContext *s){ //FIXME maybe merge with ff_*
//not s->linesize as this would be wrong for field pics
//not that IntraX8 has interlacing support ;)
const int linesize = s->current_picture.f.linesize[0];
const int uvlinesize = s->current_picture.f.linesize[1];
const int linesize = s->current_picture.f->linesize[0];
const int uvlinesize = s->current_picture.f->linesize[1];
s->dest[0] = s->current_picture.f.data[0];
s->dest[1] = s->current_picture.f.data[1];
s->dest[2] = s->current_picture.f.data[2];
s->dest[0] = s->current_picture.f->data[0];
s->dest[1] = s->current_picture.f->data[1];
s->dest[2] = s->current_picture.f->data[2];
s->dest[0] += s->mb_y * linesize << 3;
s->dest[1] += ( s->mb_y&(~1) ) * uvlinesize << 2;//chroma blocks are on add rows
......
......@@ -670,7 +670,7 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift)
return INT_MAX;
if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){
dmin_sum += s->dsp.mb_cmp[0](s, s->new_picture.f.data[0] + s->mb_x*16 + s->mb_y*16*stride, c->scratchpad, stride, 16);
dmin_sum += s->dsp.mb_cmp[0](s, s->new_picture.f->data[0] + s->mb_x*16 + s->mb_y*16*stride, c->scratchpad, stride, 16);
}
if(c->avctx->mb_cmp&FF_CMP_CHROMA){
......@@ -685,15 +685,15 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift)
offset= (s->mb_x*8 + (mx>>1)) + (s->mb_y*8 + (my>>1))*s->uvlinesize;
if(s->no_rounding){
s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad , s->last_picture.f.data[1] + offset, s->uvlinesize, 8);
s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad + 8, s->last_picture.f.data[2] + offset, s->uvlinesize, 8);
s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad , s->last_picture.f->data[1] + offset, s->uvlinesize, 8);
s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad + 8, s->last_picture.f->data[2] + offset, s->uvlinesize, 8);
}else{
s->hdsp.put_pixels_tab [1][dxy](c->scratchpad , s->last_picture.f.data[1] + offset, s->uvlinesize, 8);
s->hdsp.put_pixels_tab [1][dxy](c->scratchpad + 8, s->last_picture.f.data[2] + offset, s->uvlinesize, 8);
s->hdsp.put_pixels_tab [1][dxy](c->scratchpad , s->last_picture.f->data[1] + offset, s->uvlinesize, 8);
s->hdsp.put_pixels_tab [1][dxy](c->scratchpad + 8, s->last_picture.f->data[2] + offset, s->uvlinesize, 8);
}
dmin_sum += s->dsp.mb_cmp[1](s, s->new_picture.f.data[1] + s->mb_x*8 + s->mb_y*8*s->uvlinesize, c->scratchpad , s->uvlinesize, 8);
dmin_sum += s->dsp.mb_cmp[1](s, s->new_picture.f.data[2] + s->mb_x*8 + s->mb_y*8*s->uvlinesize, c->scratchpad+8, s->uvlinesize, 8);
dmin_sum += s->dsp.mb_cmp[1](s, s->new_picture.f->data[1] + s->mb_x*8 + s->mb_y*8*s->uvlinesize, c->scratchpad , s->uvlinesize, 8);
dmin_sum += s->dsp.mb_cmp[1](s, s->new_picture.f->data[2] + s->mb_x*8 + s->mb_y*8*s->uvlinesize, c->scratchpad+8, s->uvlinesize, 8);
}
c->pred_x= mx;
......@@ -881,7 +881,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
int mb_type=0;
Picture * const pic= &s->current_picture;
init_ref(c, s->new_picture.f.data, s->last_picture.f.data, NULL, 16*mb_x, 16*mb_y, 0);
init_ref(c, s->new_picture.f->data, s->last_picture.f->data, NULL, 16*mb_x, 16*mb_y, 0);
av_assert0(s->quarter_sample==0 || s->quarter_sample==1);
av_assert0(s->linesize == c->stride);
......@@ -1080,7 +1080,7 @@ int ff_pre_estimate_p_frame_motion(MpegEncContext * s,
int P[10][2];
const int shift= 1+s->quarter_sample;
const int xy= mb_x + mb_y*s->mb_stride;
init_ref(c, s->new_picture.f.data, s->last_picture.f.data, NULL, 16*mb_x, 16*mb_y, 0);
init_ref(c, s->new_picture.f->data, s->last_picture.f->data, NULL, 16*mb_x, 16*mb_y, 0);
av_assert0(s->quarter_sample==0 || s->quarter_sample==1);
......@@ -1519,8 +1519,8 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
int fmin, bmin, dmin, fbmin, bimin, fimin;
int type=0;
const int xy = mb_y*s->mb_stride + mb_x;
init_ref(c, s->new_picture.f.data, s->last_picture.f.data,
s->next_picture.f.data, 16 * mb_x, 16 * mb_y, 2);
init_ref(c, s->new_picture.f->data, s->last_picture.f->data,
s->next_picture.f->data, 16 * mb_x, 16 * mb_y, 2);
get_limits(s, 16*mb_x, 16*mb_y);
......
......@@ -1403,8 +1403,8 @@ static int mpeg1_decode_picture(AVCodecContext *avctx, const uint8_t *buf,
s->mpeg_f_code[1][0] = f_code;
s->mpeg_f_code[1][1] = f_code;
}
s->current_picture.f.pict_type = s->pict_type;
s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I;
s->current_picture.f->pict_type = s->pict_type;
s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;
if (avctx->debug & FF_DEBUG_PICT_INFO)
av_log(avctx, AV_LOG_DEBUG,
......@@ -1566,8 +1566,8 @@ static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
s->pict_type = AV_PICTURE_TYPE_P;
} else
s->pict_type = AV_PICTURE_TYPE_B;
s->current_picture.f.pict_type = s->pict_type;
s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I;
s->current_picture.f->pict_type = s->pict_type;
s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;
}
s->mpeg_f_code[0][0] += !s->mpeg_f_code[0][0];
s->mpeg_f_code[0][1] += !s->mpeg_f_code[0][1];
......@@ -1621,19 +1621,19 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
ff_mpeg_er_frame_start(s);
/* first check if we must repeat the frame */
s->current_picture_ptr->f.repeat_pict = 0;
s->current_picture_ptr->f->repeat_pict = 0;
if (s->repeat_first_field) {
if (s->progressive_sequence) {
if (s->top_field_first)
s->current_picture_ptr->f.repeat_pict = 4;
s->current_picture_ptr->f->repeat_pict = 4;
else
s->current_picture_ptr->f.repeat_pict = 2;
s->current_picture_ptr->f->repeat_pict = 2;
} else if (s->progressive_frame) {
s->current_picture_ptr->f.repeat_pict = 1;
s->current_picture_ptr->f->repeat_pict = 1;
}
}
pan_scan = av_frame_new_side_data(&s->current_picture_ptr->f,
pan_scan = av_frame_new_side_data(s->current_picture_ptr->f,
AV_FRAME_DATA_PANSCAN,
sizeof(s1->pan_scan));
if (!pan_scan)
......@@ -1642,7 +1642,7 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
if (s1->a53_caption) {
AVFrameSideData *sd = av_frame_new_side_data(
&s->current_picture_ptr->f, AV_FRAME_DATA_A53_CC,
s->current_picture_ptr->f, AV_FRAME_DATA_A53_CC,
s1->a53_caption_size);
if (sd)
memcpy(sd->data, s1->a53_caption, s1->a53_caption_size);
......@@ -1650,7 +1650,7 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
}
if (s1->has_stereo3d) {
AVStereo3D *stereo = av_stereo3d_create_side_data(&s->current_picture_ptr->f);
AVStereo3D *stereo = av_stereo3d_create_side_data(s->current_picture_ptr->f);
if (!stereo)
return AVERROR(ENOMEM);
......@@ -1675,10 +1675,10 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
}
for (i = 0; i < 4; i++) {
s->current_picture.f.data[i] = s->current_picture_ptr->f.data[i];
s->current_picture.f->data[i] = s->current_picture_ptr->f->data[i];
if (s->picture_structure == PICT_BOTTOM_FIELD)
s->current_picture.f.data[i] +=
s->current_picture_ptr->f.linesize[i];
s->current_picture.f->data[i] +=
s->current_picture_ptr->f->linesize[i];
}
}
......@@ -2028,7 +2028,7 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict)
ff_MPV_frame_end(s);
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
int ret = av_frame_ref(pict, &s->current_picture_ptr->f);
int ret = av_frame_ref(pict, s->current_picture_ptr->f);
if (ret < 0)
return ret;
ff_print_debug_info(s, s->current_picture_ptr, pict);
......@@ -2039,7 +2039,7 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict)
/* latency of 1 frame for I- and P-frames */
/* XXX: use another variable than picture_number */
if (s->last_picture_ptr != NULL) {
int ret = av_frame_ref(pict, &s->last_picture_ptr->f);
int ret = av_frame_ref(pict, s->last_picture_ptr->f);
if (ret < 0)
return ret;
ff_print_debug_info(s, s->last_picture_ptr, pict);
......@@ -2682,7 +2682,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx, void *data,
if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE)) {
/* special case for last picture */
if (s2->low_delay == 0 && s2->next_picture_ptr) {
int ret = av_frame_ref(picture, &s2->next_picture_ptr->f);
int ret = av_frame_ref(picture, s2->next_picture_ptr->f);
if (ret < 0)
return ret;
......
......@@ -246,7 +246,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
if (aspect_ratio == 0.0)
aspect_ratio = 1.0; // pixel aspect 1.1 (VGA)
if (s->current_picture.f.key_frame) {
if (s->current_picture.f->key_frame) {
AVRational framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index];
/* mpeg1 header repeated every gop */
......@@ -336,10 +336,10 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
/* time code: we must convert from the real frame rate to a
* fake MPEG frame rate in case of low frame rate */
fps = (framerate.num + framerate.den / 2) / framerate.den;
time_code = s->current_picture_ptr->f.coded_picture_number +
time_code = s->current_picture_ptr->f->coded_picture_number +
s->avctx->timecode_frame_start;
s->gop_picture_number = s->current_picture_ptr->f.coded_picture_number;
s->gop_picture_number = s->current_picture_ptr->f->coded_picture_number;
av_assert0(s->drop_frame_timecode == !!(s->tc.flags & AV_TIMECODE_FLAG_DROPFRAME));
if (s->drop_frame_timecode)
......@@ -451,7 +451,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
if (s->progressive_sequence)
put_bits(&s->pb, 1, 0); /* no repeat */
else
put_bits(&s->pb, 1, s->current_picture_ptr->f.top_field_first);
put_bits(&s->pb, 1, s->current_picture_ptr->f->top_field_first);
/* XXX: optimize the generation of this flag with entropy measures */
s->frame_pred_frame_dct = s->progressive_sequence;
......@@ -475,7 +475,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
for (i = 0; i < sizeof(svcd_scan_offset_placeholder); i++)
put_bits(&s->pb, 8, svcd_scan_offset_placeholder[i]);
}
side_data = av_frame_get_side_data(&s->current_picture_ptr->f,
side_data = av_frame_get_side_data(s->current_picture_ptr->f,
AV_FRAME_DATA_STEREO3D);
if (side_data) {
AVStereo3D *stereo = (AVStereo3D *)side_data->data;
......
......@@ -671,7 +671,7 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64],
y = s->mb_y * 16;
offset = x + y * s->linesize;
p_pic = s->new_picture.f.data[0] + offset;
p_pic = s->new_picture.f->data[0] + offset;
s->mb_skipped = 1;
for (i = 0; i < s->max_b_frames; i++) {
......@@ -679,10 +679,10 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64],
int diff;
Picture *pic = s->reordered_input_picture[i + 1];
if (!pic || pic->f.pict_type != AV_PICTURE_TYPE_B)
if (!pic || pic->f->pict_type != AV_PICTURE_TYPE_B)
break;
b_pic = pic->f.data[0] + offset;
b_pic = pic->f->data[0] + offset;
if (!pic->shared)
b_pic += INPLACE_OFFSET;
......@@ -916,9 +916,9 @@ static void mpeg4_encode_gop_header(MpegEncContext *s)
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, GOP_STARTCODE);
time = s->current_picture_ptr->f.pts;
time = s->current_picture_ptr->f->pts;
if (s->reordered_input_picture[1])
time = FFMIN(time, s->reordered_input_picture[1]->f.pts);
time = FFMIN(time, s->reordered_input_picture[1]->f->pts);
time = time * s->avctx->time_base.num;
s->last_time_base = FFUDIV(time, s->avctx->time_base.den);
......@@ -1126,7 +1126,7 @@ void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number)
}
put_bits(&s->pb, 3, 0); /* intra dc VLC threshold */
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->top_field_first);
put_bits(&s->pb, 1, s->alternate_scan);
}
// FIXME sprite stuff
......
This diff is collapsed.
......@@ -92,7 +92,7 @@ struct MpegEncContext;
* Picture.
*/
typedef struct Picture{
struct AVFrame f;
struct AVFrame *f;
uint8_t avframe_padding[1024]; // hack to allow linking to a avutil with larger AVFrame
ThreadFrame tf;
......
This diff is collapsed.
......@@ -253,8 +253,8 @@ void mpeg_motion_internal(MpegEncContext *s,
#endif
v_edge_pos = s->v_edge_pos >> field_based;
linesize = s->current_picture.f.linesize[0] << field_based;
uvlinesize = s->current_picture.f.linesize[1] << field_based;
linesize = s->current_picture.f->linesize[0] << field_based;
uvlinesize = s->current_picture.f->linesize[1] << field_based;
dxy = ((motion_y & 1) << 1) | (motion_x & 1);
src_x = s->mb_x * 16 + (motion_x >> 1);
......@@ -899,7 +899,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
} else {
if ( s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field
|| !ref_picture[0]) {
ref_picture = s->current_picture_ptr->f.data;
ref_picture = s->current_picture_ptr->f->data;
}
mpeg_motion(s, dest_y, dest_cb, dest_cr,
......@@ -916,7 +916,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
|| s->pict_type == AV_PICTURE_TYPE_B || s->first_field) && ref_picture[0]) {
ref2picture = ref_picture;
} else {
ref2picture = s->current_picture_ptr->f.data;
ref2picture = s->current_picture_ptr->f->data;
}
mpeg_motion(s, dest_y, dest_cb, dest_cr,
......@@ -943,7 +943,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
}
} else {
if (!ref_picture[0]) {
ref_picture = s->current_picture_ptr->f.data;
ref_picture = s->current_picture_ptr->f->data;
}
for (i = 0; i < 2; i++) {
mpeg_motion(s, dest_y, dest_cb, dest_cr,
......@@ -958,7 +958,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
/* opposite parity is always in the same frame if this is
* second field */
if (!s->first_field) {
ref_picture = s->current_picture_ptr->f.data;
ref_picture = s->current_picture_ptr->f->data;
}
}
}
......
......@@ -42,7 +42,7 @@
*/
void ff_xvmc_init_block(MpegEncContext *s)
{
struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.f.data[2];
struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.f->data[2];
assert(render && render->xvmc_id == AV_XVMC_ID);
s->block = (int16_t (*)[64])(render->data_blocks + render->next_free_data_block_num * 64);
......@@ -87,7 +87,7 @@ void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp)
static int ff_xvmc_field_start(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
{
struct MpegEncContext *s = avctx->priv_data;
struct xvmc_pix_fmt *last, *next, *render = (struct xvmc_pix_fmt*)s->current_picture.f.data[2];
struct xvmc_pix_fmt *last, *next, *render = (struct xvmc_pix_fmt*)s->current_picture.f->data[2];
const int mb_block_count = 4 + (1 << s->chroma_format);
assert(avctx);
......@@ -127,7 +127,7 @@ static int ff_xvmc_field_start(AVCodecContext *avctx, const uint8_t *buf, uint32
case AV_PICTURE_TYPE_I:
return 0; // no prediction from other frames
case AV_PICTURE_TYPE_B:
next = (struct xvmc_pix_fmt*)s->next_picture.f.data[2];
next = (struct xvmc_pix_fmt*)s->next_picture.f->data[2];
if (!next)
return -1;
if (next->xvmc_id != AV_XVMC_ID)
......@@ -135,7 +135,7 @@ static int ff_xvmc_field_start(AVCodecContext *avctx, const uint8_t *buf, uint32
render->p_future_surface = next->p_surface;
// no return here, going to set forward prediction
case AV_PICTURE_TYPE_P:
last = (struct xvmc_pix_fmt*)s->last_picture.f.data[2];
last = (struct xvmc_pix_fmt*)s->last_picture.f->data[2];
if (!last)
last = render; // predict second field from the first
if (last->xvmc_id != AV_XVMC_ID)
......@@ -156,7 +156,7 @@ return -1;
static int ff_xvmc_field_end(AVCodecContext *avctx)
{
struct MpegEncContext *s = avctx->priv_data;
struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.f.data[2];
struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.f->data[2];
assert(render);
if (render->filled_mv_blocks_num > 0)
......@@ -198,7 +198,7 @@ static void ff_xvmc_decode_mb(struct MpegEncContext *s)
s->current_picture.qscale_table[mb_xy] = s->qscale;
// start of XVMC-specific code
render = (struct xvmc_pix_fmt*)s->current_picture.f.data[2];
render = (struct xvmc_pix_fmt*)s->current_picture.f->data[2];
assert(render);
assert(render->xvmc_id == AV_XVMC_ID);
assert(render->mv_blocks);
......
......@@ -276,10 +276,10 @@ int ff_msmpeg4_pred_dc(MpegEncContext *s, int n,
int bs = 8 >> s->avctx->lowres;
if(n<4){
wrap= s->linesize;
dest= s->current_picture.f.data[0] + (((n >> 1) + 2*s->mb_y) * bs* wrap ) + ((n & 1) + 2*s->mb_x) * bs;
dest= s->current_picture.f->data[0] + (((n >> 1) + 2*s->mb_y) * bs* wrap ) + ((n & 1) + 2*s->mb_x) * bs;
}else{
wrap= s->uvlinesize;
dest= s->current_picture.f.data[n - 3] + (s->mb_y * bs * wrap) + s->mb_x * bs;
dest= s->current_picture.f->data[n - 3] + (s->mb_y * bs * wrap) + s->mb_x * bs;
}
if(s->mb_x==0) a= (1024 + (scale>>1))/scale;
else a= get_dc(dest-bs, wrap, scale*8>>(2*s->avctx->lowres), bs);
......
......@@ -417,7 +417,7 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size,
ff_MPV_frame_end(s);
f = &s->current_picture.f;
f = s->current_picture.f;
if (v->respic == 3) {
ctx->dsp.upsample_plane(f->data[0], f->linesize[0], w, h);
......
......@@ -875,7 +875,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
avctx->get_buffer2 == avcodec_default_get_buffer2);
FF_ENABLE_DEPRECATION_WARNINGS
if (!f->f->buf[0])
if (!f->f || !f->f->buf[0])
return;
if (avctx->debug & FF_DEBUG_BUFFERS)
......
......@@ -48,10 +48,10 @@ void ff_write_pass1_stats(MpegEncContext *s)
snprintf(s->avctx->stats_out, 256,
"in:%d out:%d type:%d q:%d itex:%d ptex:%d mv:%d misc:%d "
"fcode:%d bcode:%d mc-var:%"PRId64" var:%"PRId64" icount:%d skipcount:%d hbits:%d;\n",
s->current_picture_ptr->f.display_picture_number,
s->current_picture_ptr->f.coded_picture_number,
s->current_picture_ptr->f->display_picture_number,
s->current_picture_ptr->f->coded_picture_number,
s->pict_type,
s->current_picture.f.quality,
s->current_picture.f->quality,
s->i_tex_bits,
s->p_tex_bits,
s->mv_bits,
......@@ -800,10 +800,10 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
else
dts_pic = s->last_picture_ptr;
if (!dts_pic || dts_pic->f.pts == AV_NOPTS_VALUE)
if (!dts_pic || dts_pic->f->pts == AV_NOPTS_VALUE)
wanted_bits = (uint64_t)(s->bit_rate * (double)picture_number / fps);
else
wanted_bits = (uint64_t)(s->bit_rate * (double)dts_pic->f.pts / fps);
wanted_bits = (uint64_t)(s->bit_rate * (double)dts_pic->f->pts / fps);
}
diff = s->total_bits - wanted_bits;
......
......@@ -585,7 +585,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf,
return ret;
ff_mpeg_er_frame_start(s);
} else {
if (s->current_picture_ptr->f.pict_type != s->pict_type) {
if (s->current_picture_ptr->f->pict_type != s->pict_type) {
av_log(s->avctx, AV_LOG_ERROR, "Slice type mismatch\n");
return AVERROR_INVALIDDATA;
}
......@@ -762,12 +762,12 @@ static int rv10_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
ff_MPV_frame_end(s);
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0)
if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0)
return ret;
ff_print_debug_info(s, s->current_picture_ptr, pict);
ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1);
} else if (s->last_picture_ptr != NULL) {
if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0)
if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0)
return ret;
ff_print_debug_info(s, s->last_picture_ptr, pict);
ff_mpv_export_qp_table(s, pict,s->last_picture_ptr, FF_QSCALE_TYPE_MPEG1);
......
......@@ -171,7 +171,7 @@ static void rv30_loop_filter(RV34DecContext *r, int row)
if(mb_x)
left_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos - 1]];
for(j = 0; j < 16; j += 4){
Y = s->current_picture_ptr->f.data[0] + mb_x*16 + (row*16 + j) * s->linesize + 4 * !mb_x;
Y = s->current_picture_ptr->f->data[0] + mb_x*16 + (row*16 + j) * s->linesize + 4 * !mb_x;
for(i = !mb_x; i < 4; i++, Y += 4){
int ij = i + j;
loc_lim = 0;
......@@ -191,7 +191,7 @@ static void rv30_loop_filter(RV34DecContext *r, int row)
if(mb_x)
left_cbp = (r->cbp_chroma[mb_pos - 1] >> (k*4)) & 0xF;
for(j = 0; j < 8; j += 4){
C = s->current_picture_ptr->f.data[k + 1] + mb_x*8 + (row*8 + j) * s->uvlinesize + 4 * !mb_x;
C = s->current_picture_ptr->f->data[k + 1] + mb_x*8 + (row*8 + j) * s->uvlinesize + 4 * !mb_x;
for(i = !mb_x; i < 2; i++, C += 4){
int ij = i + (j >> 1);
loc_lim = 0;
......@@ -213,7 +213,7 @@ static void rv30_loop_filter(RV34DecContext *r, int row)
if(row)
top_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos - s->mb_stride]];
for(j = 4*!row; j < 16; j += 4){
Y = s->current_picture_ptr->f.data[0] + mb_x*16 + (row*16 + j) * s->linesize;
Y = s->current_picture_ptr->f->data[0] + mb_x*16 + (row*16 + j) * s->linesize;
for(i = 0; i < 4; i++, Y += 4){
int ij = i + j;
loc_lim = 0;
......@@ -233,7 +233,7 @@ static void rv30_loop_filter(RV34DecContext *r, int row)
if(row)
top_cbp = (r->cbp_chroma[mb_pos - s->mb_stride] >> (k*4)) & 0xF;
for(j = 4*!row; j < 8; j += 4){
C = s->current_picture_ptr->f.data[k+1] + mb_x*8 + (row*8 + j) * s->uvlinesize;
C = s->current_picture_ptr->f->data[k+1] + mb_x*8 + (row*8 + j) * s->uvlinesize;
for(i = 0; i < 2; i++, C += 4){
int ij = i + (j >> 1);
loc_lim = 0;
......
......@@ -709,9 +709,9 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type,
}
dxy = ly*4 + lx;
srcY = dir ? s->next_picture_ptr->f.data[0] : s->last_picture_ptr->f.data[0];
srcU = dir ? s->next_picture_ptr->f.data[1] : s->last_picture_ptr->f.data[1];
srcV = dir ? s->next_picture_ptr->f.data[2] : s->last_picture_ptr->f.data[2];
srcY = dir ? s->next_picture_ptr->f->data[0] : s->last_picture_ptr->f->data[0];
srcU = dir ? s->next_picture_ptr->f->data[1] : s->last_picture_ptr->f->data[1];
srcV = dir ? s->next_picture_ptr->f->data[2] : s->last_picture_ptr->f->data[2];
src_x = s->mb_x * 16 + xoff + mx;
src_y = s->mb_y * 16 + yoff + my;
uvsrc_x = s->mb_x * 8 + (xoff >> 1) + umx;
......@@ -1591,13 +1591,13 @@ static int finish_frame(AVCodecContext *avctx, AVFrame *pict)
ff_thread_report_progress(&s->current_picture_ptr->tf, INT_MAX, 0);
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0)
if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0)
return ret;
ff_print_debug_info(s, s->current_picture_ptr, pict);
ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1);
got_picture = 1;
} else if (s->last_picture_ptr != NULL) {
if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0)
if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0)
return ret;
ff_print_debug_info(s, s->last_picture_ptr, pict);
ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_QSCALE_TYPE_MPEG1);
......@@ -1636,7 +1636,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
if (buf_size == 0) {
/* special case for last picture */
if (s->low_delay==0 && s->next_picture_ptr) {
if ((ret = av_frame_ref(pict, &s->next_picture_ptr->f)) < 0)
if ((ret = av_frame_ref(pict, s->next_picture_ptr->f)) < 0)
return ret;
s->next_picture_ptr = NULL;
......@@ -1664,7 +1664,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
av_log(avctx, AV_LOG_ERROR, "First slice header is incorrect\n");
return AVERROR_INVALIDDATA;
}
if ((!s->last_picture_ptr || !s->last_picture_ptr->f.data[0]) &&
if ((!s->last_picture_ptr || !s->last_picture_ptr->f->data[0]) &&
si.type == AV_PICTURE_TYPE_B) {
av_log(avctx, AV_LOG_ERROR, "Invalid decoder state: B-frame without "
"reference data.\n");
......
......@@ -456,7 +456,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
}
for(j = 0; j < 16; j += 4){
Y = s->current_picture_ptr->f.data[0] + mb_x*16 + (row*16 + j) * s->linesize;
Y = s->current_picture_ptr->f->data[0] + mb_x*16 + (row*16 + j) * s->linesize;
for(i = 0; i < 4; i++, Y += 4){
int ij = i + j;
int clip_cur = y_to_deblock & (MASK_CUR << ij) ? clip[POS_CUR] : 0;
......@@ -501,7 +501,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
}
for(k = 0; k < 2; k++){
for(j = 0; j < 2; j++){
C = s->current_picture_ptr->f.data[k + 1] + mb_x*8 + (row*8 + j*4) * s->uvlinesize;
C = s->current_picture_ptr->f->data[k + 1] + mb_x*8 + (row*8 + j*4) * s->uvlinesize;
for(i = 0; i < 2; i++, C += 4){
int ij = i + j*2;
int clip_cur = c_to_deblock[k] & (MASK_CUR << ij) ? clip[POS_CUR] : 0;
......
......@@ -1605,8 +1605,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
avctx->coded_frame= s->current_picture;
s->m.current_picture_ptr= &s->m.current_picture;
s->m.last_picture.f.pts = s->m.current_picture.f.pts;
s->m.current_picture.f.pts = pict->pts;
s->m.current_picture.f = s->current_picture;
s->m.current_picture.f->pts = pict->pts;
if(pic->pict_type == AV_PICTURE_TYPE_P){
int block_width = (width +15)>>4;
int block_height= (height+15)>>4;
......@@ -1616,14 +1616,16 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
av_assert0(s->last_picture[0]->data[0]);
s->m.avctx= s->avctx;
s->m.current_picture.f.data[0] = s->current_picture->data[0];
s->m. last_picture.f.data[0] = s->last_picture[0]->data[0];
s->m. new_picture.f.data[0] = s-> input_picture->data[0];
s->m. last_picture.f = s->last_picture[0];
s->m. new_picture.f = s->input_picture;
s->m.current_picture.f->data[0] = s->current_picture->data[0];
s->m. last_picture.f->data[0] = s->last_picture[0]->data[0];
s->m. new_picture.f->data[0] = s-> input_picture->data[0];
s->m. last_picture_ptr= &s->m. last_picture;
s->m.linesize=
s->m. last_picture.f.linesize[0] =
s->m. new_picture.f.linesize[0] =
s->m.current_picture.f.linesize[0] = stride;
s->m. last_picture.f->linesize[0] =
s->m. new_picture.f->linesize[0] =
s->m.current_picture.f->linesize[0] = stride;
s->m.uvlinesize= s->current_picture->linesize[1];
s->m.width = width;
s->m.height= height;
......@@ -1815,9 +1817,9 @@ redo_frame:
s->current_picture->quality = pict->quality;
s->m.frame_bits = 8*(s->c.bytestream - s->c.bytestream_start);
s->m.p_tex_bits = s->m.frame_bits - s->m.misc_bits - s->m.mv_bits;
s->m.current_picture.f.display_picture_number =
s->m.current_picture.f.coded_picture_number = avctx->frame_number;
s->m.current_picture.f.quality = pic->quality;
s->m.current_picture.f->display_picture_number =
s->m.current_picture.f->coded_picture_number = avctx->frame_number;
s->m.current_picture.f->quality = pic->quality;
s->m.total_bits += 8*(s->c.bytestream - s->c.bytestream_start);
if(s->pass1_rc)
if (ff_rate_estimate_qscale(&s->m, 0) < 0)
......
......@@ -295,11 +295,11 @@ static int svq1_encode_plane(SVQ1Context *s, int plane,
s->m.avctx = s->avctx;
s->m.current_picture_ptr = &s->m.current_picture;
s->m.last_picture_ptr = &s->m.last_picture;
s->m.last_picture.f.data[0] = ref_plane;
s->m.last_picture.f->data[0] = ref_plane;
s->m.linesize =
s->m.last_picture.f.linesize[0] =
s->m.new_picture.f.linesize[0] =
s->m.current_picture.f.linesize[0] = stride;
s->m.last_picture.f->linesize[0] =
s->m.new_picture.f->linesize[0] =
s->m.current_picture.f->linesize[0] = stride;
s->m.width = width;
s->m.height = height;
s->m.mb_width = block_width;
......@@ -347,7 +347,7 @@ static int svq1_encode_plane(SVQ1Context *s, int plane,
s->m.me.dia_size = s->avctx->dia_size;
s->m.first_slice_line = 1;
for (y = 0; y < block_height; y++) {
s->m.new_picture.f.data[0] = src - y * 16 * stride; // ugly
s->m.new_picture.f->data[0] = src - y * 16 * stride; // ugly
s->m.mb_y = y;
for (i = 0; i < 16 && i + 16 * y < height; i++) {
......@@ -515,6 +515,9 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx)
s->rd_total / (double)(avctx->width * avctx->height *
avctx->frame_number));
s->m.mb_type = NULL;
ff_MPV_common_end(&s->m);
av_freep(&s->m.me.scratchpad);
av_freep(&s->m.me.map);
av_freep(&s->m.me.score_map);
......@@ -537,6 +540,7 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx)
static av_cold int svq1_encode_init(AVCodecContext *avctx)
{
SVQ1Context *const s = avctx->priv_data;
int ret;
ff_dsputil_init(&s->dsp, avctx);
ff_hpeldsp_init(&s->hdsp, avctx->flags);
......@@ -560,6 +564,12 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx)
s->avctx = avctx;
s->m.avctx = avctx;
if ((ret = ff_MPV_common_init(&s->m)) < 0) {
svq1_encode_end(avctx);
return ret;
}
s->m.picture_structure = PICT_FRAME;
s->m.me.temp =
s->m.me.scratchpad = av_mallocz((avctx->width + 64) *
......
......@@ -3436,7 +3436,8 @@ int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
void ff_thread_release_buffer(AVCodecContext *avctx, ThreadFrame *f)
{
av_frame_unref(f->f);
if (f->f)
av_frame_unref(f->f);
}
void ff_thread_finish_setup(AVCodecContext *avctx)
......
......@@ -35,7 +35,7 @@ int ff_vaapi_mpeg_end_frame(AVCodecContext *avctx)
goto finish;
ret = ff_vaapi_render_picture(vactx,
ff_vaapi_get_surface_id(&s->current_picture_ptr->f));
ff_vaapi_get_surface_id(s->current_picture_ptr->f));
if (ret < 0)
goto finish;
......
......@@ -73,10 +73,10 @@ static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_
switch (s->pict_type) {
case AV_PICTURE_TYPE_B:
pic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture.f);
pic_param->backward_reference_picture = ff_vaapi_get_surface_id(s->next_picture.f);
// fall-through
case AV_PICTURE_TYPE_P:
pic_param->forward_reference_picture = ff_vaapi_get_surface_id(&s->last_picture.f);
pic_param->forward_reference_picture = ff_vaapi_get_surface_id(s->last_picture.f);
break;
}
......
......@@ -81,7 +81,7 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_
pic_param->quant_precision = s->quant_precision;
pic_param->vop_fields.value = 0; /* reset all bits */
pic_param->vop_fields.bits.vop_coding_type = s->pict_type - AV_PICTURE_TYPE_I;
pic_param->vop_fields.bits.backward_reference_vop_coding_type = s->pict_type == AV_PICTURE_TYPE_B ? s->next_picture.f.pict_type - AV_PICTURE_TYPE_I : 0;
pic_param->vop_fields.bits.backward_reference_vop_coding_type = s->pict_type == AV_PICTURE_TYPE_B ? s->next_picture.f->pict_type - AV_PICTURE_TYPE_I : 0;
pic_param->vop_fields.bits.vop_rounding_type = s->no_rounding;
pic_param->vop_fields.bits.intra_dc_vlc_thr = mpeg4_get_intra_dc_vlc_thr(ctx);
pic_param->vop_fields.bits.top_field_first = s->top_field_first;
......@@ -95,9 +95,9 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_
pic_param->TRD = s->pp_time;
if (s->pict_type == AV_PICTURE_TYPE_B)
pic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture.f);
pic_param->backward_reference_picture = ff_vaapi_get_surface_id(s->next_picture.f);
if (s->pict_type != AV_PICTURE_TYPE_I)
pic_param->forward_reference_picture = ff_vaapi_get_surface_id(&s->last_picture.f);
pic_param->forward_reference_picture = ff_vaapi_get_surface_id(s->last_picture.f);
/* Fill in VAIQMatrixBufferMPEG4 */
/* Only the first inverse quantisation method uses the weighting matrices */
......
......@@ -258,10 +258,10 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t
switch (s->pict_type) {
case AV_PICTURE_TYPE_B:
pic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture.f);
pic_param->backward_reference_picture = ff_vaapi_get_surface_id(s->next_picture.f);
// fall-through
case AV_PICTURE_TYPE_P:
pic_param->forward_reference_picture = ff_vaapi_get_surface_id(&s->last_picture.f);
pic_param->forward_reference_picture = ff_vaapi_get_surface_id(s->last_picture.f);
break;
}
......
......@@ -859,7 +859,7 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
v->s.pict_type = (v->fptype & 1) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
if (v->fptype & 4)
v->s.pict_type = (v->fptype & 1) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B;
v->s.current_picture_ptr->f.pict_type = v->s.pict_type;
v->s.current_picture_ptr->f->pict_type = v->s.pict_type;
if (!v->pic_header_flag)
goto parse_common_info;
}
......
This diff is collapsed.
......@@ -65,7 +65,7 @@ int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx)
MpegEncContext *s = avctx->priv_data;
Picture *pic = s->current_picture_ptr;
struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
VdpVideoSurface surf = ff_vdpau_get_surface_id(&pic->f);
VdpVideoSurface surf = ff_vdpau_get_surface_id(pic->f);
#if FF_API_BUFS_VDPAU
FF_DISABLE_DEPRECATION_WARNINGS
......@@ -77,7 +77,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (!hwctx->render) {
res = hwctx->render2(avctx, &pic->f, (void *)&pic_ctx->info,
res = hwctx->render2(avctx, pic->f, (void *)&pic_ctx->info,
pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers);
} else
hwctx->render(hwctx->decoder, surf, (void *)&pic_ctx->info,
......@@ -276,7 +276,7 @@ void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf,
if (!s->current_picture_ptr) return;
render = (struct vdpau_render_state *)s->current_picture_ptr->f.data[0];
render = (struct vdpau_render_state *)s->current_picture_ptr->f->data[0];
assert(render);
/* fill VdpPictureInfoMPEG1Or2 struct */
......@@ -305,18 +305,18 @@ void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf,
switch(s->pict_type){
case AV_PICTURE_TYPE_B:
next = (struct vdpau_render_state *)s->next_picture.f.data[0];
next = (struct vdpau_render_state *)s->next_picture.f->data[0];
assert(next);
render->info.mpeg.backward_reference = next->surface;
// no return here, going to set forward prediction
case AV_PICTURE_TYPE_P:
last = (struct vdpau_render_state *)s->last_picture.f.data[0];
last = (struct vdpau_render_state *)s->last_picture.f->data[0];
if (!last) // FIXME: Does this test make sense?
last = render; // predict second field from the first
render->info.mpeg.forward_reference = last->surface;
}
ff_vdpau_add_data_chunk(s->current_picture_ptr->f.data[0], buf, buf_size);
ff_vdpau_add_data_chunk(s->current_picture_ptr->f->data[0], buf, buf_size);
render->info.mpeg.slice_count = slice_count;
......@@ -333,7 +333,7 @@ void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf,
VC1Context *v = s->avctx->priv_data;
struct vdpau_render_state *render, *last, *next;
render = (struct vdpau_render_state *)s->current_picture.f.data[0];
render = (struct vdpau_render_state *)s->current_picture.f->data[0];
assert(render);
/* fill LvPictureInfoVC1 struct */
......@@ -377,18 +377,18 @@ void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf,
switch(s->pict_type){
case AV_PICTURE_TYPE_B:
next = (struct vdpau_render_state *)s->next_picture.f.data[0];
next = (struct vdpau_render_state *)s->next_picture.f->data[0];
assert(next);
render->info.vc1.backward_reference = next->surface;
// no break here, going to set forward prediction
case AV_PICTURE_TYPE_P:
last = (struct vdpau_render_state *)s->last_picture.f.data[0];
last = (struct vdpau_render_state *)s->last_picture.f->data[0];
if (!last) // FIXME: Does this test make sense?
last = render; // predict second field from the first
render->info.vc1.forward_reference = last->surface;
}
ff_vdpau_add_data_chunk(s->current_picture_ptr->f.data[0], buf, buf_size);
ff_vdpau_add_data_chunk(s->current_picture_ptr->f->data[0], buf, buf_size);
render->info.vc1.slice_count = 1;
......@@ -407,7 +407,7 @@ void ff_vdpau_mpeg4_decode_picture(Mpeg4DecContext *ctx, const uint8_t *buf,
if (!s->current_picture_ptr) return;
render = (struct vdpau_render_state *)s->current_picture_ptr->f.data[0];
render = (struct vdpau_render_state *)s->current_picture_ptr->f->data[0];
assert(render);
/* fill VdpPictureInfoMPEG4Part2 struct */
......@@ -436,18 +436,18 @@ void ff_vdpau_mpeg4_decode_picture(Mpeg4DecContext *ctx, const uint8_t *buf,
switch (s->pict_type) {
case AV_PICTURE_TYPE_B:
next = (struct vdpau_render_state *)s->next_picture.f.data[0];
next = (struct vdpau_render_state *)s->next_picture.f->data[0];
assert(next);
render->info.mpeg4.backward_reference = next->surface;
render->info.mpeg4.vop_coding_type = 2;
// no break here, going to set forward prediction
case AV_PICTURE_TYPE_P:
last = (struct vdpau_render_state *)s->last_picture.f.data[0];
last = (struct vdpau_render_state *)s->last_picture.f->data[0];
assert(last);
render->info.mpeg4.forward_reference = last->surface;
}
ff_vdpau_add_data_chunk(s->current_picture_ptr->f.data[0], buf, buf_size);
ff_vdpau_add_data_chunk(s->current_picture_ptr->f->data[0], buf, buf_size);
ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);
render->bitstream_buffers_used = 0;
......
......@@ -43,12 +43,12 @@ static int vdpau_mpeg_start_frame(AVCodecContext *avctx,
switch (s->pict_type) {
case AV_PICTURE_TYPE_B:
ref = ff_vdpau_get_surface_id(&s->next_picture.f);
ref = ff_vdpau_get_surface_id(s->next_picture.f);
assert(ref != VDP_INVALID_HANDLE);
info->backward_reference = ref;
/* fall through to forward prediction */
case AV_PICTURE_TYPE_P:
ref = ff_vdpau_get_surface_id(&s->last_picture.f);
ref = ff_vdpau_get_surface_id(s->last_picture.f);
info->forward_reference = ref;
}
......
......@@ -46,13 +46,13 @@ static int vdpau_mpeg4_start_frame(AVCodecContext *avctx,
switch (s->pict_type) {
case AV_PICTURE_TYPE_B:
ref = ff_vdpau_get_surface_id(&s->next_picture.f);
ref = ff_vdpau_get_surface_id(s->next_picture.f);
assert(ref != VDP_INVALID_HANDLE);
info->backward_reference = ref;
info->vop_coding_type = 2;
/* fall-through */
case AV_PICTURE_TYPE_P:
ref = ff_vdpau_get_surface_id(&s->last_picture.f);
ref = ff_vdpau_get_surface_id(s->last_picture.f);
assert(ref != VDP_INVALID_HANDLE);
info->forward_reference = ref;
}
......
......@@ -45,14 +45,14 @@ static int vdpau_vc1_start_frame(AVCodecContext *avctx,
switch (s->pict_type) {
case AV_PICTURE_TYPE_B:
if (s->next_picture_ptr) {
ref = ff_vdpau_get_surface_id(&s->next_picture.f);
ref = ff_vdpau_get_surface_id(s->next_picture.f);
assert(ref != VDP_INVALID_HANDLE);
info->backward_reference = ref;
}
/* fall-through */
case AV_PICTURE_TYPE_P:
if (s->last_picture_ptr) {
ref = ff_vdpau_get_surface_id(&s->last_picture.f);
ref = ff_vdpau_get_surface_id(s->last_picture.f);
assert(ref != VDP_INVALID_HANDLE);
info->forward_reference = ref;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment