summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2022-11-17 15:11:43 -0800
committerJames Zern <jzern@google.com>2022-11-17 18:06:31 -0800
commit44741f9c587e006e5289666b1cc8e63d97652315 (patch)
tree7427a3416fcdc4a9f9603813370875ff2d20c492
parentfad0ece7edec90dbead3cfbe19f2bc9d77a410e2 (diff)
downloadlibwebp-44741f9c587e006e5289666b1cc8e63d97652315.tar.gz
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
-rw-r--r--doc/webp-lossless-bitstream-spec.txt6
1 files 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
}