[Ffmpeg-devel] TIFF LZW decoder (was: [PATCH] change gif demuxer to gif decoder)
Kostya
kostya.shishkov
Tue Oct 24 06:35:01 CEST 2006
On Mon, Oct 23, 2006 at 10:19:03PM +0200, Michael Niedermayer wrote:
> Hi
>
> On Mon, Oct 23, 2006 at 04:21:04PM +0300, Kostya wrote:
> > On Mon, Oct 23, 2006 at 10:26:57AM +0300, Kostya wrote:
> > >
> > [...]
> > > Different LZW implementations may differ by:
> > > a) initial code size
> > > b) output codeword size (may vary from smth to smth or be constant 12 bits)
> > > c) additional symbols for decoder reset and dictionary size expansion
> > >
> > > As I implemented TIFF decoder for FFmpeg it'll be probably me who will
> > > add LZW support to TIFF. I'll look in libtiff sources for further details.
> >
> > Reality is far more curly than expected:
> > a) there are two LZW variants - one is very similar (or identical) to GIF but
> > it is not used
> > b) TIFF LZW has MSB codeword order (i.e. next byte has lower 8 bits, not high)
> > c) Codeword size should be increased _before_ the current dictionary is full
> > d) Each line should end with end-of-image code and decoder needs to be reset
> > before decoding next line.
> >
> > Also preliminary patch for LZW support in TIFF is provided. It has some bugs but
> > it should work more or less.
>
> can this be merged with the code in gifdec.c ?
>
> a few checks in the innermost loops would be no problem as the stuff could
> be made always_inline (if needed in 2 warper functions like
> always_inline lzw_decode_generic(..., variant){ ...
>
> lzw_decode_gif(...){lzw_decode_generic(..., LZW_GIF);}
As I understand, it may not need the wrapper, just two additional fields in
structure: GetCode() pointer and dict_limit (when dictionary size reaches it,
it should be expanded). I also tend to pass buffer and size to the structure
instead of using bytestream.
I intend to present this scheme to the end of week.
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> In the past you could go to a library and read, borrow or copy any book
> Today you'd get arrested for mere telling someone where the library is
>
More information about the ffmpeg-devel
mailing list