MpegEncContext *s = &r->s;
int ret;
- ff_MPV_decode_defaults(s);
- s->avctx = avctx;
+ ff_mpv_decode_defaults(s);
+ ff_mpv_decode_init(s, avctx);
s->out_format = FMT_H263;
- s->codec_id = avctx->codec_id;
- s->width = avctx->width;
- s->height = avctx->height;
-
- r->s.avctx = avctx;
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
avctx->has_b_frames = 1;
s->low_delay = 0;
- if ((ret = ff_MPV_common_init(s)) < 0)
+ ff_mpv_idct_init(s);
+ if ((ret = ff_mpv_common_init(s)) < 0)
return ret;
ff_h264_pred_init(&r->h, AV_CODEC_ID_RV40, 8, 1);
#endif
if ((ret = rv34_decoder_alloc(r)) < 0) {
- ff_MPV_common_end(&r->s);
+ ff_mpv_common_end(&r->s);
return ret;
}
if (avctx->internal->is_copy) {
r->tmp_b_block_base = NULL;
- if ((err = ff_MPV_common_init(&r->s)) < 0)
+ ff_mpv_idct_init(&r->s);
+ if ((err = ff_mpv_common_init(&r->s)) < 0)
return err;
if ((err = rv34_decoder_alloc(r)) < 0) {
- ff_MPV_common_end(&r->s);
+ ff_mpv_common_end(&r->s);
return err;
}
}
if (s->height != s1->height || s->width != s1->width) {
s->height = s1->height;
s->width = s1->width;
- if ((err = ff_MPV_common_frame_size_change(s)) < 0)
+ if ((err = ff_mpv_common_frame_size_change(s)) < 0)
return err;
if ((err = rv34_decoder_realloc(r)) < 0)
return err;
}
- if ((err = ff_mpeg_update_thread_context(dst, src)))
- return err;
-
r->cur_pts = r1->cur_pts;
r->last_pts = r1->last_pts;
r->next_pts = r1->next_pts;
memset(&r->si, 0, sizeof(r->si));
- return 0;
+ // Do no call ff_mpeg_update_thread_context on a partially initialized
+ // decoder context.
+ if (!s1->linesize)
+ return 0;
+
+ return ff_mpeg_update_thread_context(dst, src);
}
static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n)
int got_picture = 0, ret;
ff_er_frame_end(&s->er);
- ff_MPV_frame_end(s);
+ ff_mpv_frame_end(s);
s->mb_num_left = 0;
if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))
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) {
+ } else if (s->last_picture_ptr) {
if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0)
return ret;
ff_print_debug_info(s, s->last_picture_ptr, pict);
av_log(avctx, AV_LOG_ERROR, "New frame but still %d MB left.\n",
s->mb_num_left);
ff_er_frame_end(&s->er);
- ff_MPV_frame_end(s);
+ ff_mpv_frame_end(s);
}
if (s->width != si.width || s->height != si.height) {
if (err < 0)
return err;
- if ((err = ff_MPV_common_frame_size_change(s)) < 0)
+ if ((err = ff_mpv_common_frame_size_change(s)) < 0)
return err;
if ((err = rv34_decoder_realloc(r)) < 0)
return err;
}
s->pict_type = si.type ? si.type : AV_PICTURE_TYPE_I;
- if (ff_MPV_frame_start(s, s->avctx) < 0)
+ if (ff_mpv_frame_start(s, s->avctx) < 0)
return -1;
ff_mpeg_er_frame_start(s);
if (!r->tmp_b_block_base) {
/* always mark the current frame as finished, frame-mt supports
* only complete frames */
ff_er_frame_end(&s->er);
- ff_MPV_frame_end(s);
+ ff_mpv_frame_end(s);
s->mb_num_left = 0;
ff_thread_report_progress(&s->current_picture_ptr->tf, INT_MAX, 0);
return AVERROR_INVALIDDATA;
{
RV34DecContext *r = avctx->priv_data;
- ff_MPV_common_end(&r->s);
+ ff_mpv_common_end(&r->s);
rv34_decoder_free(r);
return 0;