[Ffmpeg-devel] lzw compression in tiff encoder (qualification task for GSoC)

Michael Niedermayer michaelni
Sat Apr 7 17:16:08 CEST 2007


Hi

On Sat, Apr 07, 2007 at 04:42:52PM +0200, Bartlomiej Wolowiec wrote:
> On Saturday 07 April 2007 14:50, Michael Niedermayer wrote:
> > Hi
> >
> > On Sat, Apr 07, 2007 at 02:33:00PM +0200, Bartlomiej Wolowiec wrote:
> > > Hi,
> > >
> > > On Saturday 07 April 2007 01:50, Michael Niedermayer wrote:
> > > > > +/**
> > > > > + * Init LZW encoder (allocate memory)
> > > > > + * @param s LZW state
> > > > > + */
> > > > > +void ff_lzw_encode_open(LZWEncodeState ** s){
> > > > > +    *s = av_malloc(sizeof(LZWEncodeState));
> > > > > +    (*s)->tab = av_malloc(LZW_HASH_SIZE * sizeof(Code));
> > > > > +}
> > > >
> > > > why _init and _open ? it seems one would be enough
> > >
> > > I've changed functions _open/_close to _alloc/_free. I use _alloc/_init
> > > functions, because allocated memory can be used many times (e.g. in TIFF
> > > encoder can compress every strip separately).
> >
> > could you post benchmarks (START/STOP_TIMER) if its faster by a non
> > neglgible amount iam ok with it, though maybe exporting the size and
> > letting the user allocate it like md5.c doex:
> > const int av_md5_size= sizeof(AVMD5);
> >
> > would be simpler and more flexible?
> 
> I tested it on tiffenc.c (Actually its only one strip in tiff file):
> 2798080 dezicycles in 256 allocate/free (8kb strips in file)
> 770420 dezicycles in one allocate/free
> So, I added to code:
> 
> const int ff_lzw_encode_state_size = sizeof(LZWEncodeState);
> 
> Its simple and flexible ;)

both patches applied

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

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070407/00f42e38/attachment.pgp>



More information about the ffmpeg-devel mailing list