mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
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
This commit is contained in:
parent
fad0ece7ed
commit
44741f9c58
@ -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
|
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
|
neighboring pixel, that is, the pixel above the current pixel (0 pixel
|
||||||
difference in X-direction and 1 pixel difference in Y-direction). Similarly,
|
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
|
The decoder can convert a distance code `i` to a scan-line order distance
|
||||||
`dist` as follows:
|
`dist` as follows:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
(xi, yi) = distance_map[i]
|
(xi, yi) = distance_map[i - 1]
|
||||||
dist = x + y * xsize
|
dist = xi + yi * xsize
|
||||||
if (dist < 1) {
|
if (dist < 1) {
|
||||||
dist = 1
|
dist = 1
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user