summaryrefslogtreecommitdiff
path: root/libavcodec/ljpegenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-12-06 03:19:37 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-12-06 03:29:33 +0100
commitf1db3f5f593138a9704dc3e4e91871e59289c843 (patch)
tree4a80d37095b9908be0a7fc9faa44cc0f7a958e4c /libavcodec/ljpegenc.c
parent08667c26780dcdf2ef9ce410b2c78931a1e94e83 (diff)
parentc99307caee01441cfde24f3b7b0db3037b7022dc (diff)
Merge commit 'c99307caee01441cfde24f3b7b0db3037b7022dc'
* commit 'c99307caee01441cfde24f3b7b0db3037b7022dc': mpegvideo: make frame_size_alloc() static. Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ljpegenc.c')
-rw-r--r--libavcodec/ljpegenc.c12
1 files changed, 8 insertions, 4 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)