]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ljpegenc.c
Merge commit 'c99307caee01441cfde24f3b7b0db3037b7022dc'
[ffmpeg] / libavcodec / ljpegenc.c
index af126aab97c1d1a687f2c3ec9617b3cd65868c11..09aeaaa847e2173557e72fd3add38ae368af3db0 100644 (file)
@@ -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)