From 0ad72bdd5cb493df78c660b9859a8b890018926a Mon Sep 17 00:00:00 2001 From: Mike Melanson Date: Tue, 17 May 2005 23:39:23 +0000 Subject: use VLCs for in place of get_fragment_run_length(), get_mode_code(), and get_motion_vector_vlc() Originally committed as revision 4266 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/vp3data.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'libavcodec/vp3data.h') diff --git a/libavcodec/vp3data.h b/libavcodec/vp3data.h index df80e39a16..5a5ff9cac5 100644 --- a/libavcodec/vp3data.h +++ b/libavcodec/vp3data.h @@ -72,6 +72,76 @@ static const uint32_t vp31_filter_limit_values[64] = 0, 0, 0, 0, 0, 0, 0, 0 }; +static const uint16_t fragment_run_length_vlc_table[30][2] = { + /* 1 -> 2 */ + { 0x0, 2 }, { 0x1, 2 }, + + /* 3 -> 4 */ + { 0x4, 3 }, { 0x5, 3 }, + + /* 5 -> 6 */ + { 0xC, 4 }, { 0xD, 4 }, + + /* 7 -> 10 */ + { 0x38, 6 }, { 0x39, 6 }, + { 0x3A, 6 }, { 0x3B, 6 }, + + /* 11 -> 14 */ + { 0x78, 7 }, { 0x79, 7 }, + { 0x7A, 7 }, { 0x7B, 7 }, + + /* 15 -> 30 */ + { 0x1F0, 9 }, { 0x1F1, 9 }, { 0x1F2, 9 }, { 0x1F3, 9 }, + { 0x1F4, 9 }, { 0x1F5, 9 }, { 0x1F6, 9 }, { 0x1F7, 9 }, + { 0x1F8, 9 }, { 0x1F9, 9 }, { 0x1FA, 9 }, { 0x1FB, 9 }, + { 0x1FC, 9 }, { 0x1FD, 9 }, { 0x1FE, 9 }, { 0x1FF, 9 } +}; + +static const uint8_t mode_code_vlc_table[30][2] = { + { 0, 1 }, { 2, 2 }, + { 6, 3 }, { 14, 4 }, + { 30, 5 }, { 62, 6 }, + { 126, 7 }, { 127, 7 } +}; + +static const uint8_t motion_vector_vlc_table[63][2] = { + { 0, 3 }, + { 1, 3 }, + { 2, 3 }, + + { 6, 4 }, { 7, 4 }, + + { 8, 4 }, { 9, 4 }, + + { 40, 6 }, { 41, 6 }, { 42, 6 }, { 43, 6 }, + { 44, 6 }, { 45, 6 }, { 46, 6 }, { 47, 6 }, + + { 96, 7 }, { 97, 7 }, { 98, 7 }, { 99, 7 }, + { 100, 7 }, { 101, 7 }, { 102, 7 }, { 103, 7 }, + { 104, 7 }, { 105, 7 }, { 106, 7 }, { 107, 7 }, + { 108, 7 }, { 109, 7 }, { 110, 7 }, { 111, 7 }, + + { 0xE0, 8 }, { 0xE1, 8 }, { 0xE2, 8 }, { 0xE3, 8 }, + { 0xE4, 8 }, { 0xE5, 8 }, { 0xE6, 8 }, { 0xE7, 8 }, + { 0xE8, 8 }, { 0xE9, 8 }, { 0xEA, 8 }, { 0xEB, 8 }, + { 0xEC, 8 }, { 0xED, 8 }, { 0xEE, 8 }, { 0xEF, 8 }, + + { 0xF0, 8 }, { 0xF1, 8 }, { 0xF2, 8 }, { 0xF3, 8 }, + { 0xF4, 8 }, { 0xF5, 8 }, { 0xF6, 8 }, { 0xF7, 8 }, + { 0xF8, 8 }, { 0xF9, 8 }, { 0xFA, 8 }, { 0xFB, 8 }, + { 0xFC, 8 }, { 0xFD, 8 }, { 0xFE, 8 }, { 0xFF, 8 } +}; + +static const int motion_vector_table[63] = { + 0, 1, -1, + 2, -2, + 3, -3, + 4, -4, 5, -5, 6, -6, 7, -7, + 8, -8, 9, -9, 10, -10, 11, -11, 12, -12, 13, -13, 14, -14, 15, -15, + 16, -16, 17, -17, 18, -18, 19, -19, 20, -20, 21, -21, 22, -22, 23, -23, + 24, -24, 25, -25, 26, -26, 27, -27, 28, -28, 29, -29, 30, -30, 31, -31 +}; + static const uint16_t dc_bias[16][32][2] = { { /* DC bias table 0 */ { 0x2D, 6 }, -- cgit v1.2.3