00001 /* 00002 * VC-1 and WMV3 decoder 00003 * copyright (c) 2006 Konstantin Shishkov 00004 * (c) 2005 anonymous, Alex Beregszaszi, Michael Niedermayer 00005 * 00006 * This file is part of FFmpeg. 00007 * 00008 * FFmpeg is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * FFmpeg is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with FFmpeg; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00028 #ifndef AVCODEC_VC1DATA_H 00029 #define AVCODEC_VC1DATA_H 00030 00031 #include <stdint.h> 00032 #include "libavutil/rational.h" 00033 #include "get_bits.h" 00034 00036 extern const int ff_vc1_ttblk_to_tt[3][8]; 00037 00038 extern const int ff_vc1_ttfrm_to_tt[4]; 00039 00041 extern const uint8_t ff_vc1_mv_pmode_table[2][5]; 00042 extern const uint8_t ff_vc1_mv_pmode_table2[2][4]; 00043 00044 extern const int ff_vc1_fps_nr[5], ff_vc1_fps_dr[2]; 00045 extern const uint8_t ff_vc1_pquant_table[3][32]; 00046 00047 /* MBMODE table for interlaced frame P-picture */ 00048 extern const uint8_t ff_vc1_mbmode_intfrp[2][15][4]; 00049 00054 #define VC1_BFRACTION_VLC_BITS 7 00055 extern VLC ff_vc1_bfraction_vlc; 00056 #define VC1_IMODE_VLC_BITS 4 00057 extern VLC ff_vc1_imode_vlc; 00058 #define VC1_NORM2_VLC_BITS 3 00059 extern VLC ff_vc1_norm2_vlc; 00060 #define VC1_NORM6_VLC_BITS 9 00061 extern VLC ff_vc1_norm6_vlc; 00062 /* Could be optimized, one table only needs 8 bits */ 00063 #define VC1_TTMB_VLC_BITS 9 //12 00064 extern VLC ff_vc1_ttmb_vlc[3]; 00065 #define VC1_MV_DIFF_VLC_BITS 9 //15 00066 extern VLC ff_vc1_mv_diff_vlc[4]; 00067 #define VC1_CBPCY_P_VLC_BITS 9 //14 00068 extern VLC ff_vc1_cbpcy_p_vlc[4]; 00069 #define VC1_ICBPCY_VLC_BITS 9 00070 extern VLC ff_vc1_icbpcy_vlc[8]; 00071 #define VC1_4MV_BLOCK_PATTERN_VLC_BITS 6 00072 extern VLC ff_vc1_4mv_block_pattern_vlc[4]; 00073 #define VC1_2MV_BLOCK_PATTERN_VLC_BITS 3 00074 extern VLC ff_vc1_2mv_block_pattern_vlc[4]; 00075 #define VC1_TTBLK_VLC_BITS 5 00076 extern VLC ff_vc1_ttblk_vlc[3]; 00077 #define VC1_SUBBLKPAT_VLC_BITS 6 00078 extern VLC ff_vc1_subblkpat_vlc[3]; 00079 #define VC1_INTFR_4MV_MBMODE_VLC_BITS 9 00080 extern VLC ff_vc1_intfr_4mv_mbmode_vlc[4]; 00081 #define VC1_INTFR_NON4MV_MBMODE_VLC_BITS 6 00082 extern VLC ff_vc1_intfr_non4mv_mbmode_vlc[4]; 00083 #define VC1_IF_MMV_MBMODE_VLC_BITS 5 00084 extern VLC ff_vc1_if_mmv_mbmode_vlc[8]; 00085 #define VC1_IF_1MV_MBMODE_VLC_BITS 5 00086 extern VLC ff_vc1_if_1mv_mbmode_vlc[8]; 00087 #define VC1_1REF_MVDATA_VLC_BITS 9 00088 extern VLC ff_vc1_1ref_mvdata_vlc[4]; 00089 #define VC1_2REF_MVDATA_VLC_BITS 9 00090 extern VLC ff_vc1_2ref_mvdata_vlc[8]; 00091 00092 extern VLC ff_vc1_ac_coeff_table[8]; 00093 00094 #define VC1_IF_MBMODE_VLC_BITS 5 00095 00096 00097 00098 /* Denominator used for ff_vc1_bfraction_lut */ 00099 #define B_FRACTION_DEN 256 00100 00101 /* pre-computed scales for all bfractions and base=256 */ 00102 extern const int16_t ff_vc1_bfraction_lut[23]; 00103 extern const uint8_t ff_vc1_bfraction_bits[23]; 00104 extern const uint8_t ff_vc1_bfraction_codes[23]; 00105 00106 //Same as H.264 00107 extern const AVRational ff_vc1_pixel_aspect[16]; 00108 00109 /* BitPlane IMODE - such a small table... */ 00110 extern const uint8_t ff_vc1_imode_codes[7]; 00111 extern const uint8_t ff_vc1_imode_bits[7]; 00112 00113 /* Normal-2 imode */ 00114 extern const uint8_t ff_vc1_norm2_codes[4]; 00115 extern const uint8_t ff_vc1_norm2_bits[4]; 00116 extern const uint16_t ff_vc1_norm6_codes[64]; 00117 extern const uint8_t ff_vc1_norm6_bits[64]; 00118 /* Normal-6 imode */ 00119 extern const uint8_t ff_vc1_norm6_spec[64][5]; 00120 00121 /* 4MV Block pattern VLC tables */ 00122 extern const uint8_t ff_vc1_4mv_block_pattern_codes[4][16]; 00123 extern const uint8_t ff_vc1_4mv_block_pattern_bits[4][16]; 00124 00125 /* 2MV Block pattern VLC tables */ 00126 extern const uint8_t ff_vc1_2mv_block_pattern_codes[4][4]; 00127 extern const uint8_t ff_vc1_2mv_block_pattern_bits[4][4]; 00128 00129 extern const uint8_t wmv3_dc_scale_table[32]; 00130 00131 /* P-Picture CBPCY VLC tables */ 00132 extern const uint16_t ff_vc1_cbpcy_p_codes[4][64]; 00133 extern const uint8_t ff_vc1_cbpcy_p_bits[4][64]; 00134 00135 /* Interlaced CBPCY VLC tables (Table 124 - Table 131) */ 00136 extern const uint16_t ff_vc1_icbpcy_p_codes[8][63]; 00137 extern const uint8_t ff_vc1_icbpcy_p_bits[8][63]; 00138 00139 /* MacroBlock Transform Type: 7.1.3.11, p89 00140 * 8x8:B 00141 * 8x4:B:btm 8x4:B:top 8x4:B:both, 00142 * 4x8:B:right 4x8:B:left 4x8:B:both 00143 * 4x4:B 8x8:MB 00144 * 8x4:MB:btm 8x4:MB:top 8x4,MB,both 00145 * 4x8,MB,right 4x8,MB,left 00146 * 4x4,MB */ 00147 extern const uint16_t ff_vc1_ttmb_codes[3][16]; 00148 00149 extern const uint8_t ff_vc1_ttmb_bits[3][16]; 00150 00151 /* TTBLK (Transform Type per Block) tables */ 00152 extern const uint8_t ff_vc1_ttblk_codes[3][8]; 00153 extern const uint8_t ff_vc1_ttblk_bits[3][8]; 00154 00155 /* SUBBLKPAT tables, p93-94, reordered */ 00156 extern const uint8_t ff_vc1_subblkpat_codes[3][15]; 00157 extern const uint8_t ff_vc1_subblkpat_bits[3][15]; 00158 00159 /* MV differential tables, p265 */ 00160 extern const uint16_t ff_vc1_mv_diff_codes[4][73]; 00161 extern const uint8_t ff_vc1_mv_diff_bits[4][73]; 00162 00163 /* Interlaced frame picture MBMODE VLC tables (p. 246, p. 360) */ 00164 extern const uint16_t ff_vc1_intfr_4mv_mbmode_codes[4][15]; 00165 extern const uint8_t ff_vc1_intfr_4mv_mbmode_bits[4][15]; 00166 extern const uint8_t ff_vc1_intfr_non4mv_mbmode_codes[4][9]; 00167 extern const uint8_t ff_vc1_intfr_non4mv_mbmode_bits[4][9]; 00168 00169 /* Interlaced field picture MBMODE VLC tables (p. 356 - 11.4.1, 11.4.2) */ 00170 extern const uint8_t ff_vc1_if_mmv_mbmode_codes[8][8]; 00171 extern const uint8_t ff_vc1_if_mmv_mbmode_bits[8][8]; 00172 extern const uint8_t ff_vc1_if_1mv_mbmode_codes[8][6]; 00173 extern const uint8_t ff_vc1_if_1mv_mbmode_bits[8][6]; 00174 00175 /* Interlaced frame/field picture MVDATA VLC tables */ 00176 /* 1-reference tables */ 00177 extern const uint32_t ff_vc1_1ref_mvdata_codes[4][72]; 00178 extern const uint8_t ff_vc1_1ref_mvdata_bits[4][72]; 00179 /* 2-reference tables */ 00180 extern const uint32_t ff_vc1_2ref_mvdata_codes[8][126]; 00181 extern const uint8_t ff_vc1_2ref_mvdata_bits[8][126]; 00182 00183 /* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */ 00184 00185 /* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */ 00186 extern const int8_t ff_vc1_simple_progressive_4x4_zz [16]; 00187 extern const int8_t ff_vc1_adv_progressive_8x4_zz [32]; 00188 extern const int8_t ff_vc1_adv_progressive_4x8_zz [32]; 00189 extern const int8_t ff_vc1_adv_interlaced_8x8_zz [64]; 00190 extern const int8_t ff_vc1_adv_interlaced_8x4_zz [32]; 00191 extern const int8_t ff_vc1_adv_interlaced_4x8_zz [32]; 00192 extern const int8_t ff_vc1_adv_interlaced_4x4_zz [16]; 00193 extern const int8_t ff_vc1_intra_horz_8x8_zz [64]; 00194 extern const int8_t ff_vc1_intra_vert_8x8_zz [64]; 00195 00196 /* DQScale as specified in 8.1.3.9 - almost identical to 0x40000/i */ 00197 extern const int32_t ff_vc1_dqscale[63]; 00198 00199 /* P Interlaced field picture MV predictor scaling values (Table 114) */ 00200 extern const uint16_t vc1_field_mvpred_scales[2][7][4]; 00201 /* B Interlaced field picture backward MV predictor scaling values for first field (Table 115) */ 00202 extern const uint16_t vc1_b_field_mvpred_scales[7][4]; 00203 #endif /* AVCODEC_VC1DATA_H */