ws-video-vp8: VP8 inter frames (libvpx 1.17 port): references, modes / motion vectors, split, six-tap / bilinear prediction, inter loop filter levels, hidden frames, reset; tests vs ffmpeg on 27 test vectors + 24 libvpx clips

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
4DBugandClaude Opus 5.5 committed 2026-10-31 09:46:45 -05:00
1 parent 75c677074a
commit aff15e7cc9
36 files changed
+1338 -161

No files matched your search

+70 -1
View File
@@ -1,6 +1,9 @@
--!strict
-- codecs/Vp8/Tables: the constant VP8 tables of RFC 6386 (sections 13.5, 13.4, 11.5, 14.1), copied from libwebp 1.6
-- src/dec/tree_dec.c and src/dec/quant_dec.c (BSD-3-Clause, licenses/libwebp-LICENSE.txt). Flat 1-based arrays.
-- src/dec/tree_dec.c and src/dec/quant_dec.c (BSD-3-Clause, licenses/libwebp-LICENSE.txt); the inter frame tables
-- (sections 16-18: mode / motion vector probabilities, mode contexts, split partitions, sub-pixel filters) from
-- libvpx 1.17 vp8/common (entropymode.c, vp8_entropymodedata.h, entropymv.c, modecont.c, decodemv.c, filter.c;
-- BSD-3-Clause, licenses/libvpx-LICENSE.txt). Flat 1-based arrays.
local Tables = {}
-- default token probabilities [type 4][band 8][ctx 3][proba 11]: index ((t * 8 + b) * 3 + c) * 11 + p + 1
@@ -177,4 +180,70 @@ Tables.CAT4 = { 176, 155, 140, 135 }
Tables.CAT5 = { 180, 157, 141, 134, 130 }
Tables.CAT6 = { 254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129 }
-- inter frames: default intra mode probabilities (16x16 / chroma, kept in the frame context) and the fixed 4x4 ones
Tables.YMODE_PROB = { 112, 86, 140, 37 }
Tables.UVMODE_PROB = { 162, 101, 204 }
Tables.BMODE_PROB = { 120, 90, 79, 133, 87, 85, 80, 111, 151 }
-- motion vector probabilities, row then column (19 each): is short, sign, short tree (7), long bits (10)
Tables.MV_DEFAULT = {
162, 128, 225, 146, 172, 147, 214, 39, 156, 128, 129, 132, 75, 145, 178, 206, 239, 254, 254,
164, 128, 204, 170, 119, 235, 140, 230, 228, 128, 130, 130, 74, 148, 180, 203, 236, 254, 254,
}
Tables.MV_UPDATE = {
237, 246, 253, 253, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 250, 250, 252, 254, 254,
231, 243, 245, 253, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 251, 251, 254, 254, 254,
}
-- mode contexts [count 0..5][tree node 0..3]: index count * 4 + node + 1
Tables.MODE_CONTEXTS = {
7, 1, 1, 143,
14, 18, 14, 107,
135, 64, 57, 68,
60, 56, 128, 65,
159, 134, 128, 34,
234, 188, 128, 28,
}
-- sub-block motion vector reference probabilities [(above zero << 2) | (left zero << 1) | (left == above)][3]
Tables.SUB_MV_REF_PROB = {
147, 136, 18,
223, 1, 34,
106, 145, 1,
208, 1, 1,
179, 121, 1,
223, 1, 34,
179, 121, 1,
208, 1, 1,
}
-- split partitions (16x8, 8x16, 8x8, 4x4): the first block of each partition [s * 16 + j + 1], the blocks of each
-- partition in order [s * 16 + j * count + i + 1], and the number of blocks per partition
Tables.SPLIT_OFFSET = {
0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 2, 8, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
}
Tables.SPLIT_FILL = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15,
0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
}
Tables.SPLIT_COUNT = { 8, 8, 4, 1 }
-- the six-tap sub-pixel filters [fraction 0..7][tap 0..5] and the bilinear ones [fraction][2] (versions 1-3)
Tables.SIXTAP = {
0, 0, 128, 0, 0, 0,
0, -6, 123, 12, -1, 0,
2, -11, 108, 36, -8, 1,
0, -9, 93, 50, -6, 0,
3, -16, 77, 77, -16, 3,
0, -6, 50, 93, -9, 0,
1, -8, 36, 108, -11, 2,
0, -1, 12, 123, -6, 0,
}
Tables.BILINEAR = { 128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112 }
return Tables