A VP8 chunk holds one lossy picture as a single VP8 key frame: a frame
header, then for each 16 × 16 block of the picture (a macroblock) a way to predict it from its
neighbours and a few quantised DCT coefficients that correct the prediction. A reader turns
the chunk into pixels in this order: read the frame tag and header, read the prediction modes
of every macroblock, read the coefficients, multiply them by the quantiser factors, inverse
transform them and add them to the prediction, smooth the block edges with the loop filter,
and convert the Y′CbCr planes to RGB. The sections below follow that order: the syntax first
(the frame layout to the coefficient tokens),
then the arithmetic of reconstruction. The format is the intra-frame part of the VP8 video codec,
RFC 6386; a WebP image never holds an
inter frame.
Frame layout
| Part | Size | Description |
|---|---|---|
| Frame tag | 3 | Frame type, version, show flag and the size of the first partition. |
| Start code, width, height | 7 | Key frames only: 9D 01 2A and the two 14-bit sizes with their scale bits. |
| First partition | first_part_size | The frame header, then the header of every macroblock in raster order, all boolean-coded as one stream. |
| Partition sizes | 3 × (n − 1) | For n token partitions, the size of each except the last as a 24-bit little-endian number. Absent when n is 1. |
| Token partitions | the rest | n boolean-coded streams of coefficient tokens. The last one runs to the end of the chunk. |
The picture is cut into macroblocks of 16 × 16 luma pixels: ⌈width ÷ 16⌉ columns and ⌈height ÷ 16⌉ rows, in raster order. The chroma planes have half the width and height, so a macroblock holds 8 × 8 of each. The decoder works on the padded size and crops to the stated width and height at the end.
Macroblock row r takes its coefficients from token partition r mod n, so the partitions can be decoded in parallel. The first partition is read one row of macroblocks at a time, in step with the token partitions. All the numbers in the frame tag and the partition table are little-endian. A partition that is declared larger than the data that remains is cut to what remains.
Boolean entropy decoder
The first partition and every token partition are read with the same arithmetic decoder. It returns one bit at a time, given the probability, from 1 to 255 out of 256, that the bit is 0. Each partition has its own decoder, started at its first byte.
start: value = first 2 bytes, big-endian range = 255 bit_count = 0
read_bool(prob):
split = 1 + (((range - 1) * prob) >> 8)
if value >= split << 8: bit = 1; range -= split; value -= split << 8
else: bit = 0; range = split
while range < 128:
value <<= 1; range <<= 1
if ++bit_count == 8: bit_count = 0; value |= next byte
A decoder that runs out of bytes reads zeros. The other reads are built on that one.
| Read | Meaning |
|---|---|
| L(n) | An unsigned n-bit value, the first bit most significant, each bit read with probability 128. |
| B(p) | One bit read with probability p. |
| signed value of n bits | L(n), then L(1) for the sign: 1 means negative. |
| tree read | Starting at the tree’s root, read a bit with the probability of the current node (the node’s index divided by 2) and go to the left or right child. A child that is 0 or negative is a leaf, with the value 0 or the negated number. |
Frame tag
Three bytes read as one little-endian 24-bit number.
| Bits | Name | Description |
|---|---|---|
| 0 | frame type | 0 key frame; 1 interframe. |
| 1–3 | version | The profile, 0 to 3; other values are reserved. |
| 4 | show_frame | Whether the frame is for display. |
| 5–23 | first_part_size | Size in bytes of the first partition. |
| Version | Reconstruction filter | Loop filter |
|---|---|---|
| 0 | Bicubic | Normal |
| 1 | Bilinear | Simple |
| 2 | Bilinear | None |
| 3 | None | None |
The RFC notes that the loop filter settings in the frame header are what count for decoding.
Key frame header
Seven more bytes follow the tag on a key frame.
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 3 | 3 | bytes | start code | 9D 01 2A |
| 6 | 2 | u16 | width and scale | Low 14 bits width; top 2 bits horizontal scale. |
| 8 | 2 | u16 | height and scale | Low 14 bits height; top 2 bits vertical scale. |
| Scale | Upscaling |
|---|---|
| 0 | None |
| 1 | 5/4 |
| 2 | 5/3 |
| 3 | 2 |
A shown key frame, version 0, with a first partition of 123 bytes and a size of 640 by 480:
70 0F 00 9D 01 2A 80 02 E0 01
Frame header
The frame header is coded by the boolean entropy decoder, starting at the first
partition. L(n) is an unsigned value of n bits, each read with even
probability. Interframe-only fields are in the RFC and are listed here because the
syntax defines them, but a WebP image is a key frame.
| Field | Type | When | Description |
|---|---|---|---|
| color_space | L(1) | key frame | 0 a YUV colour space similar to BT.601; 1 reserved. |
| clamping_type | L(1) | key frame | 0 the decoder must clamp reconstructed values; 1 no clamping is needed. |
| segmentation_enabled | L(1) | Whether update_segmentation follows. | |
| filter_type | L(1) | 0 normal loop filter; 1 simple. | |
| loop_filter_level | L(6) | Filter strength. | |
| sharpness_level | L(3) | Filter sharpness. | |
| mb_lf_adjustments | See below. | ||
| log2_nbr_of_dct_partitions | L(2) | The number of coefficient partitions is 1, 2, 4 or 8. | |
| quant_indices | See below. | ||
| refresh_entropy_probs | L(1) | key frame | Whether the probabilities decoded here are kept for later frames. |
| refresh_golden_frame | L(1) | interframe | |
| refresh_alternate_frame | L(1) | interframe | |
| copy_buffer_to_golden | L(2) | interframe, golden not refreshed | |
| copy_buffer_to_alternate | L(2) | interframe, alternate not refreshed | |
| sign_bias_golden | L(1) | interframe | |
| sign_bias_alternate | L(1) | interframe | |
| refresh_entropy_probs | L(1) | interframe | |
| refresh_last | L(1) | interframe | |
| token_prob_update | For i < 4, j < 8, k < 3, l < 11: coeff_prob_update_flag, then coeff_prob L(8) if set. | ||
| mb_no_skip_coeff | L(1) | ||
| prob_skip_false | L(8) | mb_no_skip_coeff | |
| prob_intra, prob_last, prob_gf | L(8) each | interframe | |
| intra_16x16_prob_update_flag | L(1) | interframe | If set, four intra_16x16_prob L(8). |
| intra_chroma_prob_update_flag | L(1) | interframe | If set, three intra_chroma_prob L(8). |
| mv_prob_update | interframe | For i < 2, j < 19: a flag, then prob L(7) if set. |
update_segmentation
| Field | Type | When | Description |
|---|---|---|---|
| update_mb_segmentation_map | L(1) | ||
| update_segment_feature_data | L(1) | ||
| segment_feature_mode | L(1) | feature data updated | 1 absolute values; 0 deltas. |
| quantizer_update × 4 | L(1) | feature data updated | If set: quantizer_update_value L(7), quantizer_update_sign L(1). |
| loop_filter_update × 4 | L(1) | feature data updated | If set: lf_update_value L(6), lf_update_sign L(1). |
| segment_prob_update × 3 | L(1) | map updated | If set: segment_prob L(8). |
mb_lf_adjustments
| Field | Type | When | Description |
|---|---|---|---|
| loop_filter_adj_enable | L(1) | ||
| mode_ref_lf_delta_update | L(1) | enabled | |
| ref_frame_delta_update_flag × 4 | L(1) | update set | If set: delta_magnitude L(6), delta_sign L(1). |
| mb_mode_delta_update_flag × 4 | L(1) | update set | If set: delta_magnitude L(6), delta_sign L(1). |
quant_indices
| Field | Type | Description |
|---|---|---|
| y_ac_qi | L(7) | The base quantiser index. |
| y_dc_delta_present | L(1) | If set: magnitude L(4), sign L(1). |
| y2_dc_delta_present | L(1) | If set: magnitude L(4), sign L(1). |
| y2_ac_delta_present | L(1) | If set: magnitude L(4), sign L(1). |
| uv_dc_delta_present | L(1) | If set: magnitude L(4), sign L(1). |
| uv_ac_delta_present | L(1) | If set: magnitude L(4), sign L(1). |
Probabilities in the header
| Field | Type | Description |
|---|---|---|
| refresh_entropy_probs | L(1) | Whether the probabilities updated below are kept for the next frame. A WebP image has one frame, so it changes nothing. |
| coeff_prob_update | 1,056 × (B(p), then L(8)) | The coefficient probabilities are an array of 8-bit values indexed [block type 0–3][band 0–7][context 0–2][token node 0–10]. They start as the default values. For each entry in that order, a flag is read with the probability that the table coeff_update_probs gives for the same entry; if it is 1, an L(8) replaces the entry. |
| mb_no_skip_coeff | L(1) | 1 when every macroblock header carries a skip flag. |
| prob_skip_false | L(8) | When mb_no_skip_coeff is 1: the probability that a macroblock’s skip flag is 0. |
The two 1,056-entry tables (coeff_update_probs, RFC 6386 section 13.4, and the
default coeff_probs, section 13.5) and the 900-entry sub-block mode table
(kf_bmode_prob, section 11.5) are constants. All three are printed in full in the
constant tables at the end of this page; the viewer’s copy is
vp8tables.js. The probabilities and trees that are
short enough to list are given where they are used.
Macroblock header
After the frame header, the first partition holds one header for each macroblock, in raster order. All of its fields are read with the first partition’s decoder.
| Field | Type | When | Description |
|---|---|---|---|
| segment_id | tree, 3 probabilities | update_mb_segmentation_map is 1 | The macroblock’s segment, 0 to 3. Read with the tree 2, 4, −0, −1, −2, −3 and the three segment_prob values: the first bit uses segment_prob[0], and the second bit segment_prob[1] after a 0 and segment_prob[2] after a 1 (so 1 then 0 is segment 2). Without a map every macroblock is in segment 0. |
| mb_skip_coeff | B(prob_skip_false) | mb_no_skip_coeff is 1 | 1: the macroblock has no coefficients at all, so its token partition holds nothing for it. Otherwise 0. |
| intra_y_mode | tree | always | The luma prediction. The tree −B_PRED, 2, 4, 6, −DC_PRED, −V_PRED, −H_PRED, −TM_PRED with the fixed probabilities 145, 156, 163, 128. |
| intra_b_mode × 16 | tree, 9 probabilities each | intra_y_mode is B_PRED | The mode of each 4 × 4 luma sub-block in raster order, with the sub-block tree below and the probabilities kf_bmode_prob[above][left], where above and left are the modes of the neighbouring sub-blocks. |
| intra_uv_mode | tree | always | The chroma prediction, for both planes. The tree −DC_PRED, 2, −V_PRED, 4, −H_PRED, −TM_PRED with the fixed probabilities 142, 114, 183. |
| Value | Luma and chroma mode | What it predicts |
|---|---|---|
| 0 | DC_PRED | The block is filled with one value, the average of the row above and the column to the left. |
| 1 | V_PRED | Every row copies the row above. |
| 2 | H_PRED | Every column copies the column to the left. |
| 3 | TM_PRED | “True motion”: left + above − above-left, per pixel. |
| 4 | B_PRED | Luma only: each 4 × 4 sub-block has its own mode (below). Chroma has no B_PRED. |
| Value | Sub-block mode | Code in the tree |
|---|---|---|
| 0 | B_DC_PRED | 0 |
| 1 | B_TM_PRED | 10 |
| 2 | B_VE_PRED | 110 |
| 3 | B_HE_PRED | 11100 |
| 4 | B_LD_PRED | 111110 |
| 5 | B_RD_PRED | 111010 |
| 6 | B_VR_PRED | 111011 |
| 7 | B_VL_PRED | 1111110 |
| 8 | B_HD_PRED | 11111110 |
| 9 | B_HU_PRED | 11111111 |
The sub-block tree is −B_DC_PRED, 2, −B_TM_PRED, 4, −B_VE_PRED, 6, 8, 12, −B_HE_PRED, 10,
−B_RD_PRED, −B_VR_PRED, −B_LD_PRED, 14, −B_VL_PRED, 16, −B_HD_PRED, −B_HU_PRED.
Sub-block mode contexts
The above and left modes are those of the sub-blocks next to the current one, which may lie in the macroblock above or to the left. Outside the picture they are B_DC_PRED. A neighbouring macroblock that is not B_PRED counts as having a sub-block mode in every sub-block, derived from its luma mode: DC_PRED gives B_DC_PRED, V_PRED gives B_VE_PRED, H_PRED gives B_HE_PRED and TM_PRED gives B_TM_PRED.
Coefficient tokens
Each macroblock without the skip flag has up to 25 blocks of 16 coefficients in its token partition, in this order: the Y2 block (only when the luma mode is not B_PRED), the 16 luma blocks in raster order, the 4 blocks of U, the 4 blocks of V. A block is a sequence of tokens in zigzag order that ends at the end-of-block token or after position 15.
| Block type | Used for | First coefficient |
|---|---|---|
| 0 | Luma blocks of a macroblock that has a Y2 block | 1 (their DC is in the Y2 block) |
| 1 | The Y2 block: the DC values of the 16 luma blocks, transformed together | 0 |
| 2 | Chroma blocks, U and V | 0 |
| 3 | Luma blocks of a B_PRED macroblock | 0 |
The RFC lists these types in two different orders (in the text and in the pseudocode of section 13.3); the order above is the one the probability tables are laid out in and every decoder uses.
Tokens
A token is read with the tree below, using the 11 probabilities of the entry
coeff_probs[type][band][context]. The tree is
−EOB, 2, −ZERO, 4, −ONE, 6, 8, 12, −TWO, 10, −THREE, −FOUR, 14, 16, −CAT1, −CAT2, 18, 20, −CAT3, −CAT4, −CAT5, −CAT6.
After a ZERO token the end-of-block branch is skipped, since a block cannot end in a zero: the first probability
is not used and the read starts at the second node.
| Token | Value | Extra bits | Probabilities of the extra bits |
|---|---|---|---|
| ZERO, ONE, TWO, THREE, FOUR | 0 to 4 | none | |
| CAT1 | 5 to 6 | 1 | 159 |
| CAT2 | 7 to 10 | 2 | 165, 145 |
| CAT3 | 11 to 18 | 3 | 173, 148, 140 |
| CAT4 | 19 to 34 | 4 | 176, 155, 140, 135 |
| CAT5 | 35 to 66 | 5 | 180, 157, 141, 134, 130 |
| CAT6 | 67 to 2114 | 11 | 254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129 |
The extra bits are read most significant first, each with its own probability, and are added to the first value of the range. Every token but ZERO is followed by a sign read as L(1), 1 for negative. The decoded value is multiplied by the dequantisation factor and stored at the position the zigzag table gives.
| Table | Values |
|---|---|
| Zigzag: coefficient index to position in the 4 × 4 block (row by row) | 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15 |
| Band of each coefficient index 0 to 15 | 0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7 |
Context
The band is the table above, indexed by the index of the coefficient about to be read. The context, 0 to 2, is for the first coefficient of the block the number of neighbouring blocks, above and to the left in the same plane, that had at least one coefficient, and afterwards the size of the coefficient just read: 0 for a zero, 1 for a one, 2 for anything larger.
Each macroblock edge keeps these flags: four for the luma blocks, two for U, two for V and one for Y2, along the top and along the left. A neighbour outside the picture counts as having none. The Y2 flag is only changed by macroblocks that have a Y2 block, so it refers to the nearest earlier macroblock that has one. A macroblock with the skip flag sets its luma and chroma flags to 0, and its Y2 flag to 0 as well when it has a Y2 block. A block counts as having a coefficient when a token other than the end-of-block was read at or after its first coefficient position.
Dequantisation
Each segment has a base quantiser index q: the frame’s y_ac_qi, or the segment’s quantizer_update_value (added to y_ac_qi, or replacing it when segment_feature_mode is 1). The six factors are looked up with q and the deltas of the frame header, each index limited to 0 to 127:
| Factor | Value |
|---|---|
| Luma DC | dc_table[q + y_dc_delta] |
| Luma AC | ac_table[q] |
| Y2 DC | dc_table[q + y2_dc_delta] × 2 |
| Y2 AC | ac_table[q + y2_ac_delta] × 155 ÷ 100, at least 8 |
| Chroma DC | dc_table[q + uv_dc_delta], at most 132 |
| Chroma AC | ac_table[q + uv_ac_delta] |
The first coefficient of a block (index 0) is multiplied by the DC factor and the others by the AC factor. The products are held in 16 bits, and a huge product wraps round, as libwebp’s does.
dc_table (128 entries, index 0 first)
4 5 6 7 8 9 10 10 11 12 13 14 15 16 17 17 18 19 20 20 21 21 22 22 23 23
24 25 25 26 27 28 29 30 31 32 33 34 35 36 37 37 38 39 40 41 42 43 44 45 46 46
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
73 74 75 76 76 77 78 79 80 81 82 83 84 85 86 87 88 89 91 93 95 96 98 100 101 102
104 106 108 110 112 114 116 118 122 124 126 128 130 132 134 136 138 140 143 145 148 151 154 157
ac_table (128 entries)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
56 57 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104
106 108 110 112 114 116 119 122 125 128 131 134 137 140 143 146 149 152 155 158 161 164 167 170 173 177
181 185 189 193 197 201 205 209 213 217 221 225 229 234 239 245 249 254 259 264 269 274 279 284
Inverse transforms
All arithmetic is on integers. For a macroblock with a Y2 block, the dequantised Y2 coefficients (in raster order) go through the inverse Walsh-Hadamard transform, and its 16 results become coefficient 0 of the 16 luma blocks, in raster order. Then each 4 × 4 block of coefficients (in[0..15], row by row) goes through the inverse DCT and the residual is added to the prediction with the sum limited to 0 to 255.
inverse WHT (input in[0..15], outputs go to the DC of luma blocks 0 to 15):
for i in 0..3: // columns
a0 = in[i] + in[12+i]; a1 = in[4+i] + in[8+i]
a2 = in[4+i] - in[8+i]; a3 = in[i] - in[12+i]
t[i] = a0 + a1; t[8+i] = a0 - a1; t[4+i] = a3 + a2; t[12+i] = a3 - a2
for i in 0..3: // rows
dc = t[4*i] + 3
a0 = dc + t[4*i+3]; a1 = t[4*i+1] + t[4*i+2]
a2 = t[4*i+1] - t[4*i+2]; a3 = dc - t[4*i+3]
out[4*i] = (a0 + a1) >> 3; out[4*i+1] = (a3 + a2) >> 3
out[4*i+2] = (a0 - a1) >> 3; out[4*i+3] = (a3 - a2) >> 3
mul1(x) = ((x * 20091) >> 16) + x
mul2(x) = (x * 35468) >> 16
inverse DCT (in[0..15]):
for i in 0..3: // first pass
a = in[i] + in[8+i]; b = in[i] - in[8+i]
c = mul2(in[4+i]) - mul1(in[12+i]); d = mul1(in[4+i]) + mul2(in[12+i])
t[4*i] = a + d; t[4*i+1] = b + c; t[4*i+2] = b - c; t[4*i+3] = a - d
for i in 0..3: // second pass: row i of the result
dc = t[i] + 4
a = dc + t[8+i]; b = dc - t[8+i]
c = mul2(t[4+i]) - mul1(t[12+i]); d = mul1(t[4+i]) + mul2(t[12+i])
row[i] = ( (a + d) >> 3, (b + c) >> 3, (b - c) >> 3, (a - d) >> 3 )
Intra prediction
Prediction uses pixels that are already reconstructed but not yet loop-filtered. Beyond the top of the picture the row above reads 127, and beyond the left edge the column to the left reads 129, with 127 for the pixel above-left in the top row and 129 in the left column below it. The prediction is made for the whole 16 × 16 macroblock or, for B_PRED, one 4 × 4 sub-block at a time, each reconstructed (prediction plus residual) before the next is predicted.
| Mode | 16 × 16 luma and 8 × 8 chroma |
|---|---|
| DC_PRED | The average of the 16 (luma) or 8 (chroma) pixels above and to the left, rounded: (sum + 16) >> 5 for luma, (sum + 8) >> 4 for chroma. On the top row only the left column counts ((sum + 8) >> 4 luma, (sum + 4) >> 3 chroma), in the left column only the row above, and with neither the value is 128. |
| V_PRED | Each row is the row above (127 on the top row). |
| H_PRED | Each column is the column to the left (129 in the left column). |
| TM_PRED | clamp(left[y] + above[x] − aboveleft) to 0 to 255, using the border values at the edges. |
For a 4 × 4 sub-block, A to H are the 8 pixels in the row above it (A to D directly above, E to H above and to the right), I to L the 4 pixels to its left, and X the pixel above-left. P(x, y) is the predicted pixel at column x, row y, and avg2(a, b) = (a + b + 1) >> 1, avg3(a, b, c) = (a + 2b + c + 2) >> 2.
| Mode | Prediction |
|---|---|
| B_DC_PRED | (A + B + C + D + I + J + K + L + 4) >> 3 everywhere. |
| B_TM_PRED | clamp(left + above − X) as for TM_PRED. |
| B_VE_PRED | Every row is avg3(X, A, B), avg3(A, B, C), avg3(B, C, D), avg3(C, D, E). |
| B_HE_PRED | The rows are avg3(X, I, J), avg3(I, J, K), avg3(J, K, L), avg3(K, L, L), each repeated across. |
| B_LD_PRED | Diagonals down and to the left: P(0,0) = avg3(A,B,C); the anti-diagonal x + y = 1 is avg3(B,C,D), 2 is avg3(C,D,E), 3 is avg3(D,E,F), 4 is avg3(E,F,G), 5 is avg3(F,G,H); P(3,3) = avg3(G,H,H). |
| B_RD_PRED | Diagonals down and to the right, by x − y: 0 is avg3(A,X,I); 1 is avg3(B,A,X); 2 is avg3(C,B,A); 3 is avg3(D,C,B); −1 is avg3(X,I,J); −2 is avg3(I,J,K); −3 is avg3(J,K,L). |
| B_VR_PRED | P(0,0) = P(1,2) = avg2(X,A); P(1,0) = P(2,2) = avg2(A,B); P(2,0) = P(3,2) = avg2(B,C); P(3,0) = avg2(C,D); P(0,1) = P(1,3) = avg3(I,X,A); P(1,1) = P(2,3) = avg3(X,A,B); P(2,1) = P(3,3) = avg3(A,B,C); P(3,1) = avg3(B,C,D); P(0,2) = avg3(J,I,X); P(0,3) = avg3(K,J,I). |
| B_VL_PRED | P(0,0) = avg2(A,B); P(1,0) = P(0,2) = avg2(B,C); P(2,0) = P(1,2) = avg2(C,D); P(3,0) = P(2,2) = avg2(D,E); P(0,1) = avg3(A,B,C); P(1,1) = P(0,3) = avg3(B,C,D); P(2,1) = P(1,3) = avg3(C,D,E); P(3,1) = P(2,3) = avg3(D,E,F); P(3,2) = avg3(E,F,G); P(3,3) = avg3(F,G,H). |
| B_HD_PRED | P(0,0) = P(2,1) = avg2(I,X); P(0,1) = P(2,2) = avg2(J,I); P(0,2) = P(2,3) = avg2(K,J); P(0,3) = avg2(L,K); P(3,0) = avg3(A,B,C); P(2,0) = avg3(X,A,B); P(1,0) = P(3,1) = avg3(I,X,A); P(1,1) = P(3,2) = avg3(J,I,X); P(1,2) = P(3,3) = avg3(K,J,I); P(1,3) = avg3(L,K,J). |
| B_HU_PRED | P(0,0) = avg2(I,J); P(2,0) = P(0,1) = avg2(J,K); P(2,1) = P(0,2) = avg2(K,L); P(1,0) = avg3(I,J,K); P(3,0) = P(1,1) = avg3(J,K,L); P(3,1) = P(1,2) = avg3(K,L,L); and L for P(3,2), P(2,2), P(0,3), P(1,3), P(2,3), P(3,3). |
Pixels above and to the right
E to H of a sub-block in the top row of a macroblock come from the bottom row of the macroblock above and to the right (127 on the top row of the picture). For the rightmost macroblock libwebp repeats the last pixel of the row above, and so does this viewer. The sub-blocks in the right-hand column of the macroblock, rows 1 to 3, use the same four pixels as the top one, taken from the row above the macroblock. Every other sub-block uses the pixels above and to the right inside the macroblock, which are already reconstructed.
Loop filter
After the whole frame is reconstructed (rows of macroblocks may be filtered as soon as they are done), the loop filter smooths the edges between blocks, in place, macroblock by macroblock in raster order. It is off when loop_filter_level is 0. The result is both shown and, for a video, used as the reference; for a WebP image it is only shown.
Strength
For each macroblock: level is the frame’s loop_filter_level, or the segment’s loop_filter_update_value (added to it, or replacing it when segment_feature_mode is 1). With loop_filter_adj_enable set, add ref_frame_delta[0] and, for B_PRED macroblocks, mb_mode_delta[0]. Limit level to 0 to 63; a level of 0 means this macroblock is not filtered.
interior = level
if sharpness > 0: interior >>= (sharpness > 4 ? 2 : 1); interior = min(interior, 9 - sharpness)
interior = max(interior, 1)
edge_limit_mb = (level + 2) * 2 + interior // edges between macroblocks
edge_limit_inner = level * 2 + interior // edges inside a macroblock
hev_threshold = level >= 40 ? 2 : level >= 15 ? 1 : 0
Which edges
For each macroblock, in this order: the left edge (not for the leftmost macroblock), the three inner vertical edges (x = 4, 8, 12), the top edge (not for the top row) and the three inner horizontal edges. The inner edges are skipped when the macroblock is not B_PRED and has no non-zero coefficient (it was skipped, or all its coefficients came out zero). The simple filter works on luma only; the normal filter also filters the chroma planes, with edges at 0 and 4 only (x or y).
Simple filter
For each of the 16 positions along an edge, with p1, p0 the two pixels before the edge and q0, q1 the two after it, the edge is filtered when 4·|p0 − q0| + |p1 − q1| ≤ 2·limit + 1, where limit is edge_limit_mb or edge_limit_inner:
a = 3 * (q0 - p0) + clamp128(p1 - q1)
a1 = clamp(a + 4, -128, 127) >> 3; a2 = clamp(a + 3, -128, 127) >> 3
p0 = clamp255(p0 + a2); q0 = clamp255(q0 - a1)
Normal filter
An edge position is filtered when the simple condition holds with the same limit and all six differences between neighbouring pixels on each side (p3 to p0 and q0 to q3) are at most interior. A position has high edge variance when |p1 − p0| or |q1 − q0| is greater than hev_threshold. With high variance only p0 and q0 change, as in the simple filter. Otherwise: on a macroblock edge six pixels change, on an inner edge four.
macroblock edge, no high variance:
a = clamp128(3 * (q0 - p0) + clamp128(p1 - q1))
a1 = (27 * a + 63) >> 7; a2 = (18 * a + 63) >> 7; a3 = (9 * a + 63) >> 7
p2 += a3; p1 += a2; p0 += a1; q0 -= a1; q1 -= a2; q2 -= a3 (each clamped to 0..255)
inner edge, no high variance:
a = 3 * (q0 - p0)
a1 = clamp(a + 4, -128, 127) >> 3; a2 = clamp(a + 3, -128, 127) >> 3; a3 = (a1 + 1) >> 1
p1 += a3; p0 += a2; q0 -= a1; q1 -= a3 (each clamped to 0..255)
Colour conversion
The reconstructed planes are Y′ (full size) and Cb and Cr (half size, rounded up). The conversion to RGB follows Recommendation 601 (studio range); the specification lets a reader use another conversion. libwebp’s, which the viewer uses, is in fixed point:
mulhi(v, c) = (v * c) >> 8
clip(v) = v >> 6 limited to 0..255
R = clip(mulhi(Y, 19077) + mulhi(Cr, 26149) - 14234)
G = clip(mulhi(Y, 19077) - mulhi(Cb, 6419) - mulhi(Cr, 13320) + 8708)
B = clip(mulhi(Y, 19077) + mulhi(Cb, 33050) - 17685)
The chroma samples are stretched to full size before the conversion. libwebp’s default, “fancy” upsampling, gives each pixel a blend of the nearest chroma samples: a pixel is 9/16 of the nearest sample, 3/16 each of the two next nearest and 1/16 of the diagonal one, computed in integers in two steps, with the first row and column (and the last, for odd sizes) using only the samples that exist. The other choice is to repeat each chroma sample over 2 × 2 pixels. The scale bits of the key frame header (upscaling by 5/4, 5/3 or 2) are ignored by WebP readers, and so is the clamping_type: values are always clamped. A lossy image with an ALPH chunk takes its alpha from there; without one every pixel is opaque.
Constant tables
The tables a decoder needs and cannot compute are all on this page: the zigzag order and the coefficient bands
(coefficient tokens), the extra-bit probabilities of the value categories (same section), the
trees and the fixed key-frame probabilities for the luma and chroma modes (macroblock header),
the quantiser tables (dequantisation) and, below, the three large probability tables. Their values
were printed from the viewer’s copy and compared number by number with the code blocks of RFC 6386 sections 11.5, 13.4 and
13.5: 1,056 + 1,056 + 900 values, no difference. The RFC’s tables for inter frames (the mode, motion-vector and
reference-frame probabilities, vp8_mode_contexts, default_mv_context) are not needed:
a WebP image never holds an inter frame.
Every row is one entry of the array, a block type, a band and a context in the first two tables, the mode above and the mode to the left of the sub-block in the third. The coefficient tables’ block types are the ones in the table of block types (0 luma without Y2, 1 Y2, 2 chroma, 3 luma with its own DC). The sub-block modes are numbered as in the mode table: 0 B_DC_PRED, 1 B_TM_PRED, 2 B_VE_PRED, 3 B_HE_PRED, 4 B_LD_PRED, 5 B_RD_PRED, 6 B_VR_PRED, 7 B_VL_PRED, 8 B_HD_PRED, 9 B_HU_PRED.
coeff_update_probs (1,056 entries). Row label: block type, band, context; then the 11 token nodes
0 0 0: 255 255 255 255 255 255 255 255 255 255 255
0 0 1: 255 255 255 255 255 255 255 255 255 255 255
0 0 2: 255 255 255 255 255 255 255 255 255 255 255
0 1 0: 176 246 255 255 255 255 255 255 255 255 255
0 1 1: 223 241 252 255 255 255 255 255 255 255 255
0 1 2: 249 253 253 255 255 255 255 255 255 255 255
0 2 0: 255 244 252 255 255 255 255 255 255 255 255
0 2 1: 234 254 254 255 255 255 255 255 255 255 255
0 2 2: 253 255 255 255 255 255 255 255 255 255 255
0 3 0: 255 246 254 255 255 255 255 255 255 255 255
0 3 1: 239 253 254 255 255 255 255 255 255 255 255
0 3 2: 254 255 254 255 255 255 255 255 255 255 255
0 4 0: 255 248 254 255 255 255 255 255 255 255 255
0 4 1: 251 255 254 255 255 255 255 255 255 255 255
0 4 2: 255 255 255 255 255 255 255 255 255 255 255
0 5 0: 255 253 254 255 255 255 255 255 255 255 255
0 5 1: 251 254 254 255 255 255 255 255 255 255 255
0 5 2: 254 255 254 255 255 255 255 255 255 255 255
0 6 0: 255 254 253 255 254 255 255 255 255 255 255
0 6 1: 250 255 254 255 254 255 255 255 255 255 255
0 6 2: 254 255 255 255 255 255 255 255 255 255 255
0 7 0: 255 255 255 255 255 255 255 255 255 255 255
0 7 1: 255 255 255 255 255 255 255 255 255 255 255
0 7 2: 255 255 255 255 255 255 255 255 255 255 255
1 0 0: 217 255 255 255 255 255 255 255 255 255 255
1 0 1: 225 252 241 253 255 255 254 255 255 255 255
1 0 2: 234 250 241 250 253 255 253 254 255 255 255
1 1 0: 255 254 255 255 255 255 255 255 255 255 255
1 1 1: 223 254 254 255 255 255 255 255 255 255 255
1 1 2: 238 253 254 254 255 255 255 255 255 255 255
1 2 0: 255 248 254 255 255 255 255 255 255 255 255
1 2 1: 249 254 255 255 255 255 255 255 255 255 255
1 2 2: 255 255 255 255 255 255 255 255 255 255 255
1 3 0: 255 253 255 255 255 255 255 255 255 255 255
1 3 1: 247 254 255 255 255 255 255 255 255 255 255
1 3 2: 255 255 255 255 255 255 255 255 255 255 255
1 4 0: 255 253 254 255 255 255 255 255 255 255 255
1 4 1: 252 255 255 255 255 255 255 255 255 255 255
1 4 2: 255 255 255 255 255 255 255 255 255 255 255
1 5 0: 255 254 254 255 255 255 255 255 255 255 255
1 5 1: 253 255 255 255 255 255 255 255 255 255 255
1 5 2: 255 255 255 255 255 255 255 255 255 255 255
1 6 0: 255 254 253 255 255 255 255 255 255 255 255
1 6 1: 250 255 255 255 255 255 255 255 255 255 255
1 6 2: 254 255 255 255 255 255 255 255 255 255 255
1 7 0: 255 255 255 255 255 255 255 255 255 255 255
1 7 1: 255 255 255 255 255 255 255 255 255 255 255
1 7 2: 255 255 255 255 255 255 255 255 255 255 255
2 0 0: 186 251 250 255 255 255 255 255 255 255 255
2 0 1: 234 251 244 254 255 255 255 255 255 255 255
2 0 2: 251 251 243 253 254 255 254 255 255 255 255
2 1 0: 255 253 254 255 255 255 255 255 255 255 255
2 1 1: 236 253 254 255 255 255 255 255 255 255 255
2 1 2: 251 253 253 254 254 255 255 255 255 255 255
2 2 0: 255 254 254 255 255 255 255 255 255 255 255
2 2 1: 254 254 254 255 255 255 255 255 255 255 255
2 2 2: 255 255 255 255 255 255 255 255 255 255 255
2 3 0: 255 254 255 255 255 255 255 255 255 255 255
2 3 1: 254 254 255 255 255 255 255 255 255 255 255
2 3 2: 254 255 255 255 255 255 255 255 255 255 255
2 4 0: 255 255 255 255 255 255 255 255 255 255 255
2 4 1: 254 255 255 255 255 255 255 255 255 255 255
2 4 2: 255 255 255 255 255 255 255 255 255 255 255
2 5 0: 255 255 255 255 255 255 255 255 255 255 255
2 5 1: 255 255 255 255 255 255 255 255 255 255 255
2 5 2: 255 255 255 255 255 255 255 255 255 255 255
2 6 0: 255 255 255 255 255 255 255 255 255 255 255
2 6 1: 255 255 255 255 255 255 255 255 255 255 255
2 6 2: 255 255 255 255 255 255 255 255 255 255 255
2 7 0: 255 255 255 255 255 255 255 255 255 255 255
2 7 1: 255 255 255 255 255 255 255 255 255 255 255
2 7 2: 255 255 255 255 255 255 255 255 255 255 255
3 0 0: 248 255 255 255 255 255 255 255 255 255 255
3 0 1: 250 254 252 254 255 255 255 255 255 255 255
3 0 2: 248 254 249 253 255 255 255 255 255 255 255
3 1 0: 255 253 253 255 255 255 255 255 255 255 255
3 1 1: 246 253 253 255 255 255 255 255 255 255 255
3 1 2: 252 254 251 254 254 255 255 255 255 255 255
3 2 0: 255 254 252 255 255 255 255 255 255 255 255
3 2 1: 248 254 253 255 255 255 255 255 255 255 255
3 2 2: 253 255 254 254 255 255 255 255 255 255 255
3 3 0: 255 251 254 255 255 255 255 255 255 255 255
3 3 1: 245 251 254 255 255 255 255 255 255 255 255
3 3 2: 253 253 254 255 255 255 255 255 255 255 255
3 4 0: 255 251 253 255 255 255 255 255 255 255 255
3 4 1: 252 253 254 255 255 255 255 255 255 255 255
3 4 2: 255 254 255 255 255 255 255 255 255 255 255
3 5 0: 255 252 255 255 255 255 255 255 255 255 255
3 5 1: 249 255 254 255 255 255 255 255 255 255 255
3 5 2: 255 255 254 255 255 255 255 255 255 255 255
3 6 0: 255 255 253 255 255 255 255 255 255 255 255
3 6 1: 250 255 255 255 255 255 255 255 255 255 255
3 6 2: 255 255 255 255 255 255 255 255 255 255 255
3 7 0: 255 255 255 255 255 255 255 255 255 255 255
3 7 1: 254 255 255 255 255 255 255 255 255 255 255
3 7 2: 255 255 255 255 255 255 255 255 255 255 255
default_coeff_probs (1,056 entries). Row label: block type, band, context; then the 11 token nodes
0 0 0: 128 128 128 128 128 128 128 128 128 128 128
0 0 1: 128 128 128 128 128 128 128 128 128 128 128
0 0 2: 128 128 128 128 128 128 128 128 128 128 128
0 1 0: 253 136 254 255 228 219 128 128 128 128 128
0 1 1: 189 129 242 255 227 213 255 219 128 128 128
0 1 2: 106 126 227 252 214 209 255 255 128 128 128
0 2 0: 1 98 248 255 236 226 255 255 128 128 128
0 2 1: 181 133 238 254 221 234 255 154 128 128 128
0 2 2: 78 134 202 247 198 180 255 219 128 128 128
0 3 0: 1 185 249 255 243 255 128 128 128 128 128
0 3 1: 184 150 247 255 236 224 128 128 128 128 128
0 3 2: 77 110 216 255 236 230 128 128 128 128 128
0 4 0: 1 101 251 255 241 255 128 128 128 128 128
0 4 1: 170 139 241 252 236 209 255 255 128 128 128
0 4 2: 37 116 196 243 228 255 255 255 128 128 128
0 5 0: 1 204 254 255 245 255 128 128 128 128 128
0 5 1: 207 160 250 255 238 128 128 128 128 128 128
0 5 2: 102 103 231 255 211 171 128 128 128 128 128
0 6 0: 1 152 252 255 240 255 128 128 128 128 128
0 6 1: 177 135 243 255 234 225 128 128 128 128 128
0 6 2: 80 129 211 255 194 224 128 128 128 128 128
0 7 0: 1 1 255 128 128 128 128 128 128 128 128
0 7 1: 246 1 255 128 128 128 128 128 128 128 128
0 7 2: 255 128 128 128 128 128 128 128 128 128 128
1 0 0: 198 35 237 223 193 187 162 160 145 155 62
1 0 1: 131 45 198 221 172 176 220 157 252 221 1
1 0 2: 68 47 146 208 149 167 221 162 255 223 128
1 1 0: 1 149 241 255 221 224 255 255 128 128 128
1 1 1: 184 141 234 253 222 220 255 199 128 128 128
1 1 2: 81 99 181 242 176 190 249 202 255 255 128
1 2 0: 1 129 232 253 214 197 242 196 255 255 128
1 2 1: 99 121 210 250 201 198 255 202 128 128 128
1 2 2: 23 91 163 242 170 187 247 210 255 255 128
1 3 0: 1 200 246 255 234 255 128 128 128 128 128
1 3 1: 109 178 241 255 231 245 255 255 128 128 128
1 3 2: 44 130 201 253 205 192 255 255 128 128 128
1 4 0: 1 132 239 251 219 209 255 165 128 128 128
1 4 1: 94 136 225 251 218 190 255 255 128 128 128
1 4 2: 22 100 174 245 186 161 255 199 128 128 128
1 5 0: 1 182 249 255 232 235 128 128 128 128 128
1 5 1: 124 143 241 255 227 234 128 128 128 128 128
1 5 2: 35 77 181 251 193 211 255 205 128 128 128
1 6 0: 1 157 247 255 236 231 255 255 128 128 128
1 6 1: 121 141 235 255 225 227 255 255 128 128 128
1 6 2: 45 99 188 251 195 217 255 224 128 128 128
1 7 0: 1 1 251 255 213 255 128 128 128 128 128
1 7 1: 203 1 248 255 255 128 128 128 128 128 128
1 7 2: 137 1 177 255 224 255 128 128 128 128 128
2 0 0: 253 9 248 251 207 208 255 192 128 128 128
2 0 1: 175 13 224 243 193 185 249 198 255 255 128
2 0 2: 73 17 171 221 161 179 236 167 255 234 128
2 1 0: 1 95 247 253 212 183 255 255 128 128 128
2 1 1: 239 90 244 250 211 209 255 255 128 128 128
2 1 2: 155 77 195 248 188 195 255 255 128 128 128
2 2 0: 1 24 239 251 218 219 255 205 128 128 128
2 2 1: 201 51 219 255 196 186 128 128 128 128 128
2 2 2: 69 46 190 239 201 218 255 228 128 128 128
2 3 0: 1 191 251 255 255 128 128 128 128 128 128
2 3 1: 223 165 249 255 213 255 128 128 128 128 128
2 3 2: 141 124 248 255 255 128 128 128 128 128 128
2 4 0: 1 16 248 255 255 128 128 128 128 128 128
2 4 1: 190 36 230 255 236 255 128 128 128 128 128
2 4 2: 149 1 255 128 128 128 128 128 128 128 128
2 5 0: 1 226 255 128 128 128 128 128 128 128 128
2 5 1: 247 192 255 128 128 128 128 128 128 128 128
2 5 2: 240 128 255 128 128 128 128 128 128 128 128
2 6 0: 1 134 252 255 255 128 128 128 128 128 128
2 6 1: 213 62 250 255 255 128 128 128 128 128 128
2 6 2: 55 93 255 128 128 128 128 128 128 128 128
2 7 0: 128 128 128 128 128 128 128 128 128 128 128
2 7 1: 128 128 128 128 128 128 128 128 128 128 128
2 7 2: 128 128 128 128 128 128 128 128 128 128 128
3 0 0: 202 24 213 235 186 191 220 160 240 175 255
3 0 1: 126 38 182 232 169 184 228 174 255 187 128
3 0 2: 61 46 138 219 151 178 240 170 255 216 128
3 1 0: 1 112 230 250 199 191 247 159 255 255 128
3 1 1: 166 109 228 252 211 215 255 174 128 128 128
3 1 2: 39 77 162 232 172 180 245 178 255 255 128
3 2 0: 1 52 220 246 198 199 249 220 255 255 128
3 2 1: 124 74 191 243 183 193 250 221 255 255 128
3 2 2: 24 71 130 219 154 170 243 182 255 255 128
3 3 0: 1 182 225 249 219 240 255 224 128 128 128
3 3 1: 149 150 226 252 216 205 255 171 128 128 128
3 3 2: 28 108 170 242 183 194 254 223 255 255 128
3 4 0: 1 81 230 252 204 203 255 192 128 128 128
3 4 1: 123 102 209 247 188 196 255 233 128 128 128
3 4 2: 20 95 153 243 164 173 255 203 128 128 128
3 5 0: 1 222 248 255 216 213 128 128 128 128 128
3 5 1: 168 175 246 252 235 205 255 255 128 128 128
3 5 2: 47 116 215 255 211 212 255 255 128 128 128
3 6 0: 1 121 236 253 212 214 255 255 128 128 128
3 6 1: 141 84 213 252 201 202 255 219 128 128 128
3 6 2: 42 80 160 240 162 185 255 205 128 128 128
3 7 0: 1 1 255 128 128 128 128 128 128 128 128
3 7 1: 244 1 255 128 128 128 128 128 128 128 128
3 7 2: 238 1 255 128 128 128 128 128 128 128 128
kf_bmode_prob (900 entries). Row label: above mode, left mode; then the 9 tree nodes
0 0: 231 120 48 89 115 113 120 152 112
0 1: 152 179 64 126 170 118 46 70 95
0 2: 175 69 143 80 85 82 72 155 103
0 3: 56 58 10 171 218 189 17 13 152
0 4: 144 71 10 38 171 213 144 34 26
0 5: 114 26 17 163 44 195 21 10 173
0 6: 121 24 80 195 26 62 44 64 85
0 7: 170 46 55 19 136 160 33 206 71
0 8: 63 20 8 114 114 208 12 9 226
0 9: 81 40 11 96 182 84 29 16 36
1 0: 134 183 89 137 98 101 106 165 148
1 1: 72 187 100 130 157 111 32 75 80
1 2: 66 102 167 99 74 62 40 234 128
1 3: 41 53 9 178 241 141 26 8 107
1 4: 104 79 12 27 217 255 87 17 7
1 5: 74 43 26 146 73 166 49 23 157
1 6: 65 38 105 160 51 52 31 115 128
1 7: 87 68 71 44 114 51 15 186 23
1 8: 47 41 14 110 182 183 21 17 194
1 9: 66 45 25 102 197 189 23 18 22
2 0: 88 88 147 150 42 46 45 196 205
2 1: 43 97 183 117 85 38 35 179 61
2 2: 39 53 200 87 26 21 43 232 171
2 3: 56 34 51 104 114 102 29 93 77
2 4: 107 54 32 26 51 1 81 43 31
2 5: 39 28 85 171 58 165 90 98 64
2 6: 34 22 116 206 23 34 43 166 73
2 7: 68 25 106 22 64 171 36 225 114
2 8: 34 19 21 102 132 188 16 76 124
2 9: 62 18 78 95 85 57 50 48 51
3 0: 193 101 35 159 215 111 89 46 111
3 1: 60 148 31 172 219 228 21 18 111
3 2: 112 113 77 85 179 255 38 120 114
3 3: 40 42 1 196 245 209 10 25 109
3 4: 100 80 8 43 154 1 51 26 71
3 5: 88 43 29 140 166 213 37 43 154
3 6: 61 63 30 155 67 45 68 1 209
3 7: 142 78 78 16 255 128 34 197 171
3 8: 41 40 5 102 211 183 4 1 221
3 9: 51 50 17 168 209 192 23 25 82
4 0: 125 98 42 88 104 85 117 175 82
4 1: 95 84 53 89 128 100 113 101 45
4 2: 75 79 123 47 51 128 81 171 1
4 3: 57 17 5 71 102 57 53 41 49
4 4: 115 21 2 10 102 255 166 23 6
4 5: 38 33 13 121 57 73 26 1 85
4 6: 41 10 67 138 77 110 90 47 114
4 7: 101 29 16 10 85 128 101 196 26
4 8: 57 18 10 102 102 213 34 20 43
4 9: 117 20 15 36 163 128 68 1 26
5 0: 138 31 36 171 27 166 38 44 229
5 1: 67 87 58 169 82 115 26 59 179
5 2: 63 59 90 180 59 166 93 73 154
5 3: 40 40 21 116 143 209 34 39 175
5 4: 57 46 22 24 128 1 54 17 37
5 5: 47 15 16 183 34 223 49 45 183
5 6: 46 17 33 183 6 98 15 32 183
5 7: 65 32 73 115 28 128 23 128 205
5 8: 40 3 9 115 51 192 18 6 223
5 9: 87 37 9 115 59 77 64 21 47
6 0: 104 55 44 218 9 54 53 130 226
6 1: 64 90 70 205 40 41 23 26 57
6 2: 54 57 112 184 5 41 38 166 213
6 3: 30 34 26 133 152 116 10 32 134
6 4: 75 32 12 51 192 255 160 43 51
6 5: 39 19 53 221 26 114 32 73 255
6 6: 31 9 65 234 2 15 1 118 73
6 7: 88 31 35 67 102 85 55 186 85
6 8: 56 21 23 111 59 205 45 37 192
6 9: 55 38 70 124 73 102 1 34 98
7 0: 102 61 71 37 34 53 31 243 192
7 1: 69 60 71 38 73 119 28 222 37
7 2: 68 45 128 34 1 47 11 245 171
7 3: 62 17 19 70 146 85 55 62 70
7 4: 75 15 9 9 64 255 184 119 16
7 5: 37 43 37 154 100 163 85 160 1
7 6: 63 9 92 136 28 64 32 201 85
7 7: 86 6 28 5 64 255 25 248 1
7 8: 56 8 17 132 137 255 55 116 128
7 9: 58 15 20 82 135 57 26 121 40
8 0: 164 50 31 137 154 133 25 35 218
8 1: 51 103 44 131 131 123 31 6 158
8 2: 86 40 64 135 148 224 45 183 128
8 3: 22 26 17 131 240 154 14 1 209
8 4: 83 12 13 54 192 255 68 47 28
8 5: 45 16 21 91 64 222 7 1 197
8 6: 56 21 39 155 60 138 23 102 213
8 7: 85 26 85 85 128 128 32 146 171
8 8: 18 11 7 63 144 171 4 4 246
8 9: 35 27 10 146 174 171 12 26 128
9 0: 190 80 35 99 180 80 126 54 45
9 1: 85 126 47 87 176 51 41 20 32
9 2: 101 75 128 139 118 146 116 128 85
9 3: 56 41 15 176 236 85 37 9 62
9 4: 146 36 19 30 171 255 97 27 20
9 5: 71 30 17 119 118 255 17 18 138
9 6: 101 38 60 138 55 70 43 26 142
9 7: 138 45 61 62 219 1 81 188 64
9 8: 32 41 20 117 151 142 20 21 163
9 9: 112 19 12 61 195 128 48 4 24