From 7a0a9935ed5f2a91b788b4b5ee48e1b757a625a5 Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 4 Aug 2022 19:28:16 -0700 Subject: [PATCH] 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 Change-Id: Iaf4e8b71be27ef00fccd1d82b79bf96c01040f10 --- doc/webp-container-spec.txt | 54 ++++++++++++++-------------- doc/webp-lossless-bitstream-spec.txt | 31 ++++++++-------- 2 files changed, 45 insertions(+), 40 deletions(-) diff --git a/doc/webp-container-spec.txt b/doc/webp-container-spec.txt index 173a693f..86529ed7 100644 --- a/doc/webp-container-spec.txt +++ b/doc/webp-container-spec.txt @@ -511,8 +511,9 @@ Disposal method (D): 1 bit if blend.A = 0 then blend.RGB = 0 else - blend.RGB = (src.RGB * src.A + - dst.RGB * dst.A * (1 - src.A / 255)) / blend.A + blend.RGB = + (src.RGB * src.A + + dst.RGB * dst.A * (1 - src.A / 255)) / blend.A ~~~~~ * Alpha-blending SHOULD be done in linear color space, by taking into account @@ -760,33 +761,34 @@ canvas ← new image of size VP8X.canvasWidth x VP8X.canvasHeight with loop_count ← ANIM.loopCount dispose_method ← ANIM.disposeMethod if loop_count == 0: - loop_count = ∞ + loop_count = ∞ frame_params ← nil assert next chunk in image_data is ANMF for loop = 0..loop_count - 1 - clear canvas to ANIM.background_color or application defined color - until eof or non-ANMF chunk - frame_params.frameX = Frame X - frame_params.frameY = Frame Y - frame_params.frameWidth = Frame Width Minus One + 1 - frame_params.frameHeight = Frame Height Minus One + 1 - frame_params.frameDuration = Frame Duration - frame_right = frame_params.frameX + frame_params.frameWidth - frame_bottom = frame_params.frameY + frame_params.frameHeight - assert VP8X.canvasWidth >= frame_right - assert VP8X.canvasHeight >= frame_bottom - for subchunk in 'Frame Data': - if subchunk.tag == "ALPH": - assert alpha subchunks not found in 'Frame Data' earlier - frame_params.alpha = alpha_data - else if subchunk.tag == "VP8 " OR subchunk.tag == "VP8L": - assert bitstream subchunks not found in 'Frame Data' earlier - frame_params.bitstream = bitstream_data - render frame with frame_params.alpha and frame_params.bitstream on - canvas with top-left corner at (frame_params.frameX, - frame_params.frameY), using dispose method dispose_method. - canvas contains the decoded image. - Show the contents of the canvas for frame_params.frameDuration * 1ms. + clear canvas to ANIM.background_color or application defined color + until eof or non-ANMF chunk + frame_params.frameX = Frame X + frame_params.frameY = Frame Y + frame_params.frameWidth = Frame Width Minus One + 1 + frame_params.frameHeight = Frame Height Minus One + 1 + frame_params.frameDuration = Frame Duration + frame_right = frame_params.frameX + frame_params.frameWidth + frame_bottom = frame_params.frameY + frame_params.frameHeight + assert VP8X.canvasWidth >= frame_right + assert VP8X.canvasHeight >= frame_bottom + for subchunk in 'Frame Data': + if subchunk.tag == "ALPH": + assert alpha subchunks not found in 'Frame Data' earlier + frame_params.alpha = alpha_data + else if subchunk.tag == "VP8 " OR subchunk.tag == "VP8L": + assert bitstream subchunks not found in 'Frame Data' earlier + frame_params.bitstream = bitstream_data + render frame with frame_params.alpha and frame_params.bitstream + on canvas with top-left corner at (frame_params.frameX, + frame_params.frameY), using dispose method dispose_method. + canvas contains the decoded image. + Show the contents of the canvas for + frame_params.frameDuration * 1ms. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/webp-lossless-bitstream-spec.txt b/doc/webp-lossless-bitstream-spec.txt index 0edb768b..c1ff493e 100644 --- a/doc/webp-lossless-bitstream-spec.txt +++ b/doc/webp-lossless-bitstream-spec.txt @@ -480,7 +480,8 @@ void InverseTransform(uint8 red, uint8 green, uint8 blue, // color transform deltas tmp_red += ColorTransformDelta(trans->green_to_red, green); tmp_blue += ColorTransformDelta(trans->green_to_blue, green); - tmp_blue += ColorTransformDelta(trans->red_to_blue, tmp_red & 0xff); + tmp_blue += + ColorTransformDelta(trans->red_to_blue, tmp_red & 0xff); *new_red = tmp_red & 0xff; *new_blue = tmp_blue & 0xff; @@ -920,7 +921,7 @@ int kCodeLengthCodes = 19; int kCodeLengthCodeOrder[kCodeLengthCodes] = { 17, 18, 0, 1, 2, 3, 4, 5, 16, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; -int code_length_code_lengths[kCodeLengthCodes] = { 0 }; // All zeros. +int code_length_code_lengths[kCodeLengthCodes] = { 0 }; // All zeros for (i = 0; i < num_code_lengths; ++i) { code_length_code_lengths[kCodeLengthCodeOrder[i]] = ReadBits(3); } @@ -1024,7 +1025,8 @@ Given a pixel (x, y) in the ARGB image, we can obtain the corresponding prefix codes to be used as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -int position = (y >> prefix_bits) * prefix_xsize + (x >> prefix_bits); +int position = + (y >> prefix_bits) * prefix_xsize + (x >> prefix_bits); int meta_prefix_code = (entropy_image[pos] >> 8) & 0xffff; PrefixCodeGroup prefix_group = prefix_code_groups[meta_prefix_code]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1090,8 +1092,8 @@ of pixels (xsize * ysize). #### 7.2 Structure of Transforms ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ::= (1-bit value 1; ) | - 1-bit value 0 + ::= + (1-bit value 1; ) | 1-bit value 0 ::= | | | ::= 2-bit value 0; @@ -1111,32 +1113,33 @@ of pixels (xsize * ysize). ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ::= ::= - ::= 1 bit value 0 | - (1-bit value 1; 4-bit value for color cache size) + ::= + 1 bit value 0 | (1-bit value 1; 4-bit value for color cache size) ::= 1-bit value 0 | (1-bit value 1; ) ::= ::= 3-bit subsample value; - ::= | + ::= | + ::= See "Interpretation of Meta Prefix Codes" to - understand what each of these five prefix codes are - for. + understand what each of these five prefix + codes are for. ::= | ::= see "Simple code length code" for details ::= ; encoded code lengths ::= see section "Normal code length code" - ::= (( | | ) - ) | "" + ::= (( | | + ) ) | "" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A possible example sequence: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1-bit value 1 -1-bit value 11-bit value 01-bit value 0 - +1-bit value 11-bit value 0 +1-bit value 0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [canonical_huff]: https://en.wikipedia.org/wiki/Canonical_Huffman_code