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
This commit is contained in:
James Zern 2022-08-04 19:28:16 -07:00
parent 835392393b
commit 7a0a9935ed
2 changed files with 45 additions and 40 deletions

View File

@ -511,8 +511,9 @@ Disposal method (D): 1 bit
if blend.A = 0 then if blend.A = 0 then
blend.RGB = 0 blend.RGB = 0
else else
blend.RGB = (src.RGB * src.A + blend.RGB =
dst.RGB * dst.A * (1 - src.A / 255)) / blend.A (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 * 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 loop_count ← ANIM.loopCount
dispose_method ← ANIM.disposeMethod dispose_method ← ANIM.disposeMethod
if loop_count == 0: if loop_count == 0:
loop_count = ∞ loop_count = ∞
frame_params ← nil frame_params ← nil
assert next chunk in image_data is ANMF assert next chunk in image_data is ANMF
for loop = 0..loop_count - 1 for loop = 0..loop_count - 1
clear canvas to ANIM.background_color or application defined color clear canvas to ANIM.background_color or application defined color
until eof or non-ANMF chunk until eof or non-ANMF chunk
frame_params.frameX = Frame X frame_params.frameX = Frame X
frame_params.frameY = Frame Y frame_params.frameY = Frame Y
frame_params.frameWidth = Frame Width Minus One + 1 frame_params.frameWidth = Frame Width Minus One + 1
frame_params.frameHeight = Frame Height Minus One + 1 frame_params.frameHeight = Frame Height Minus One + 1
frame_params.frameDuration = Frame Duration frame_params.frameDuration = Frame Duration
frame_right = frame_params.frameX + frame_params.frameWidth frame_right = frame_params.frameX + frame_params.frameWidth
frame_bottom = frame_params.frameY + frame_params.frameHeight frame_bottom = frame_params.frameY + frame_params.frameHeight
assert VP8X.canvasWidth >= frame_right assert VP8X.canvasWidth >= frame_right
assert VP8X.canvasHeight >= frame_bottom assert VP8X.canvasHeight >= frame_bottom
for subchunk in 'Frame Data': for subchunk in 'Frame Data':
if subchunk.tag == "ALPH": if subchunk.tag == "ALPH":
assert alpha subchunks not found in 'Frame Data' earlier assert alpha subchunks not found in 'Frame Data' earlier
frame_params.alpha = alpha_data frame_params.alpha = alpha_data
else if subchunk.tag == "VP8 " OR subchunk.tag == "VP8L": else if subchunk.tag == "VP8 " OR subchunk.tag == "VP8L":
assert bitstream subchunks not found in 'Frame Data' earlier assert bitstream subchunks not found in 'Frame Data' earlier
frame_params.bitstream = bitstream_data frame_params.bitstream = bitstream_data
render frame with frame_params.alpha and frame_params.bitstream on render frame with frame_params.alpha and frame_params.bitstream
canvas with top-left corner at (frame_params.frameX, on canvas with top-left corner at (frame_params.frameX,
frame_params.frameY), using dispose method dispose_method. frame_params.frameY), using dispose method dispose_method.
canvas contains the decoded image. canvas contains the decoded image.
Show the contents of the canvas for frame_params.frameDuration * 1ms. Show the contents of the canvas for
frame_params.frameDuration * 1ms.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -480,7 +480,8 @@ void InverseTransform(uint8 red, uint8 green, uint8 blue,
// color transform deltas // color transform deltas
tmp_red += ColorTransformDelta(trans->green_to_red, green); tmp_red += ColorTransformDelta(trans->green_to_red, green);
tmp_blue += ColorTransformDelta(trans->green_to_blue, 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_red = tmp_red & 0xff;
*new_blue = tmp_blue & 0xff; *new_blue = tmp_blue & 0xff;
@ -920,7 +921,7 @@ int kCodeLengthCodes = 19;
int kCodeLengthCodeOrder[kCodeLengthCodes] = { int kCodeLengthCodeOrder[kCodeLengthCodes] = {
17, 18, 0, 1, 2, 3, 4, 5, 16, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 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) { for (i = 0; i < num_code_lengths; ++i) {
code_length_code_lengths[kCodeLengthCodeOrder[i]] = ReadBits(3); 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: 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; int meta_prefix_code = (entropy_image[pos] >> 8) & 0xffff;
PrefixCodeGroup prefix_group = prefix_code_groups[meta_prefix_code]; PrefixCodeGroup prefix_group = prefix_code_groups[meta_prefix_code];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1090,8 +1092,8 @@ of pixels (xsize * ysize).
#### 7.2 Structure of Transforms #### 7.2 Structure of Transforms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<optional-transform> ::= (1-bit value 1; <transform> <optional-transform>) | <optional-transform> ::=
1-bit value 0 (1-bit value 1; <transform> <optional-transform>) | 1-bit value 0
<transform> ::= <predictor-tx> | <color-tx> | <subtract-green-tx> | <transform> ::= <predictor-tx> | <color-tx> | <subtract-green-tx> |
<color-indexing-tx> <color-indexing-tx>
<predictor-tx> ::= 2-bit value 0; <predictor image> <predictor-tx> ::= 2-bit value 0; <predictor image>
@ -1111,32 +1113,33 @@ of pixels (xsize * ysize).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<spatially-coded image> ::= <color cache info><meta prefix><data> <spatially-coded image> ::= <color cache info><meta prefix><data>
<entropy-coded image> ::= <color cache info><data> <entropy-coded image> ::= <color cache info><data>
<color cache info> ::= 1 bit value 0 | <color cache info> ::=
(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)
<meta prefix> ::= 1-bit value 0 | <meta prefix> ::= 1-bit value 0 |
(1-bit value 1; <entropy image>) (1-bit value 1; <entropy image>)
<data> ::= <prefix codes><lz77-coded image> <data> ::= <prefix codes><lz77-coded image>
<entropy image> ::= 3-bit subsample value; <entropy-coded image> <entropy image> ::= 3-bit subsample value; <entropy-coded image>
<prefix codes> ::= <prefix code group> | <prefix code group><prefix codes> <prefix codes> ::= <prefix code group> |
<prefix code group><prefix codes>
<prefix code group> ::= <prefix code><prefix code><prefix code> <prefix code group> ::= <prefix code><prefix code><prefix code>
<prefix code><prefix code> <prefix code><prefix code>
See "Interpretation of Meta Prefix Codes" to See "Interpretation of Meta Prefix Codes" to
understand what each of these five prefix codes are understand what each of these five prefix
for. codes are for.
<prefix code> ::= <simple prefix code> | <normal prefix code> <prefix code> ::= <simple prefix code> | <normal prefix code>
<simple prefix code> ::= see "Simple code length code" for details <simple prefix code> ::= see "Simple code length code" for details
<normal prefix code> ::= <code length code>; encoded code lengths <normal prefix code> ::= <code length code>; encoded code lengths
<code length code> ::= see section "Normal code length code" <code length code> ::= see section "Normal code length code"
<lz77-coded image> ::= ((<argb-pixel> | <lz77-copy> | <color-cache-code>) <lz77-coded image> ::= ((<argb-pixel> | <lz77-copy> |
<lz77-coded image>) | "" <color-cache-code>) <lz77-coded image>) | ""
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A possible example sequence: A possible example sequence:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<RIFF header><image size>1-bit value 1<subtract-green-tx> <RIFF header><image size>1-bit value 1<subtract-green-tx>
1-bit value 1<predictor-tx>1-bit value 0<color cache info>1-bit value 0 1-bit value 1<predictor-tx>1-bit value 0<color cache info>
<prefix codes><lz77-coded image> 1-bit value 0<prefix codes><lz77-coded image>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[canonical_huff]: https://en.wikipedia.org/wiki/Canonical_Huffman_code [canonical_huff]: https://en.wikipedia.org/wiki/Canonical_Huffman_code