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 00051 #define VC1_BFRACTION_VLC_BITS 7 00052 extern VLC ff_vc1_bfraction_vlc; 00053 #define VC1_IMODE_VLC_BITS 4 00054 extern VLC ff_vc1_imode_vlc; 00055 #define VC1_NORM2_VLC_BITS 3 00056 extern VLC ff_vc1_norm2_vlc; 00057 #define VC1_NORM6_VLC_BITS 9 00058 extern VLC ff_vc1_norm6_vlc; 00059 /* Could be optimized, one table only needs 8 bits */ 00060 #define VC1_TTMB_VLC_BITS 9 //12 00061 extern VLC ff_vc1_ttmb_vlc[3]; 00062 #define VC1_MV_DIFF_VLC_BITS 9 //15 00063 extern VLC ff_vc1_mv_diff_vlc[4]; 00064 #define VC1_CBPCY_P_VLC_BITS 9 //14 00065 extern VLC ff_vc1_cbpcy_p_vlc[4]; 00066 #define VC1_4MV_BLOCK_PATTERN_VLC_BITS 6 00067 extern VLC ff_vc1_4mv_block_pattern_vlc[4]; 00068 #define VC1_TTBLK_VLC_BITS 5 00069 extern VLC ff_vc1_ttblk_vlc[3]; 00070 #define VC1_SUBBLKPAT_VLC_BITS 6 00071 extern VLC ff_vc1_subblkpat_vlc[3]; 00072 00073 extern VLC ff_vc1_ac_coeff_table[8]; 00075 00076 00077 #if 0 //original bfraction from vc9data.h, not conforming to standard 00078 /* Denominator used for ff_vc1_bfraction_lut */ 00079 #define B_FRACTION_DEN 840 00080 00081 /* bfraction is fractional, we scale to the GCD 3*5*7*8 = 840 */ 00082 extern const int16_t ff_vc1_bfraction_lut[23]; 00083 #else 00084 /* Denominator used for ff_vc1_bfraction_lut */ 00085 #define B_FRACTION_DEN 256 00086 00087 /* pre-computed scales for all bfractions and base=256 */ 00088 extern const int16_t ff_vc1_bfraction_lut[23]; 00089 #endif 00090 00091 extern const uint8_t ff_vc1_bfraction_bits[23]; 00092 extern const uint8_t ff_vc1_bfraction_codes[23]; 00093 00094 //Same as H.264 00095 extern const AVRational ff_vc1_pixel_aspect[16]; 00096 00097 /* BitPlane IMODE - such a small table... */ 00098 extern const uint8_t ff_vc1_imode_codes[7]; 00099 extern const uint8_t ff_vc1_imode_bits[7]; 00100 00101 /* Normal-2 imode */ 00102 extern const uint8_t ff_vc1_norm2_codes[4]; 00103 extern const uint8_t ff_vc1_norm2_bits[4]; 00104 extern const uint16_t ff_vc1_norm6_codes[64]; 00105 extern const uint8_t ff_vc1_norm6_bits[64]; 00106 /* Normal-6 imode */ 00107 extern const uint8_t ff_vc1_norm6_spec[64][5]; 00108 00109 /* 4MV Block pattern VLC tables */ 00110 extern const uint8_t ff_vc1_4mv_block_pattern_codes[4][16]; 00111 extern const uint8_t ff_vc1_4mv_block_pattern_bits[4][16]; 00112 00113 extern const uint8_t wmv3_dc_scale_table[32]; 00114 00115 /* P-Picture CBPCY VLC tables */ 00116 extern const uint16_t ff_vc1_cbpcy_p_codes[4][64]; 00117 extern const uint8_t ff_vc1_cbpcy_p_bits[4][64]; 00118 00119 /* MacroBlock Transform Type: 7.1.3.11, p89 00120 * 8x8:B 00121 * 8x4:B:btm 8x4:B:top 8x4:B:both, 00122 * 4x8:B:right 4x8:B:left 4x8:B:both 00123 * 4x4:B 8x8:MB 00124 * 8x4:MB:btm 8x4:MB:top 8x4,MB,both 00125 * 4x8,MB,right 4x8,MB,left 00126 * 4x4,MB */ 00127 extern const uint16_t ff_vc1_ttmb_codes[3][16]; 00128 00129 extern const uint8_t ff_vc1_ttmb_bits[3][16]; 00130 00131 /* TTBLK (Transform Type per Block) tables */ 00132 extern const uint8_t ff_vc1_ttblk_codes[3][8]; 00133 extern const uint8_t ff_vc1_ttblk_bits[3][8]; 00134 00135 /* SUBBLKPAT tables, p93-94, reordered */ 00136 extern const uint8_t ff_vc1_subblkpat_codes[3][15]; 00137 extern const uint8_t ff_vc1_subblkpat_bits[3][15]; 00138 00139 /* MV differential tables, p265 */ 00140 extern const uint16_t ff_vc1_mv_diff_codes[4][73]; 00141 extern const uint8_t ff_vc1_mv_diff_bits[4][73]; 00142 00143 /* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */ 00144 00145 /* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */ 00146 extern const int8_t ff_vc1_simple_progressive_4x4_zz [16]; 00147 extern const int8_t ff_vc1_adv_progressive_8x4_zz [32]; 00148 extern const int8_t ff_vc1_adv_progressive_4x8_zz [32]; 00149 extern const int8_t ff_vc1_adv_interlaced_8x8_zz [64]; 00150 extern const int8_t ff_vc1_adv_interlaced_8x4_zz [32]; 00151 extern const int8_t ff_vc1_adv_interlaced_4x8_zz [32]; 00152 extern const int8_t ff_vc1_adv_interlaced_4x4_zz [16]; 00153 00154 /* DQScale as specified in 8.1.3.9 - almost identical to 0x40000/i */ 00155 extern const int32_t ff_vc1_dqscale[63]; 00156 00157 #endif /* AVCODEC_VC1DATA_H */