From 44741f9c587e006e5289666b1cc8e63d97652315 Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 17 Nov 2022 15:11:43 -0800 Subject: [PATCH 1/5] webp-lossless-bitstream-spec: fix dist mapping example The distance code read from the bitstream is reduced by 1 before doing the lookup. The prose describing the lookup was correct, the pseudocode failed to subtract 1 and used x/y instead of xi/yi from the lookup. Bug: webp:448 Change-Id: I152477b888c26a0473a35373d3d331fddd14237f --- doc/webp-lossless-bitstream-spec.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/webp-lossless-bitstream-spec.txt b/doc/webp-lossless-bitstream-spec.txt index ecdfca3c..14afb949 100644 --- a/doc/webp-lossless-bitstream-spec.txt +++ b/doc/webp-lossless-bitstream-spec.txt @@ -764,14 +764,14 @@ The mapping between distance code `i` and the neighboring pixel offset For example, distance code `1` indicates an offset of `(0, 1)` for the neighboring pixel, that is, the pixel above the current pixel (0 pixel difference in X-direction and 1 pixel difference in Y-direction). Similarly, -distance code `3` indicates left-top pixel. +distance code `3` indicates the left-top pixel. The decoder can convert a distance code `i` to a scan-line order distance `dist` as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -(xi, yi) = distance_map[i] -dist = x + y * xsize +(xi, yi) = distance_map[i - 1] +dist = xi + yi * xsize if (dist < 1) { dist = 1 } From 54ebd5a375fd14a86dcf491431d8b8ebb62bc4d0 Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 17 Nov 2022 17:32:44 -0800 Subject: [PATCH 2/5] webp-lossless-bitstream-spec: limit dist map lut to 69 cols this is similar to an earlier change for most of the code examples: 7a0a9935 doc/*.txt: restrict code to 69 columns some renderers may limit output to 72 and use a 3 space indent; this avoids overflowing into the margin Bug: webp:448 Change-Id: I2e8d66f598889c7bd824e911ea01fd70f98a4130 --- doc/webp-lossless-bitstream-spec.txt | 33 +++++++++++++++------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/doc/webp-lossless-bitstream-spec.txt b/doc/webp-lossless-bitstream-spec.txt index 14afb949..e6732636 100644 --- a/doc/webp-lossless-bitstream-spec.txt +++ b/doc/webp-lossless-bitstream-spec.txt @@ -744,21 +744,24 @@ The mapping between distance code `i` and the neighboring pixel offset `(xi, yi)` is as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -(0, 1), (1, 0), (1, 1), (-1, 1), (0, 2), (2, 0), (1, 2), (-1, 2), -(2, 1), (-2, 1), (2, 2), (-2, 2), (0, 3), (3, 0), (1, 3), (-1, 3), -(3, 1), (-3, 1), (2, 3), (-2, 3), (3, 2), (-3, 2), (0, 4), (4, 0), -(1, 4), (-1, 4), (4, 1), (-4, 1), (3, 3), (-3, 3), (2, 4), (-2, 4), -(4, 2), (-4, 2), (0, 5), (3, 4), (-3, 4), (4, 3), (-4, 3), (5, 0), -(1, 5), (-1, 5), (5, 1), (-5, 1), (2, 5), (-2, 5), (5, 2), (-5, 2), -(4, 4), (-4, 4), (3, 5), (-3, 5), (5, 3), (-5, 3), (0, 6), (6, 0), -(1, 6), (-1, 6), (6, 1), (-6, 1), (2, 6), (-2, 6), (6, 2), (-6, 2), -(4, 5), (-4, 5), (5, 4), (-5, 4), (3, 6), (-3, 6), (6, 3), (-6, 3), -(0, 7), (7, 0), (1, 7), (-1, 7), (5, 5), (-5, 5), (7, 1), (-7, 1), -(4, 6), (-4, 6), (6, 4), (-6, 4), (2, 7), (-2, 7), (7, 2), (-7, 2), -(3, 7), (-3, 7), (7, 3), (-7, 3), (5, 6), (-5, 6), (6, 5), (-6, 5), -(8, 0), (4, 7), (-4, 7), (7, 4), (-7, 4), (8, 1), (8, 2), (6, 6), -(-6, 6), (8, 3), (5, 7), (-5, 7), (7, 5), (-7, 5), (8, 4), (6, 7), -(-6, 7), (7, 6), (-7, 6), (8, 5), (7, 7), (-7, 7), (8, 6), (8, 7) +(0, 1), (1, 0), (1, 1), (-1, 1), (0, 2), (2, 0), (1, 2), +(-1, 2), (2, 1), (-2, 1), (2, 2), (-2, 2), (0, 3), (3, 0), +(1, 3), (-1, 3), (3, 1), (-3, 1), (2, 3), (-2, 3), (3, 2), +(-3, 2), (0, 4), (4, 0), (1, 4), (-1, 4), (4, 1), (-4, 1), +(3, 3), (-3, 3), (2, 4), (-2, 4), (4, 2), (-4, 2), (0, 5), +(3, 4), (-3, 4), (4, 3), (-4, 3), (5, 0), (1, 5), (-1, 5), +(5, 1), (-5, 1), (2, 5), (-2, 5), (5, 2), (-5, 2), (4, 4), +(-4, 4), (3, 5), (-3, 5), (5, 3), (-5, 3), (0, 6), (6, 0), +(1, 6), (-1, 6), (6, 1), (-6, 1), (2, 6), (-2, 6), (6, 2), +(-6, 2), (4, 5), (-4, 5), (5, 4), (-5, 4), (3, 6), (-3, 6), +(6, 3), (-6, 3), (0, 7), (7, 0), (1, 7), (-1, 7), (5, 5), +(-5, 5), (7, 1), (-7, 1), (4, 6), (-4, 6), (6, 4), (-6, 4), +(2, 7), (-2, 7), (7, 2), (-7, 2), (3, 7), (-3, 7), (7, 3), +(-7, 3), (5, 6), (-5, 6), (6, 5), (-6, 5), (8, 0), (4, 7), +(-4, 7), (7, 4), (-7, 4), (8, 1), (8, 2), (6, 6), (-6, 6), +(8, 3), (5, 7), (-5, 7), (7, 5), (-7, 5), (8, 4), (6, 7), +(-6, 7), (7, 6), (-7, 6), (8, 5), (7, 7), (-7, 7), (8, 6), +(8, 7) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For example, distance code `1` indicates an offset of `(0, 1)` for the From f6a4684ba802f2866b8355dd590f99770bbc5fe6 Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 17 Nov 2022 18:03:14 -0800 Subject: [PATCH 3/5] webp-lossless-bitstream-spec,cosmetics: normalize range syntax [N-M], [N, M] -> [N..M] these were missed in: e74f8a62 webp-lossless-bitstream-spec,cosmetics: normalize range syntax Bug: webp:448 Change-Id: I6ca7c5d6b0473fdf3de0c6dba00b0f1e3da46a23 --- doc/webp-lossless-bitstream-spec.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/webp-lossless-bitstream-spec.txt b/doc/webp-lossless-bitstream-spec.txt index e6732636..9f013724 100644 --- a/doc/webp-lossless-bitstream-spec.txt +++ b/doc/webp-lossless-bitstream-spec.txt @@ -436,7 +436,7 @@ int8 ColorTransformDelta(int8 t, int8 c) { A conversion from the 8-bit unsigned representation (uint8) to the 8-bit signed one (int8) is required before calling `ColorTransformDelta()`. It should be performed using 8-bit two's complement (that is: uint8 range -\[128-255\] is mapped to the \[-128, -1\] range of its converted int8 value). +\[128..255\] is mapped to the \[-128..-1\] range of its converted int8 value). The multiplication is to be done using more precision (with at least 16-bit dynamics). The sign extension property of the shift operation From 1e8e3ded212a276e3df11822f784d6bda6cfdc93 Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 17 Nov 2022 18:22:56 -0800 Subject: [PATCH 4/5] webp-lossless-bitstream-spec: reword abstract re alpha 'zero alpha pixels' was a bit hard to parse; replace this with something more explicit Bug: webp:448 Change-Id: Ifc8c93af5520ffdafc58e3fc311dfb4cb19626e9 --- doc/webp-lossless-bitstream-spec.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/webp-lossless-bitstream-spec.txt b/doc/webp-lossless-bitstream-spec.txt index 9f013724..7c140f49 100644 --- a/doc/webp-lossless-bitstream-spec.txt +++ b/doc/webp-lossless-bitstream-spec.txt @@ -23,7 +23,7 @@ Abstract WebP lossless is an image format for lossless compression of ARGB images. The lossless format stores and restores the pixel values -exactly, including the color values for zero alpha pixels. The +exactly, including the color values for pixels whose alpha value is 0. 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 From e3ba2b1f5b6aebe32c2afbad982316710b49c295 Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 17 Nov 2022 18:25:13 -0800 Subject: [PATCH 5/5] webp-lossless-bitstream-spec,cosmetics: reflow abstract Bug: webp:448 Change-Id: Ie975dbb52687c6c068b029fc8f84db8cf189523a --- doc/webp-lossless-bitstream-spec.txt | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/doc/webp-lossless-bitstream-spec.txt b/doc/webp-lossless-bitstream-spec.txt index 7c140f49..79a8ea00 100644 --- a/doc/webp-lossless-bitstream-spec.txt +++ b/doc/webp-lossless-bitstream-spec.txt @@ -21,16 +21,15 @@ Paragraphs marked as \[AMENDED2\] were amended on 2022-05-13. Abstract -------- -WebP lossless is an image format for lossless compression of ARGB -images. The lossless format stores and restores the pixel values -exactly, including the color values for pixels whose alpha value is 0. 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. LZ77, prefix coding, and a color cache are used for compression -of the bulk data. Decoding speeds faster than PNG have been -demonstrated, as well as 25% denser compression than can be achieved -using today's PNG format. +WebP lossless is an image format for lossless compression of ARGB images. The +lossless format stores and restores the pixel values exactly, including the +color values for pixels whose alpha value is 0. 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. LZ77, prefix coding, and a color cache +are used for compression of the bulk data. Decoding speeds faster than PNG have +been demonstrated, as well as 25% denser compression than can be achieved using +today's PNG format. * TOC placeholder