[FFmpeg-devel] [PATCH] allow setting png compression level
Reimar Döffinger
Reimar.Doeffinger
Tue Oct 9 14:44:35 CEST 2007
Hello,
On Sun, Oct 07, 2007 at 11:30:07AM +0200, Reimar D?ffinger wrote:
> On Sun, Oct 07, 2007 at 10:17:18AM +0100, M?ns Rullg?rd wrote:
> > > Index: libavcodec/pngenc.c
> > > ===================================================================
> > > --- libavcodec/pngenc.c (revision 10668)
> > > +++ libavcodec/pngenc.c (working copy)
> > > @@ -187,7 +187,7 @@
> > > s->zstream.zalloc = ff_png_zalloc;
> > > s->zstream.zfree = ff_png_zfree;
> > > s->zstream.opaque = NULL;
> > > - ret = deflateInit2(&s->zstream, Z_DEFAULT_COMPRESSION,
> > > + ret = deflateInit2(&s->zstream, avctx->compression_level,
> > > Z_DEFLATED, 15, 8, Z_DEFAULT_STRATEGY);
> > > if (ret != Z_OK)
> > > return -1;
> >
> > This will work, but only because FF_COMPRESSION_DEFAULT happens to be
> > equal to Z_DEFAULT_STRATEGY. I'd prefer explicitly setting this in
> > the init function. Some range checking probably wouldn't hurt either.
>
> You mean like attached?
> Not doing range checking actually was intentional because I thought
> deflateInit2 was supposed to handle any number.
> Attached patch instead clips avctx->compression_level, does that seem
> like a sane way to do it to you?
I hereby threaten to apply tomorrow.
Greetings,
Reimar D?ffinger
More information about the ffmpeg-devel
mailing list