summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo_enc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r--libavcodec/mpegvideo_enc.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index bacec726f6..470418ad35 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -716,6 +716,29 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
if (ARCH_X86)
ff_MPV_encode_init_x86(s);
+ s->avctx->coded_frame = &s->current_picture.f;
+
+ if (s->msmpeg4_version) {
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_stats,
+ 2 * 2 * (MAX_LEVEL + 1) *
+ (MAX_RUN + 1) * 2 * sizeof(int), fail);
+ }
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->avctx->stats_out, 256, fail);
+
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix, 64 * 32 * sizeof(int), fail);
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix, 64 * 32 * sizeof(int), fail);
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix16, 64 * 32 * 2 * sizeof(uint16_t), fail);
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix16, 64 * 32 * 2 * sizeof(uint16_t), fail);
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->input_picture,
+ MAX_PICTURE_COUNT * sizeof(Picture *), fail);
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->reordered_input_picture,
+ MAX_PICTURE_COUNT * sizeof(Picture *), fail);
+
+ if (s->avctx->noise_reduction) {
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->dct_offset,
+ 2 * 64 * sizeof(uint16_t), fail);
+ }
+
ff_h263dsp_init(&s->h263dsp);
if (!s->dct_quantize)
s->dct_quantize = ff_dct_quantize_c;
@@ -802,6 +825,9 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
}
return 0;
+fail:
+ ff_MPV_encode_end(avctx);
+ return AVERROR_UNKNOWN;
}
av_cold int ff_MPV_encode_end(AVCodecContext *avctx)