From 9ec9a913fbfc6238de915c360df2324c309636fb Mon Sep 17 00:00:00 2001
From: Christophe Gisquet <christophe.gisquet@gmail.com>
Date: Sun, 12 Oct 2014 21:10:54 +0200
Subject: [PATCH] tiffenc: properly compute packet size
The bytes per row is a better indication of it.
---
libavcodec/tiffenc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index 5a61f1a..138d214 100644
|
a
|
b
|
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
| 305 | 305 | |
| 306 | 306 | strips = (s->height - 1) / s->rps + 1; |
| 307 | 307 | |
| 308 | | packet_size = avctx->height * ((avctx->width * s->bpp + 7) >> 3) * 2 + |
| | 308 | bytes_per_row = (((s->width - 1) / s->subsampling[0] + 1) * s->bpp * |
| | 309 | s->subsampling[0] * s->subsampling[1] + 7) >> 3; |
| | 310 | packet_size = avctx->height * bytes_per_row * 2 + |
| 309 | 311 | avctx->height * 4 + FF_MIN_BUFFER_SIZE; |
| 310 | 312 | |
| 311 | 313 | if ((ret = ff_alloc_packet2(avctx, pkt, packet_size)) < 0) |
| … |
… |
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
| 333 | 335 | goto fail; |
| 334 | 336 | } |
| 335 | 337 | |
| 336 | | bytes_per_row = (((s->width - 1) / s->subsampling[0] + 1) * s->bpp * |
| 337 | | s->subsampling[0] * s->subsampling[1] + 7) >> 3; |
| 338 | 338 | if (is_yuv) { |
| 339 | 339 | av_fast_padded_malloc(&s->yuv_line, &s->yuv_line_size, bytes_per_row); |
| 340 | 340 | if (s->yuv_line == NULL) { |