From f8b7d94daa3c65240d44a2b3f59adf2b0a7a8e22 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Thu, 18 Sep 2014 08:21:02 +0200 Subject: [PATCH] Amend the lossless spec according to issue #205, #206 and #224 http://code.google.com/p/webp/issues/detail?id=205 <- Select() http://code.google.com/p/webp/issues/detail?id=206 <- out-of-bound colormap index http://code.google.com/p/webp/issues/detail?id=224 <- version number MUST be 0 (cherry picked from commit d7167ff7ce71f73205e9c8af07ce8bd8134cf779) Change-Id: I56a575529862dfc8ad189ddcfc47ef59a58f273d --- doc/webp-lossless-bitstream-spec.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/webp-lossless-bitstream-spec.txt b/doc/webp-lossless-bitstream-spec.txt index 7af58f1e..19fec9d1 100644 --- a/doc/webp-lossless-bitstream-spec.txt +++ b/doc/webp-lossless-bitstream-spec.txt @@ -14,6 +14,7 @@ Specification for WebP Lossless Bitstream _Jyrki Alakuijala, Ph.D., Google, Inc., 2012-06-19_ +Paragraphs marked as \[AMENDED\] were amended on 2014-09-16. Abstract -------- @@ -172,8 +173,8 @@ It should be set to 0 when all alpha values are 255 in the picture, and int alpha_is_used = ReadBits(1); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The version_number is a 3 bit code that must be discarded by the decoder -at this time. Complying encoders write a 3-bit value 0. +The version_number is a 3 bit code that must be set to 0. Any other value +should be treated as an error. \[AMENDED\] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ int version_number = ReadBits(3); @@ -330,7 +331,7 @@ uint32 Select(uint32 L, uint32 T, uint32 TL) { abs(pGreen - GREEN(T)) + abs(pBlue - BLUE(T)); // Return either left or top, the one closer to the prediction. - if (pL <= pT) { + if (pL < pT) { // \[AMENDED\] return L; } else { return T; @@ -542,6 +543,9 @@ color. argb = color_table[GREEN(argb)]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +If the index is equal or larger than color_table_size, the argb color value +should be set to 0x00000000 (transparent black). \[AMENDED\] + When the color table is small (equal to or less than 16 colors), several pixels are bundled into a single pixel. The pixel bundling packs several (2, 4, or 8) pixels into a single pixel, reducing the image width