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

Bartlomiej Wolowiec b.wolowiec
Sat Apr 7 16:42:52 CEST 2007


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 ;)

Best Regards,
Bartek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lzw.patch
Type: text/x-diff
Size: 8169 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070407/37decfb0/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tifflzw.patch
Type: text/x-diff
Size: 3203 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070407/37decfb0/attachment-0001.patch>



More information about the ffmpeg-devel mailing list