Imported Debian version 2.5.3~trusty1
[deb_ffmpeg.git] / ffmpeg / libavcodec / vc1data.h
... / ...
CommitLineData
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#include "libavutil/rational.h"
33#include "get_bits.h"
34
35/** Table for conversion between TTBLK and TTMB */
36extern const int ff_vc1_ttblk_to_tt[3][8];
37
38extern const int ff_vc1_ttfrm_to_tt[4];
39
40/** MV P mode - the 5th element is only used for mode 1 */
41extern const uint8_t ff_vc1_mv_pmode_table[2][5];
42extern const uint8_t ff_vc1_mv_pmode_table2[2][4];
43
44extern const int ff_vc1_fps_nr[7], ff_vc1_fps_dr[2];
45extern const uint8_t ff_vc1_pquant_table[3][32];
46
47/* MBMODE table for interlaced frame P-picture */
48extern const uint8_t ff_vc1_mbmode_intfrp[2][15][4];
49
50/** @name VC-1 VLC tables and defines
51 * @todo TODO move this into the context
52 */
53//@{
54#define VC1_BFRACTION_VLC_BITS 7
55extern VLC ff_vc1_bfraction_vlc;
56#define VC1_IMODE_VLC_BITS 4
57extern VLC ff_vc1_imode_vlc;
58#define VC1_NORM2_VLC_BITS 3
59extern VLC ff_vc1_norm2_vlc;
60#define VC1_NORM6_VLC_BITS 9
61extern VLC ff_vc1_norm6_vlc;
62/* Could be optimized, one table only needs 8 bits */
63#define VC1_TTMB_VLC_BITS 9 //12
64extern VLC ff_vc1_ttmb_vlc[3];
65#define VC1_MV_DIFF_VLC_BITS 9 //15
66extern VLC ff_vc1_mv_diff_vlc[4];
67#define VC1_CBPCY_P_VLC_BITS 9 //14
68extern VLC ff_vc1_cbpcy_p_vlc[4];
69#define VC1_ICBPCY_VLC_BITS 9
70extern VLC ff_vc1_icbpcy_vlc[8];
71#define VC1_4MV_BLOCK_PATTERN_VLC_BITS 6
72extern VLC ff_vc1_4mv_block_pattern_vlc[4];
73#define VC1_2MV_BLOCK_PATTERN_VLC_BITS 3
74extern VLC ff_vc1_2mv_block_pattern_vlc[4];
75#define VC1_TTBLK_VLC_BITS 5
76extern VLC ff_vc1_ttblk_vlc[3];
77#define VC1_SUBBLKPAT_VLC_BITS 6
78extern VLC ff_vc1_subblkpat_vlc[3];
79#define VC1_INTFR_4MV_MBMODE_VLC_BITS 9
80extern VLC ff_vc1_intfr_4mv_mbmode_vlc[4];
81#define VC1_INTFR_NON4MV_MBMODE_VLC_BITS 6
82extern VLC ff_vc1_intfr_non4mv_mbmode_vlc[4];
83#define VC1_IF_MMV_MBMODE_VLC_BITS 5
84extern VLC ff_vc1_if_mmv_mbmode_vlc[8];
85#define VC1_IF_1MV_MBMODE_VLC_BITS 5
86extern VLC ff_vc1_if_1mv_mbmode_vlc[8];
87#define VC1_1REF_MVDATA_VLC_BITS 9
88extern VLC ff_vc1_1ref_mvdata_vlc[4];
89#define VC1_2REF_MVDATA_VLC_BITS 9
90extern VLC ff_vc1_2ref_mvdata_vlc[8];
91
92extern VLC ff_vc1_ac_coeff_table[8];
93
94#define VC1_IF_MBMODE_VLC_BITS 5
95//@}
96
97#define B_FRACTION_DEN 256
98
99/* pre-computed scales for all bfractions and base=256 */
100extern const int16_t ff_vc1_bfraction_lut[23];
101extern const uint8_t ff_vc1_bfraction_bits[23];
102extern const uint8_t ff_vc1_bfraction_codes[23];
103
104//Same as H.264
105extern const AVRational ff_vc1_pixel_aspect[16];
106
107/* BitPlane IMODE - such a small table... */
108extern const uint8_t ff_vc1_imode_codes[7];
109extern const uint8_t ff_vc1_imode_bits[7];
110
111/* Normal-2 imode */
112extern const uint8_t ff_vc1_norm2_codes[4];
113extern const uint8_t ff_vc1_norm2_bits[4];
114extern const uint16_t ff_vc1_norm6_codes[64];
115extern const uint8_t ff_vc1_norm6_bits[64];
116/* Normal-6 imode */
117extern const uint8_t ff_vc1_norm6_spec[64][5];
118
119/* 4MV Block pattern VLC tables */
120extern const uint8_t ff_vc1_4mv_block_pattern_codes[4][16];
121extern const uint8_t ff_vc1_4mv_block_pattern_bits[4][16];
122
123/* 2MV Block pattern VLC tables */
124extern const uint8_t ff_vc1_2mv_block_pattern_codes[4][4];
125extern const uint8_t ff_vc1_2mv_block_pattern_bits[4][4];
126
127extern const uint8_t ff_wmv3_dc_scale_table[32];
128
129/* P-Picture CBPCY VLC tables */
130extern const uint16_t ff_vc1_cbpcy_p_codes[4][64];
131extern const uint8_t ff_vc1_cbpcy_p_bits[4][64];
132
133/* Interlaced CBPCY VLC tables (Table 124 - Table 131) */
134extern const uint16_t ff_vc1_icbpcy_p_codes[8][63];
135extern const uint8_t ff_vc1_icbpcy_p_bits[8][63];
136
137/* MacroBlock Transform Type: 7.1.3.11, p89
138 * 8x8:B
139 * 8x4:B:btm 8x4:B:top 8x4:B:both,
140 * 4x8:B:right 4x8:B:left 4x8:B:both
141 * 4x4:B 8x8:MB
142 * 8x4:MB:btm 8x4:MB:top 8x4,MB,both
143 * 4x8,MB,right 4x8,MB,left
144 * 4x4,MB */
145extern const uint16_t ff_vc1_ttmb_codes[3][16];
146
147extern const uint8_t ff_vc1_ttmb_bits[3][16];
148
149/* TTBLK (Transform Type per Block) tables */
150extern const uint8_t ff_vc1_ttblk_codes[3][8];
151extern const uint8_t ff_vc1_ttblk_bits[3][8];
152
153/* SUBBLKPAT tables, p93-94, reordered */
154extern const uint8_t ff_vc1_subblkpat_codes[3][15];
155extern const uint8_t ff_vc1_subblkpat_bits[3][15];
156
157/* MV differential tables, p265 */
158extern const uint16_t ff_vc1_mv_diff_codes[4][73];
159extern const uint8_t ff_vc1_mv_diff_bits[4][73];
160
161/* Interlaced frame picture MBMODE VLC tables (p. 246, p. 360) */
162extern const uint16_t ff_vc1_intfr_4mv_mbmode_codes[4][15];
163extern const uint8_t ff_vc1_intfr_4mv_mbmode_bits[4][15];
164extern const uint8_t ff_vc1_intfr_non4mv_mbmode_codes[4][9];
165extern const uint8_t ff_vc1_intfr_non4mv_mbmode_bits[4][9];
166
167/* Interlaced field picture MBMODE VLC tables (p. 356 - 11.4.1, 11.4.2) */
168extern const uint8_t ff_vc1_if_mmv_mbmode_codes[8][8];
169extern const uint8_t ff_vc1_if_mmv_mbmode_bits[8][8];
170extern const uint8_t ff_vc1_if_1mv_mbmode_codes[8][6];
171extern const uint8_t ff_vc1_if_1mv_mbmode_bits[8][6];
172
173/* Interlaced frame/field picture MVDATA VLC tables */
174/* 1-reference tables */
175extern const uint32_t ff_vc1_1ref_mvdata_codes[4][72];
176extern const uint8_t ff_vc1_1ref_mvdata_bits[4][72];
177/* 2-reference tables */
178extern const uint32_t ff_vc1_2ref_mvdata_codes[8][126];
179extern const uint8_t ff_vc1_2ref_mvdata_bits[8][126];
180
181/* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */
182
183/* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */
184extern const uint8_t ff_vc1_simple_progressive_4x4_zz [16];
185extern const uint8_t ff_vc1_adv_progressive_8x4_zz [32];
186extern const uint8_t ff_vc1_adv_progressive_4x8_zz [32];
187extern const uint8_t ff_vc1_adv_interlaced_8x8_zz [64];
188extern const uint8_t ff_vc1_adv_interlaced_8x4_zz [32];
189extern const uint8_t ff_vc1_adv_interlaced_4x8_zz [32];
190extern const uint8_t ff_vc1_adv_interlaced_4x4_zz [16];
191extern const uint8_t ff_vc1_intra_horz_8x8_zz [64];
192extern const uint8_t ff_vc1_intra_vert_8x8_zz [64];
193
194/* DQScale as specified in 8.1.3.9 - almost identical to 0x40000/i */
195extern const int32_t ff_vc1_dqscale[63];
196
197/* P Interlaced field picture MV predictor scaling values (Table 114) */
198extern const uint16_t ff_vc1_field_mvpred_scales[2][7][4];
199/* B Interlaced field picture backward MV predictor scaling values for first field (Table 115) */
200extern const uint16_t ff_vc1_b_field_mvpred_scales[7][4];
201
202#define AC_MODES 8
203
204extern const int ff_vc1_ac_sizes[AC_MODES];
205
206#endif /* AVCODEC_VC1DATA_H */