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