3

I am reading the official WebP lossless bitstream spec. and I have a feeling, that the document is missing some explanation.

Let me describe some fragments of the specification:

1. Introduction - clear

2. Riff header - clear

3. Transformations

The transformations are used only for the main level ARGB image: the subresolution images have no transforms, not even the 0 bit indicating the end-of-transforms.

Nowhere earlier was it mentioned, that the container holds some sub-resolution images. What are they? Where are they described, if not in the specification? How to they add to the final image?

Then, in the Predictor transform paragraph:

We divide the image into squares...

..what image? The main image or sub-resolution image? What if the image cannot be divided into squares (apart from pixel-size squares)?

The first 4 bits of prediction data define the block width and height in number of bits. The number of block columns, block_xsize, is used in indexing two-dimensionally.

Does this mean that the image width is block_xsize * block_width ?

The transform data contains the prediction mode for each block of the image.

In what way, what format?

I dont know why I am having a hard time understanding this. Maybe because I am not a native english speaker or because the description is too laconic.

I'd appreciate any help in decoding this specification :)

Queequeg
  • 2,824
  • 8
  • 39
  • 66

1 Answers1

3

It was mentioned earlier. Right at the top of the document it says:

The format uses subresolution images, recursively embedded into the format itself, for storing statistical data about the images, such as the used entropy codes, spatial predictors, color space conversion, and color table.

These are arrays (or a vector in the case of the color table) of data where each element applies to a block of pixels in the actual image, e.g. a 16x16 block. These "subresolution images" are not themselves subsamples of the image being compressed.

The format description calls them images because they are stored exactly like the main image is in the format. The transforms are instructions to the decoder to apply to the decompressed main image data. The entropy image is used to decompress the main image, by virtue of providing the Huffman codes for each block.

Mark Adler
  • 101,978
  • 13
  • 118
  • 158
  • Thanks. What makes those arrays images? I mean - if they hold only statistical data, why are they images? Furthermore - if this means, that the transforms defined at the very beginning of the file are needed to encode the main image, then do the transforms *transform* the lz77-encoded main image, or the decoded image? – Queequeg Dec 03 '12 at 07:18
  • One last thing: should the transformations be applied in the order they are found in the file or in reverse order? – Queequeg Dec 04 '12 at 14:32
  • 1
    The inverse transformations should be applied in the reverse of the order they appear in the file. – Mark Adler Dec 05 '12 at 07:17
  • this is still unclear :-) Short: during decoding the order has to be inversed? – Queequeg Dec 05 '12 at 11:20
  • The inverse transformations should be applied in the reverse of the order they appear in the file when decoding. (When else would you apply the inverse transforms?) – Mark Adler Dec 05 '12 at 15:06