From 13ae011e4cd540088dfc80ee2f303811f5c51389 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Mon, 5 Sep 2016 10:57:56 -0700 Subject: [PATCH] doc: use two's complement explicitly for uint8->int8 conversion BUG=webp:225 Change-Id: I6bad131e275dbd992484e95a1b834010121281b8 --- doc/webp-lossless-bitstream-spec.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/webp-lossless-bitstream-spec.txt b/doc/webp-lossless-bitstream-spec.txt index 19fec9d1..2d2dde15 100644 --- a/doc/webp-lossless-bitstream-spec.txt +++ b/doc/webp-lossless-bitstream-spec.txt @@ -429,6 +429,11 @@ 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). + The multiplication is to be done using more precision (with at least 16-bit dynamics). The sign extension property of the shift operation does not matter here: only the lowest 8 bits are used from the result,