summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-18 01:29:19 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-18 01:29:19 +0200
commit9f028b3f3af549a95b4a50af6a1d02acc5089a9f (patch)
treeabc64a309f89923734a7b2542f6d1bfa535e12d6
parenteb0fc73dcc85268f43fe6978342acf8eb90f72fe (diff)
parent49106844929b7b71ac719064d640f8aa56c89b1f (diff)
Merge commit '49106844929b7b71ac719064d640f8aa56c89b1f'
* commit '49106844929b7b71ac719064d640f8aa56c89b1f': tiffenc: fix packet size calculation Conflicts: libavcodec/tiffenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/tiffenc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index dba4ffe70a..5a61f1aefa 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -238,6 +238,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int ret = -1;
int is_yuv = 0, alpha = 0;
int shift_h, shift_v;
+ int packet_size;
s->width = avctx->width;
s->height = avctx->height;
@@ -304,9 +305,10 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
strips = (s->height - 1) / s->rps + 1;
- if ((ret = ff_alloc_packet2(avctx, pkt,
- avctx->width * avctx->height * s->bpp * 2 +
- avctx->height * 4 + FF_MIN_BUFFER_SIZE)) < 0)
+ packet_size = avctx->height * ((avctx->width * s->bpp + 7) >> 3) * 2 +
+ avctx->height * 4 + FF_MIN_BUFFER_SIZE;
+
+ if ((ret = ff_alloc_packet2(avctx, pkt, packet_size)) < 0)
return ret;
ptr = pkt->data;
s->buf_start = pkt->data;