yading@10
|
1 /*
|
yading@10
|
2 * VC-1 and WMV3 decoder
|
yading@10
|
3 * copyright (c) 2006 Konstantin Shishkov
|
yading@10
|
4 * (c) 2005 anonymous, Alex Beregszaszi, Michael Niedermayer
|
yading@10
|
5 *
|
yading@10
|
6 * This file is part of FFmpeg.
|
yading@10
|
7 *
|
yading@10
|
8 * FFmpeg is free software; you can redistribute it and/or
|
yading@10
|
9 * modify it under the terms of the GNU Lesser General Public
|
yading@10
|
10 * License as published by the Free Software Foundation; either
|
yading@10
|
11 * version 2.1 of the License, or (at your option) any later version.
|
yading@10
|
12 *
|
yading@10
|
13 * FFmpeg is distributed in the hope that it will be useful,
|
yading@10
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
yading@10
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
yading@10
|
16 * Lesser General Public License for more details.
|
yading@10
|
17 *
|
yading@10
|
18 * You should have received a copy of the GNU Lesser General Public
|
yading@10
|
19 * License along with FFmpeg; if not, write to the Free Software
|
yading@10
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
yading@10
|
21 */
|
yading@10
|
22
|
yading@10
|
23 /**
|
yading@10
|
24 * @file
|
yading@10
|
25 * VC-1 tables.
|
yading@10
|
26 */
|
yading@10
|
27
|
yading@10
|
28 #ifndef AVCODEC_VC1DATA_H
|
yading@10
|
29 #define AVCODEC_VC1DATA_H
|
yading@10
|
30
|
yading@10
|
31 #include <stdint.h>
|
yading@10
|
32 #include "libavutil/rational.h"
|
yading@10
|
33 #include "get_bits.h"
|
yading@10
|
34
|
yading@10
|
35 /** Table for conversion between TTBLK and TTMB */
|
yading@10
|
36 extern const int ff_vc1_ttblk_to_tt[3][8];
|
yading@10
|
37
|
yading@10
|
38 extern const int ff_vc1_ttfrm_to_tt[4];
|
yading@10
|
39
|
yading@10
|
40 /** MV P mode - the 5th element is only used for mode 1 */
|
yading@10
|
41 extern const uint8_t ff_vc1_mv_pmode_table[2][5];
|
yading@10
|
42 extern const uint8_t ff_vc1_mv_pmode_table2[2][4];
|
yading@10
|
43
|
yading@10
|
44 extern const int ff_vc1_fps_nr[7], ff_vc1_fps_dr[2];
|
yading@10
|
45 extern const uint8_t ff_vc1_pquant_table[3][32];
|
yading@10
|
46
|
yading@10
|
47 /* MBMODE table for interlaced frame P-picture */
|
yading@10
|
48 extern const uint8_t ff_vc1_mbmode_intfrp[2][15][4];
|
yading@10
|
49
|
yading@10
|
50 /** @name VC-1 VLC tables and defines
|
yading@10
|
51 * @todo TODO move this into the context
|
yading@10
|
52 */
|
yading@10
|
53 //@{
|
yading@10
|
54 #define VC1_BFRACTION_VLC_BITS 7
|
yading@10
|
55 extern VLC ff_vc1_bfraction_vlc;
|
yading@10
|
56 #define VC1_IMODE_VLC_BITS 4
|
yading@10
|
57 extern VLC ff_vc1_imode_vlc;
|
yading@10
|
58 #define VC1_NORM2_VLC_BITS 3
|
yading@10
|
59 extern VLC ff_vc1_norm2_vlc;
|
yading@10
|
60 #define VC1_NORM6_VLC_BITS 9
|
yading@10
|
61 extern VLC ff_vc1_norm6_vlc;
|
yading@10
|
62 /* Could be optimized, one table only needs 8 bits */
|
yading@10
|
63 #define VC1_TTMB_VLC_BITS 9 //12
|
yading@10
|
64 extern VLC ff_vc1_ttmb_vlc[3];
|
yading@10
|
65 #define VC1_MV_DIFF_VLC_BITS 9 //15
|
yading@10
|
66 extern VLC ff_vc1_mv_diff_vlc[4];
|
yading@10
|
67 #define VC1_CBPCY_P_VLC_BITS 9 //14
|
yading@10
|
68 extern VLC ff_vc1_cbpcy_p_vlc[4];
|
yading@10
|
69 #define VC1_ICBPCY_VLC_BITS 9
|
yading@10
|
70 extern VLC ff_vc1_icbpcy_vlc[8];
|
yading@10
|
71 #define VC1_4MV_BLOCK_PATTERN_VLC_BITS 6
|
yading@10
|
72 extern VLC ff_vc1_4mv_block_pattern_vlc[4];
|
yading@10
|
73 #define VC1_2MV_BLOCK_PATTERN_VLC_BITS 3
|
yading@10
|
74 extern VLC ff_vc1_2mv_block_pattern_vlc[4];
|
yading@10
|
75 #define VC1_TTBLK_VLC_BITS 5
|
yading@10
|
76 extern VLC ff_vc1_ttblk_vlc[3];
|
yading@10
|
77 #define VC1_SUBBLKPAT_VLC_BITS 6
|
yading@10
|
78 extern VLC ff_vc1_subblkpat_vlc[3];
|
yading@10
|
79 #define VC1_INTFR_4MV_MBMODE_VLC_BITS 9
|
yading@10
|
80 extern VLC ff_vc1_intfr_4mv_mbmode_vlc[4];
|
yading@10
|
81 #define VC1_INTFR_NON4MV_MBMODE_VLC_BITS 6
|
yading@10
|
82 extern VLC ff_vc1_intfr_non4mv_mbmode_vlc[4];
|
yading@10
|
83 #define VC1_IF_MMV_MBMODE_VLC_BITS 5
|
yading@10
|
84 extern VLC ff_vc1_if_mmv_mbmode_vlc[8];
|
yading@10
|
85 #define VC1_IF_1MV_MBMODE_VLC_BITS 5
|
yading@10
|
86 extern VLC ff_vc1_if_1mv_mbmode_vlc[8];
|
yading@10
|
87 #define VC1_1REF_MVDATA_VLC_BITS 9
|
yading@10
|
88 extern VLC ff_vc1_1ref_mvdata_vlc[4];
|
yading@10
|
89 #define VC1_2REF_MVDATA_VLC_BITS 9
|
yading@10
|
90 extern VLC ff_vc1_2ref_mvdata_vlc[8];
|
yading@10
|
91
|
yading@10
|
92 extern VLC ff_vc1_ac_coeff_table[8];
|
yading@10
|
93
|
yading@10
|
94 #define VC1_IF_MBMODE_VLC_BITS 5
|
yading@10
|
95 //@}
|
yading@10
|
96
|
yading@10
|
97
|
yading@10
|
98 /* Denominator used for ff_vc1_bfraction_lut */
|
yading@10
|
99 #define B_FRACTION_DEN 256
|
yading@10
|
100
|
yading@10
|
101 /* pre-computed scales for all bfractions and base=256 */
|
yading@10
|
102 extern const int16_t ff_vc1_bfraction_lut[23];
|
yading@10
|
103 extern const uint8_t ff_vc1_bfraction_bits[23];
|
yading@10
|
104 extern const uint8_t ff_vc1_bfraction_codes[23];
|
yading@10
|
105
|
yading@10
|
106 //Same as H.264
|
yading@10
|
107 extern const AVRational ff_vc1_pixel_aspect[16];
|
yading@10
|
108
|
yading@10
|
109 /* BitPlane IMODE - such a small table... */
|
yading@10
|
110 extern const uint8_t ff_vc1_imode_codes[7];
|
yading@10
|
111 extern const uint8_t ff_vc1_imode_bits[7];
|
yading@10
|
112
|
yading@10
|
113 /* Normal-2 imode */
|
yading@10
|
114 extern const uint8_t ff_vc1_norm2_codes[4];
|
yading@10
|
115 extern const uint8_t ff_vc1_norm2_bits[4];
|
yading@10
|
116 extern const uint16_t ff_vc1_norm6_codes[64];
|
yading@10
|
117 extern const uint8_t ff_vc1_norm6_bits[64];
|
yading@10
|
118 /* Normal-6 imode */
|
yading@10
|
119 extern const uint8_t ff_vc1_norm6_spec[64][5];
|
yading@10
|
120
|
yading@10
|
121 /* 4MV Block pattern VLC tables */
|
yading@10
|
122 extern const uint8_t ff_vc1_4mv_block_pattern_codes[4][16];
|
yading@10
|
123 extern const uint8_t ff_vc1_4mv_block_pattern_bits[4][16];
|
yading@10
|
124
|
yading@10
|
125 /* 2MV Block pattern VLC tables */
|
yading@10
|
126 extern const uint8_t ff_vc1_2mv_block_pattern_codes[4][4];
|
yading@10
|
127 extern const uint8_t ff_vc1_2mv_block_pattern_bits[4][4];
|
yading@10
|
128
|
yading@10
|
129 extern const uint8_t ff_wmv3_dc_scale_table[32];
|
yading@10
|
130
|
yading@10
|
131 /* P-Picture CBPCY VLC tables */
|
yading@10
|
132 extern const uint16_t ff_vc1_cbpcy_p_codes[4][64];
|
yading@10
|
133 extern const uint8_t ff_vc1_cbpcy_p_bits[4][64];
|
yading@10
|
134
|
yading@10
|
135 /* Interlaced CBPCY VLC tables (Table 124 - Table 131) */
|
yading@10
|
136 extern const uint16_t ff_vc1_icbpcy_p_codes[8][63];
|
yading@10
|
137 extern const uint8_t ff_vc1_icbpcy_p_bits[8][63];
|
yading@10
|
138
|
yading@10
|
139 /* MacroBlock Transform Type: 7.1.3.11, p89
|
yading@10
|
140 * 8x8:B
|
yading@10
|
141 * 8x4:B:btm 8x4:B:top 8x4:B:both,
|
yading@10
|
142 * 4x8:B:right 4x8:B:left 4x8:B:both
|
yading@10
|
143 * 4x4:B 8x8:MB
|
yading@10
|
144 * 8x4:MB:btm 8x4:MB:top 8x4,MB,both
|
yading@10
|
145 * 4x8,MB,right 4x8,MB,left
|
yading@10
|
146 * 4x4,MB */
|
yading@10
|
147 extern const uint16_t ff_vc1_ttmb_codes[3][16];
|
yading@10
|
148
|
yading@10
|
149 extern const uint8_t ff_vc1_ttmb_bits[3][16];
|
yading@10
|
150
|
yading@10
|
151 /* TTBLK (Transform Type per Block) tables */
|
yading@10
|
152 extern const uint8_t ff_vc1_ttblk_codes[3][8];
|
yading@10
|
153 extern const uint8_t ff_vc1_ttblk_bits[3][8];
|
yading@10
|
154
|
yading@10
|
155 /* SUBBLKPAT tables, p93-94, reordered */
|
yading@10
|
156 extern const uint8_t ff_vc1_subblkpat_codes[3][15];
|
yading@10
|
157 extern const uint8_t ff_vc1_subblkpat_bits[3][15];
|
yading@10
|
158
|
yading@10
|
159 /* MV differential tables, p265 */
|
yading@10
|
160 extern const uint16_t ff_vc1_mv_diff_codes[4][73];
|
yading@10
|
161 extern const uint8_t ff_vc1_mv_diff_bits[4][73];
|
yading@10
|
162
|
yading@10
|
163 /* Interlaced frame picture MBMODE VLC tables (p. 246, p. 360) */
|
yading@10
|
164 extern const uint16_t ff_vc1_intfr_4mv_mbmode_codes[4][15];
|
yading@10
|
165 extern const uint8_t ff_vc1_intfr_4mv_mbmode_bits[4][15];
|
yading@10
|
166 extern const uint8_t ff_vc1_intfr_non4mv_mbmode_codes[4][9];
|
yading@10
|
167 extern const uint8_t ff_vc1_intfr_non4mv_mbmode_bits[4][9];
|
yading@10
|
168
|
yading@10
|
169 /* Interlaced field picture MBMODE VLC tables (p. 356 - 11.4.1, 11.4.2) */
|
yading@10
|
170 extern const uint8_t ff_vc1_if_mmv_mbmode_codes[8][8];
|
yading@10
|
171 extern const uint8_t ff_vc1_if_mmv_mbmode_bits[8][8];
|
yading@10
|
172 extern const uint8_t ff_vc1_if_1mv_mbmode_codes[8][6];
|
yading@10
|
173 extern const uint8_t ff_vc1_if_1mv_mbmode_bits[8][6];
|
yading@10
|
174
|
yading@10
|
175 /* Interlaced frame/field picture MVDATA VLC tables */
|
yading@10
|
176 /* 1-reference tables */
|
yading@10
|
177 extern const uint32_t ff_vc1_1ref_mvdata_codes[4][72];
|
yading@10
|
178 extern const uint8_t ff_vc1_1ref_mvdata_bits[4][72];
|
yading@10
|
179 /* 2-reference tables */
|
yading@10
|
180 extern const uint32_t ff_vc1_2ref_mvdata_codes[8][126];
|
yading@10
|
181 extern const uint8_t ff_vc1_2ref_mvdata_bits[8][126];
|
yading@10
|
182
|
yading@10
|
183 /* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */
|
yading@10
|
184
|
yading@10
|
185 /* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */
|
yading@10
|
186 extern const uint8_t ff_vc1_simple_progressive_4x4_zz [16];
|
yading@10
|
187 extern const uint8_t ff_vc1_adv_progressive_8x4_zz [32];
|
yading@10
|
188 extern const uint8_t ff_vc1_adv_progressive_4x8_zz [32];
|
yading@10
|
189 extern const uint8_t ff_vc1_adv_interlaced_8x8_zz [64];
|
yading@10
|
190 extern const uint8_t ff_vc1_adv_interlaced_8x4_zz [32];
|
yading@10
|
191 extern const uint8_t ff_vc1_adv_interlaced_4x8_zz [32];
|
yading@10
|
192 extern const uint8_t ff_vc1_adv_interlaced_4x4_zz [16];
|
yading@10
|
193 extern const uint8_t ff_vc1_intra_horz_8x8_zz [64];
|
yading@10
|
194 extern const uint8_t ff_vc1_intra_vert_8x8_zz [64];
|
yading@10
|
195
|
yading@10
|
196 /* DQScale as specified in 8.1.3.9 - almost identical to 0x40000/i */
|
yading@10
|
197 extern const int32_t ff_vc1_dqscale[63];
|
yading@10
|
198
|
yading@10
|
199 /* P Interlaced field picture MV predictor scaling values (Table 114) */
|
yading@10
|
200 extern const uint16_t ff_vc1_field_mvpred_scales[2][7][4];
|
yading@10
|
201 /* B Interlaced field picture backward MV predictor scaling values for first field (Table 115) */
|
yading@10
|
202 extern const uint16_t ff_vc1_b_field_mvpred_scales[7][4];
|
yading@10
|
203
|
yading@10
|
204 #define AC_MODES 8
|
yading@10
|
205
|
yading@10
|
206 extern const int ff_vc1_ac_sizes[AC_MODES];
|
yading@10
|
207
|
yading@10
|
208 #endif /* AVCODEC_VC1DATA_H */
|