Merge commit 'a3f4c930ac3f49f47b6e6ffda925d0dcf80320e2'

* commit 'a3f4c930ac3f49f47b6e6ffda925d0dcf80320e2':
  mpegvideo: Have ff_mpeg_ref_picture use AVCodecContext directly

Conflicts:
	libavcodec/mpegvideo.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
pull/116/merge
Michael Niedermayer 10 years ago
commit 179527f34e
  1. 14
      libavcodec/mpegvideo.c
  2. 2
      libavcodec/mpegvideo.h
  3. 10
      libavcodec/mpegvideo_enc.c

@ -773,7 +773,7 @@ do {\
return 0; return 0;
} }
int ff_mpeg_ref_picture(MpegEncContext *s, Picture *dst, Picture *src) int ff_mpeg_ref_picture(AVCodecContext *avctx, Picture *dst, Picture *src)
{ {
int ret; int ret;
@ -807,7 +807,7 @@ int ff_mpeg_ref_picture(MpegEncContext *s, Picture *dst, Picture *src)
return 0; return 0;
fail: fail:
ff_mpeg_unref_picture(s->avctx, dst); ff_mpeg_unref_picture(avctx, dst);
return ret; return ret;
} }
@ -996,7 +996,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
for (i = 0; i < MAX_PICTURE_COUNT; i++) { for (i = 0; i < MAX_PICTURE_COUNT; i++) {
ff_mpeg_unref_picture(s->avctx, &s->picture[i]); ff_mpeg_unref_picture(s->avctx, &s->picture[i]);
if (s1->picture[i].f->buf[0] && if (s1->picture[i].f->buf[0] &&
(ret = ff_mpeg_ref_picture(s, &s->picture[i], &s1->picture[i])) < 0) (ret = ff_mpeg_ref_picture(s->avctx, &s->picture[i], &s1->picture[i])) < 0)
return ret; return ret;
} }
@ -1004,7 +1004,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
do {\ do {\
ff_mpeg_unref_picture(s->avctx, &s->pic);\ ff_mpeg_unref_picture(s->avctx, &s->pic);\
if (s1->pic.f && s1->pic.f->buf[0])\ if (s1->pic.f && s1->pic.f->buf[0])\
ret = ff_mpeg_ref_picture(s, &s->pic, &s1->pic);\ ret = ff_mpeg_ref_picture(s->avctx, &s->pic, &s1->pic);\
else\ else\
ret = update_picture_tables(&s->pic, &s1->pic);\ ret = update_picture_tables(&s->pic, &s1->pic);\
if (ret < 0)\ if (ret < 0)\
@ -1838,7 +1838,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
// s->current_picture_ptr->quality = s->new_picture_ptr->quality; // s->current_picture_ptr->quality = s->new_picture_ptr->quality;
s->current_picture_ptr->f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; s->current_picture_ptr->f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;
if ((ret = ff_mpeg_ref_picture(s, &s->current_picture, if ((ret = ff_mpeg_ref_picture(s->avctx, &s->current_picture,
s->current_picture_ptr)) < 0) s->current_picture_ptr)) < 0)
return ret; return ret;
@ -1938,14 +1938,14 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
if (s->last_picture_ptr) { if (s->last_picture_ptr) {
ff_mpeg_unref_picture(s->avctx, &s->last_picture); ff_mpeg_unref_picture(s->avctx, &s->last_picture);
if (s->last_picture_ptr->f->buf[0] && if (s->last_picture_ptr->f->buf[0] &&
(ret = ff_mpeg_ref_picture(s, &s->last_picture, (ret = ff_mpeg_ref_picture(s->avctx, &s->last_picture,
s->last_picture_ptr)) < 0) s->last_picture_ptr)) < 0)
return ret; return ret;
} }
if (s->next_picture_ptr) { if (s->next_picture_ptr) {
ff_mpeg_unref_picture(s->avctx, &s->next_picture); ff_mpeg_unref_picture(s->avctx, &s->next_picture);
if (s->next_picture_ptr->f->buf[0] && if (s->next_picture_ptr->f->buf[0] &&
(ret = ff_mpeg_ref_picture(s, &s->next_picture, (ret = ff_mpeg_ref_picture(s->avctx, &s->next_picture,
s->next_picture_ptr)) < 0) s->next_picture_ptr)) < 0)
return ret; return ret;
} }

@ -902,7 +902,7 @@ void ff_wmv2_encode_mb(MpegEncContext * s,
int16_t block[6][64], int16_t block[6][64],
int motion_x, int motion_y); int motion_x, int motion_y);
int ff_mpeg_ref_picture(MpegEncContext *s, Picture *dst, Picture *src); int ff_mpeg_ref_picture(AVCodecContext *avctx, Picture *dst, Picture *src);
void ff_mpeg_unref_picture(AVCodecContext *avctx, Picture *picture); void ff_mpeg_unref_picture(AVCodecContext *avctx, Picture *picture);
void ff_free_picture_tables(Picture *pic); void ff_free_picture_tables(Picture *pic);

@ -1520,7 +1520,7 @@ no_output_pic:
AV_PICTURE_TYPE_B ? 3 : 0; AV_PICTURE_TYPE_B ? 3 : 0;
ff_mpeg_unref_picture(s->avctx, &s->new_picture); ff_mpeg_unref_picture(s->avctx, &s->new_picture);
if ((ret = ff_mpeg_ref_picture(s, &s->new_picture, s->reordered_input_picture[0]))) if ((ret = ff_mpeg_ref_picture(s->avctx, &s->new_picture, s->reordered_input_picture[0])))
return ret; return ret;
if (s->reordered_input_picture[0]->shared || s->avctx->rc_buffer_size) { if (s->reordered_input_picture[0]->shared || s->avctx->rc_buffer_size) {
@ -1555,7 +1555,7 @@ no_output_pic:
} }
} }
ff_mpeg_unref_picture(s->avctx, &s->current_picture); ff_mpeg_unref_picture(s->avctx, &s->current_picture);
if ((ret = ff_mpeg_ref_picture(s, &s->current_picture, if ((ret = ff_mpeg_ref_picture(s->avctx, &s->current_picture,
s->current_picture_ptr)) < 0) s->current_picture_ptr)) < 0)
return ret; return ret;
@ -1642,7 +1642,7 @@ static int frame_start(MpegEncContext *s)
s->current_picture_ptr->f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; s->current_picture_ptr->f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;
ff_mpeg_unref_picture(s->avctx, &s->current_picture); ff_mpeg_unref_picture(s->avctx, &s->current_picture);
if ((ret = ff_mpeg_ref_picture(s, &s->current_picture, if ((ret = ff_mpeg_ref_picture(s->avctx, &s->current_picture,
s->current_picture_ptr)) < 0) s->current_picture_ptr)) < 0)
return ret; return ret;
@ -1655,14 +1655,14 @@ static int frame_start(MpegEncContext *s)
if (s->last_picture_ptr) { if (s->last_picture_ptr) {
ff_mpeg_unref_picture(s->avctx, &s->last_picture); ff_mpeg_unref_picture(s->avctx, &s->last_picture);
if (s->last_picture_ptr->f->buf[0] && if (s->last_picture_ptr->f->buf[0] &&
(ret = ff_mpeg_ref_picture(s, &s->last_picture, (ret = ff_mpeg_ref_picture(s->avctx, &s->last_picture,
s->last_picture_ptr)) < 0) s->last_picture_ptr)) < 0)
return ret; return ret;
} }
if (s->next_picture_ptr) { if (s->next_picture_ptr) {
ff_mpeg_unref_picture(s->avctx, &s->next_picture); ff_mpeg_unref_picture(s->avctx, &s->next_picture);
if (s->next_picture_ptr->f->buf[0] && if (s->next_picture_ptr->f->buf[0] &&
(ret = ff_mpeg_ref_picture(s, &s->next_picture, (ret = ff_mpeg_ref_picture(s->avctx, &s->next_picture,
s->next_picture_ptr)) < 0) s->next_picture_ptr)) < 0)
return ret; return ret;
} }

Loading…
Cancel
Save