[libav-devel] [PATCH] tiffenc: fix packet size calculation

Kostya Shishkov kostya.shishkov at gmail.com
Fri Jun 13 16:38:46 CEST 2014


On Fri, Jun 13, 2014 at 04:33:21PM +0200, Luca Barbato wrote:
> On 13/06/14 16:30, Tristan Matthews wrote:
> > ---
> >  libavcodec/tiffenc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
> > index ccfb07c..c40f340 100644
> > --- a/libavcodec/tiffenc.c
> > +++ b/libavcodec/tiffenc.c
> > @@ -290,7 +290,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
> >  
> >      if (!pkt->data &&
> >          (ret = av_new_packet(pkt,
> > -                             avctx->width * avctx->height * s->bpp * 2 +
> > +                             (avctx->width * avctx->height * s->bpp * 2) >> 3 +
> >                               avctx->height * 4 + FF_MIN_BUFFER_SIZE)) < 0) {
> >          av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
> >          return ret;
> > 
> 
> Seems probably fine assuming bpp is bits per pixel.

would be better to have height * (width * bpp + 7 >> 3) * 2 instead


More information about the libav-devel mailing list