[Ffmpeg-devel] [PATCH] change gif demuxer to gif decoder
Mon Oct 23 09:26:57 CEST 2006
On Sun, Oct 22, 2006 at 02:37:51PM -0400, Justin Ruggles wrote:
> Benjamin Larsson wrote:
> > If it is ok with Michael. One thing though is that I don't know if the
> > lzw in tiff is the same as in gif.
> But looking having implemented TIFF LZW decoding and looking at the GIF
> spec, they seem to be the same for 8-bit, but are different for other
> bit depths. GIF adapts the code size to the bit depth, while TIFF
> always uses 8-bit codes no matter what. From the 2 specs:
> TIFF 6.0:
> "The 'characters' that make up the LZW strings are bytes containing TIFF
> uncompressed (Compression=1) image data, in out implementation. For
> example, if BitsPerSample is 4, each 8-bit LZW character will contain
> two 4-bit pixels. If BitsPerSample is 16, each 16-bit pixel will span
> two 8-bit LZW characters."
> GIF 89a:
> "ESTABLISH CODE SIZE
> The first byte of the Compressed Data stream is a value indicating the
> minimum number of bits required to represent the set of actual pixel
> values. Normally this will be the same as the number of color bits.
> Because of some algorithmic constraints however, black & white images
> which have one color bit must be indicated as having a code size of 2.
> This code size value also implies that the compression codes must start
> out one bit longer."
> Hope that helps. It doesn't look like it would be too hard to make a
> single implementation which would work for both formats.
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.
More information about the ffmpeg-devel