qiqian / webp

Automatically exported from code.google.com/p/webp
0 stars 0 forks source link

Incorrect flag details in WebP file header documentation? #241

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The documentation of the WebP container format here:

https://developers.google.com/speed/webp/docs/riff_container#extended_file_forma
t

Shows: 

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                   WebP file header (12 bytes)                 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                      ChunkHeader('VP8X')                      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Rsv|I|L|E|X|A|R|                   Reserved                    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          Canvas Width Minus One               |             ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
...  Canvas Height Minus One    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Where the flags are:

I: ICC profile
L: Alpha
E: EXIF metadata
X: XMP metadata
A: Animation

However the project source code shows (in mux_types.h):

// VP8X Feature Flags.
typedef enum WebPFeatureFlags {
  FRAGMENTS_FLAG  = 0x00000001,
  ANIMATION_FLAG  = 0x00000002,
  XMP_FLAG        = 0x00000004,
  EXIF_FLAG       = 0x00000008,
  ALPHA_FLAG      = 0x00000010,
  ICCP_FLAG       = 0x00000020
} WebPFeatureFlags;

Does this differ across versions of the file format, or am I misunderstanding 
the documentation?

Original issue reported on code.google.com by drewnoakes on 12 Feb 2015 at 4:05

GoogleCodeExporter commented 8 years ago
The bits in the image are in MSB order -- with the numbering starting at '0' 
for the high order bit. This is pretty common in RFC(-like) documents, but I 
don't think that's mentioned explicitly. The doc could use an update.

Original comment by jz...@google.com on 12 Feb 2015 at 9:06

GoogleCodeExporter commented 8 years ago
I made an update to the document which has been merged. Thanks for the report!
I'll close this once the copy on developers.google.com has been updated.

https://gerrit.chromium.org/gerrit/#/c/73776/
b510fbf doc/webp-container-spec: note MSB order for chunk diagrams

Original comment by jz...@google.com on 13 Feb 2015 at 11:51

GoogleCodeExporter commented 8 years ago
doc page[1] has been refreshed. Thanks for the report!

[1] https://developers.google.com/speed/webp/docs/riff_container

Original comment by pascal.m...@gmail.com on 14 Feb 2015 at 10:06

GoogleCodeExporter commented 8 years ago
Thanks for the clarification. MSb order does make more sense in the layout 
diagram. My brain reassociated the given indices with the (more familiar to me) 
LSb ordering.

Original comment by drewnoakes on 14 Feb 2015 at 12:47