Commit 49106844 authored by Tristan Matthews's avatar Tristan Matthews Committed by Anton Khirnov

tiffenc: fix packet size calculation

Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
parent fe4d5fe9
...@@ -218,6 +218,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, ...@@ -218,6 +218,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int is_yuv = 0; int is_yuv = 0;
uint8_t *yuv_line = NULL; uint8_t *yuv_line = NULL;
int shift_h, shift_v; int shift_h, shift_v;
int packet_size;
const AVPixFmtDescriptor *pfd; const AVPixFmtDescriptor *pfd;
s->avctx = avctx; s->avctx = avctx;
...@@ -288,10 +289,11 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, ...@@ -288,10 +289,11 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
strips = (s->height - 1) / s->rps + 1; 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 && if (!pkt->data &&
(ret = av_new_packet(pkt, (ret = av_new_packet(pkt, packet_size)) < 0) {
avctx->width * avctx->height * s->bpp * 2 +
avctx->height * 4 + FF_MIN_BUFFER_SIZE)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment