[SCM] libav/experimental: tiffenc: fix packet size calculation

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Aug 10 16:03:29 UTC 2014


The following commit has been merged in the experimental branch:
commit 49106844929b7b71ac719064d640f8aa56c89b1f
Author: Tristan Matthews <le.businessman at gmail.com>
Date:   Fri Jun 13 10:57:12 2014 -0400

    tiffenc: fix packet size calculation
    
    Signed-off-by: Anton Khirnov <anton at khirnov.net>

diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index ccfb07c..f450edb 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -218,6 +218,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     int is_yuv = 0;
     uint8_t *yuv_line = NULL;
     int shift_h, shift_v;
+    int packet_size;
     const AVPixFmtDescriptor *pfd;
 
     s->avctx = avctx;
@@ -288,10 +289,11 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
 
     strips = (s->height - 1) / s->rps + 1;
 
+    packet_size = avctx->height * ((avctx->width * s->bpp + 7) >> 3) * 2 +
+                  avctx->height * 4 + FF_MIN_BUFFER_SIZE;
+
     if (!pkt->data &&
-        (ret = av_new_packet(pkt,
-                             avctx->width * avctx->height * s->bpp * 2 +
-                             avctx->height * 4 + FF_MIN_BUFFER_SIZE)) < 0) {
+        (ret = av_new_packet(pkt, packet_size)) < 0) {
         av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
         return ret;
     }

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list