summaryrefslogtreecommitdiff
path: root/libavcodec/tiffenc.c
diff options
context:
space:
mode:
authorTristan Matthews <le.businessman@gmail.com>2014-06-13 10:57:12 -0400
committerAnton Khirnov <anton@khirnov.net>2014-06-17 21:24:12 +0200
commit49106844929b7b71ac719064d640f8aa56c89b1f (patch)
tree876c11165327808d3a86529f21efca8772ee46fb /libavcodec/tiffenc.c
parentfe4d5fe9361162f9033ff1bd84bfc1b2091ba785 (diff)
tiffenc: fix packet size calculation
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec/tiffenc.c')
-rw-r--r--libavcodec/tiffenc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index ccfb07c5f7..f450edb10f 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;
}