diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-12-06 03:19:37 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-12-06 03:29:33 +0100 |
commit | f1db3f5f593138a9704dc3e4e91871e59289c843 (patch) | |
tree | 4a80d37095b9908be0a7fc9faa44cc0f7a958e4c /libavcodec | |
parent | 08667c26780dcdf2ef9ce410b2c78931a1e94e83 (diff) | |
parent | c99307caee01441cfde24f3b7b0db3037b7022dc (diff) | |
download | ffmpeg-f1db3f5f593138a9704dc3e4e91871e59289c843.tar.gz |
Merge commit 'c99307caee01441cfde24f3b7b0db3037b7022dc'
* commit 'c99307caee01441cfde24f3b7b0db3037b7022dc':
mpegvideo: make frame_size_alloc() static.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/ljpegenc.c | 12 | ||||
-rw-r--r-- | libavcodec/mpegvideo.c | 8 | ||||
-rw-r--r-- | libavcodec/mpegvideo.h | 1 |
3 files changed, 12 insertions, 9 deletions
diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c index af126aab97..09aeaaa847 100644 --- a/libavcodec/ljpegenc.c +++ b/libavcodec/ljpegenc.c @@ -57,10 +57,14 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt, * s->mjpeg_hsample[0] * s->mjpeg_vsample[0]; } - if (!s->edge_emu_buffer && - (ret = ff_mpv_frame_size_alloc(s, pict->linesize[0])) < 0) { - av_log(avctx, AV_LOG_ERROR, "failed to allocate context scratch buffers.\n"); - return ret; + if (!s->rd_scratchpad) { + int alloc_size = FFALIGN(FFABS(pict->linesize[0]) + 64, 32); + s->me.scratchpad = + s->rd_scratchpad = av_mallocz(alloc_size * 4 * 16 * 2); + if (!s->rd_scratchpad) { + av_log(avctx, AV_LOG_ERROR, "failed to allocate context scratch buffers.\n"); + return ret; + } } if ((ret = ff_alloc_packet2(avctx, pkt, max_pkt_size)) < 0) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 97bb0dc392..22cb56a30d 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -196,7 +196,7 @@ av_cold int ff_dct_common_init(MpegEncContext *s) return 0; } -int ff_mpv_frame_size_alloc(MpegEncContext *s, int linesize) +static int frame_size_alloc(MpegEncContext *s, int linesize) { int alloc_size = FFALIGN(FFABS(linesize) + 64, 32); @@ -275,7 +275,7 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic) } if (!s->edge_emu_buffer && - (ret = ff_mpv_frame_size_alloc(s, pic->f.linesize[0])) < 0) { + (ret = frame_size_alloc(s, pic->f.linesize[0])) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed to allocate context scratch buffers.\n"); ff_mpeg_unref_picture(s, pic); @@ -655,7 +655,7 @@ int ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src) if (dst->avctx->codec_tag == AV_RL32("VCR2")) exchange_uv(dst); if (!dst->edge_emu_buffer && - (ret = ff_mpv_frame_size_alloc(dst, dst->linesize)) < 0) { + (ret = frame_size_alloc(dst, dst->linesize)) < 0) { av_log(dst->avctx, AV_LOG_ERROR, "failed to allocate context " "scratch buffers.\n"); return ret; @@ -774,7 +774,7 @@ do {\ // linesize dependend scratch buffer allocation if (!s->edge_emu_buffer) if (s1->linesize) { - if (ff_mpv_frame_size_alloc(s, s1->linesize) < 0) { + if (frame_size_alloc(s, s1->linesize) < 0) { av_log(s->avctx, AV_LOG_ERROR, "Failed to allocate context " "scratch buffers.\n"); return AVERROR(ENOMEM); diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 030ba837da..857b297a65 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -793,7 +793,6 @@ void ff_MPV_common_defaults(MpegEncContext *s); void ff_MPV_decode_defaults(MpegEncContext *s); int ff_MPV_common_init(MpegEncContext *s); -int ff_mpv_frame_size_alloc(MpegEncContext *s, int linesize); int ff_MPV_common_frame_size_change(MpegEncContext *s); void ff_MPV_common_end(MpegEncContext *s); void ff_MPV_decode_mb(MpegEncContext *s, int16_t block[12][64]); |