[FFmpeg-devel] [PATCH] allow setting png compression level

Michael Niedermayer michaelni
Tue Oct 9 17:19:01 CEST 2007


Hi

On Tue, Oct 09, 2007 at 04:04:47PM +0200, Reimar D?ffinger wrote:
> Hello,
> On Tue, Oct 09, 2007 at 03:33:09PM +0200, Michael Niedermayer wrote:
> > > Index: libavcodec/pngenc.c
> > > ===================================================================
> > > --- libavcodec/pngenc.c	(revision 10668)
> > > +++ libavcodec/pngenc.c	(working copy)
> > > @@ -187,7 +187,8 @@
> > >      s->zstream.zalloc = ff_png_zalloc;
> > >      s->zstream.zfree = ff_png_zfree;
> > >      s->zstream.opaque = NULL;
> > > -    ret = deflateInit2(&s->zstream, Z_DEFAULT_COMPRESSION,
> > > +    avctx->compression_level = av_clip(avctx->compression_level, 0, 9);
> > > +    ret = deflateInit2(&s->zstream, avctx->compression_level,
> > >                         Z_DEFLATED, 15, 8, Z_DEFAULT_STRATEGY);
> > >      if (ret != Z_OK)
> > >          return -1;
> > > @@ -314,6 +315,7 @@
> > >  
> > >      avcodec_get_frame_defaults((AVFrame*)&s->picture);
> > >      avctx->coded_frame= (AVFrame*)&s->picture;
> > > +    avctx->compression_level= Z_DEFAULT_COMPRESSION;
> > >  
> > >      return 0;
> > >  }
> > 
> >     /**
> >      * - encoding: Set by user.
> >                    ^^^^^^^^^^^^
> >      * - decoding: unused
> >      */
> >     int compression_level;
> > #define FF_COMPRESSION_DEFAULT -1
> > 
> > an encoder has no business setting compression_level to some custom
> > default
> 
> Hm. I'd interpret that under"lined" part as it has no business setting
> it at all, so it should be done as attached?

yes patch ok

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

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071009/cc7e44eb/attachment.pgp>



More information about the ffmpeg-devel mailing list