[FFmpeg-devel] [PATCH 1/4] png: Clear up the calculation of max packet size

Michael Niedermayer michaelni at gmx.at
Tue Mar 31 16:35:43 CEST 2015


On Tue, Mar 31, 2015 at 12:37:22PM +0000, Donny Yang wrote:
> Signed-off-by: Donny Yang <work at kota.moe>
> ---
>  libavcodec/pngenc.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
> index 8fff0f3..ca0ed25 100644
> --- a/libavcodec/pngenc.c
> +++ b/libavcodec/pngenc.c
> @@ -307,12 +307,16 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
>      row_size       = (avctx->width * s->bits_per_pixel + 7) >> 3;
>  
>      enc_row_size    = deflateBound(&s->zstream, row_size);
> -    max_packet_size = avctx->height * (int64_t)(enc_row_size +
> -                                       ((enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) * 12)
> -                      + FF_MIN_BUFFER_SIZE;
> +    max_packet_size =
> +        FF_MIN_BUFFER_SIZE + // headers
> +        avctx->height * (
> +            enc_row_size +
> +            12 * (((int64_t)enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) // IDAT * ceil(enc_row_size / IOBUF_SIZE)
> +        );
>      if (max_packet_size > INT_MAX)
>          return AVERROR(ENOMEM);
> -    if ((ret = ff_alloc_packet2(avctx, pkt, max_packet_size)) < 0)
> +    ret = ff_alloc_packet2(avctx, pkt, max_packet_size);

> +    if (ret)

changed to ret < 0

applied

thanks


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150331/62409474/attachment.asc>


More information about the ffmpeg-devel mailing list