annotate rv40data.h @ 6582:7d40da88f0c7 libavcodec

Crop parameters are unsigned, having them negative could be bad and lead to crashes or maybe exploits (not checked at all if this is possible).
author michael
date Fri, 11 Apr 2008 12:57:49 +0000
parents 266b2501216a
children c4a4495715dd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5937
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
1 /*
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
2 * RealVideo 4 decoder
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
3 * copyright (c) 2007 Konstantin Shishkov
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
4 *
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
5 * This file is part of FFmpeg.
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
6 *
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
11 *
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
15 * Lesser General Public License for more details.
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
16 *
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
20 */
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
21
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
22 /**
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
23 * @file rv40data.h
5943
337a95c66190 spelling cosmetics
diego
parents: 5937
diff changeset
24 * miscellaneous RV40 tables
5937
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
25 */
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
26
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
27 #ifndef FFMPEG_RV40DATA_H
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
28 #define FFMPEG_RV40DATA_H
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
29
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
30 #include <stdint.h>
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
31
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
32 /**
5943
337a95c66190 spelling cosmetics
diego
parents: 5937
diff changeset
33 * standard widths and heights coded in RV40
5937
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
34 */
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
35 //@{
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
36 static const int rv40_standard_widths[] = { 160, 172, 240, 320, 352, 640, 704, 0};
5990
266b2501216a Update tables for RV40 decoder
kostya
parents: 5943
diff changeset
37 static const int rv40_standard_heights[] = { 120, 132, 144, 240, 288, 480, -8, -10, 180, 360, 576, 0};
5937
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
38 //@}
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
39
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
40 #define MODE2_PATTERNS_NUM 20
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
41 /**
5943
337a95c66190 spelling cosmetics
diego
parents: 5937
diff changeset
42 * intra types table
5937
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
43 *
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
44 * These values are actually coded 3-tuples
5943
337a95c66190 spelling cosmetics
diego
parents: 5937
diff changeset
45 * used for detecting standard block configurations.
5937
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
46 */
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
47 static const uint16_t rv40_aic_table_index[MODE2_PATTERNS_NUM] = {
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
48 0x000, 0x100, 0x200,
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
49 0x011, 0x111, 0x211, 0x511, 0x611,
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
50 0x022, 0x122, 0x222, 0x722,
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
51 0x272, 0x227,
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
52 0x822, 0x282, 0x228,
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
53 0x112, 0x116, 0x221
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
54 };
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
55
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
56 /**
5943
337a95c66190 spelling cosmetics
diego
parents: 5937
diff changeset
57 * luma quantizer values
337a95c66190 spelling cosmetics
diego
parents: 5937
diff changeset
58 * The second table is used for inter blocks.
5937
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
59 */
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
60 static const uint8_t rv40_luma_dc_quant[2][32] = {
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
61 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
62 16, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 22, 22, 22, 22 },
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
63 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
64 16, 17, 18, 19, 20, 20, 21, 21, 22, 23, 23, 23, 24, 24, 24, 24 }
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
65 };
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
66
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
67 /**
5943
337a95c66190 spelling cosmetics
diego
parents: 5937
diff changeset
68 * @begingroup loopfilter coefficients used by the RV40 loop filter
5937
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
69 * @{
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
70 */
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
71 /**
5943
337a95c66190 spelling cosmetics
diego
parents: 5937
diff changeset
72 * dither values for deblocking filter - left/top values
5937
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
73 */
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
74 static const uint8_t rv40_dither_l[16] = {
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
75 0x40, 0x50, 0x20, 0x60, 0x30, 0x50, 0x40, 0x30,
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
76 0x50, 0x40, 0x50, 0x30, 0x60, 0x20, 0x50, 0x40
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
77 };
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
78 /**
5943
337a95c66190 spelling cosmetics
diego
parents: 5937
diff changeset
79 * dither values for deblocking filter - right/bottom values
5937
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
80 */
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
81 static const uint8_t rv40_dither_r[16] = {
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
82 0x40, 0x30, 0x60, 0x20, 0x50, 0x30, 0x30, 0x40,
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
83 0x40, 0x40, 0x50, 0x30, 0x20, 0x60, 0x30, 0x40
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
84 };
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
85
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
86 /** alpha parameter for RV40 loop filter - almost the same as in JVT-A003r1 */
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
87 static const uint8_t rv40_alpha_tab[32] = {
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
88 128, 128, 128, 128, 128, 128, 128, 128,
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
89 128, 128, 122, 96, 75, 59, 47, 37,
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
90 29, 23, 18, 15, 13, 11, 10, 9,
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
91 8, 7, 6, 5, 4, 3, 2, 1
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
92 };
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
93 /** beta parameter for RV40 loop filter - almost the same as in JVT-A003r1 */
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
94 static const uint8_t rv40_beta_tab[32] = {
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
95 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 4, 4, 4, 6, 6,
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
96 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 13, 14, 15, 16, 17
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
97 };
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
98 /** clip table for RV40 loop filter - the same as in JVT-A003r1 */
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
99 static const uint8_t rv40_filter_clip_tbl[3][32] = {
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
100 {
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
101 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
102 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
103 },
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
104 {
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
105 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
106 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 5, 5
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
107 },
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
108 {
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
109 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
110 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 7, 8, 9
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
111 }
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
112 };
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
113 /** @} */ // end loopfilter group
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
114
7b5731b088ed Data tables for future RV30/40 decoder
kostya
parents:
diff changeset
115 #endif /* FFMPEG_RV40DATA_H */