]> git.sesse.net Git - ffmpeg/commitdiff
Merge commit 'c99307caee01441cfde24f3b7b0db3037b7022dc'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 6 Dec 2013 02:19:37 +0000 (03:19 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 6 Dec 2013 02:29:33 +0000 (03:29 +0100)
* commit 'c99307caee01441cfde24f3b7b0db3037b7022dc':
  mpegvideo: make frame_size_alloc() static.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/ljpegenc.c
libavcodec/mpegvideo.c
libavcodec/mpegvideo.h

index af126aab97c1d1a687f2c3ec9617b3cd65868c11,4b132399db14bad32477e1e9df9bbf431067b1a2..09aeaaa847e2173557e72fd3add38ae368af3db0
@@@ -56,16 -56,11 +56,20 @@@ static int encode_picture_lossless(AVCo
          max_pkt_size += mb_width * mb_height * 3 * 4
                          * s->mjpeg_hsample[0] * s->mjpeg_vsample[0];
      }
 -    if ((ret = ff_alloc_packet(pkt, max_pkt_size)) < 0) {
 -        av_log(avctx, AV_LOG_ERROR, "Error getting output packet of size %d.\n", max_pkt_size);
 -        return ret;
 +
-     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)
 +        return ret;
 +
      init_put_bits(&s->pb, pkt->data, pkt->size);
  
      av_frame_unref(p);
index 97bb0dc39289829e921e16bcb61f338bed881b3b,5648b82908d8971e5ff13df61a813941150e0a8b..22cb56a30d1c44846e230a8b070cc0a36458cb6b
@@@ -196,9 -191,9 +196,9 @@@ av_cold int ff_dct_common_init(MpegEncC
      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) + 32, 32);
 +    int alloc_size = FFALIGN(FFABS(linesize) + 64, 32);
  
      // edge emu needs blocksize + filter length - 1
      // (= 17x17 for  halfpel / 21x21 for  h264)
Simple merge