2006-09-10 16:02:42 +02:00
|
|
|
/*
|
|
|
|
* VC-1 and WMV3 decoder
|
|
|
|
* copyright (c) 2006 Konstantin Shishkov
|
|
|
|
* (c) 2005 anonymous, Alex Beregszaszi, Michael Niedermayer
|
|
|
|
*
|
2006-10-07 17:30:46 +02:00
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
2006-09-10 16:02:42 +02:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2006-10-07 17:30:46 +02:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2006-09-10 16:02:42 +02:00
|
|
|
*
|
2006-10-07 17:30:46 +02:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2006-09-10 16:02:42 +02:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2006-10-07 17:30:46 +02:00
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
2006-09-10 16:02:42 +02:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2005-01-22 18:52:01 +01:00
|
|
|
/**
|
2006-06-27 04:55:54 +02:00
|
|
|
* @file vc1data.h
|
2006-06-27 05:11:51 +02:00
|
|
|
* VC-1 tables.
|
2005-01-22 18:52:01 +01:00
|
|
|
*/
|
|
|
|
|
2006-06-27 04:55:54 +02:00
|
|
|
#ifndef VC1DATA_H
|
|
|
|
#define VC1DATA_H
|
2005-01-22 18:52:01 +01:00
|
|
|
|
2007-05-06 12:58:32 +02:00
|
|
|
/** Table for conversion between TTBLK and TTMB */
|
2007-05-06 13:40:42 +02:00
|
|
|
extern const int vc1_ttblk_to_tt[3][8];
|
2007-05-06 12:58:32 +02:00
|
|
|
|
2007-05-06 13:40:42 +02:00
|
|
|
extern const int vc1_ttfrm_to_tt[4];
|
2007-05-06 12:58:32 +02:00
|
|
|
|
|
|
|
/** MV P mode - the 5th element is only used for mode 1 */
|
2007-05-06 13:40:42 +02:00
|
|
|
extern const uint8_t vc1_mv_pmode_table[2][5];
|
|
|
|
extern const uint8_t vc1_mv_pmode_table2[2][4];
|
2007-05-06 12:58:32 +02:00
|
|
|
|
2007-05-06 13:40:42 +02:00
|
|
|
extern const int vc1_fps_nr[5], vc1_fps_dr[2];
|
|
|
|
extern const uint8_t vc1_pquant_table[3][32];
|
2007-05-06 12:58:32 +02:00
|
|
|
|
|
|
|
/** @name VC-1 VLC tables and defines
|
|
|
|
* @todo TODO move this into the context
|
|
|
|
*/
|
|
|
|
//@{
|
|
|
|
#define VC1_BFRACTION_VLC_BITS 7
|
2007-05-06 13:23:12 +02:00
|
|
|
extern VLC vc1_bfraction_vlc;
|
2007-05-06 12:58:32 +02:00
|
|
|
#define VC1_IMODE_VLC_BITS 4
|
2007-05-06 13:23:12 +02:00
|
|
|
extern VLC vc1_imode_vlc;
|
2007-05-06 12:58:32 +02:00
|
|
|
#define VC1_NORM2_VLC_BITS 3
|
2007-05-06 13:23:12 +02:00
|
|
|
extern VLC vc1_norm2_vlc;
|
2007-05-06 12:58:32 +02:00
|
|
|
#define VC1_NORM6_VLC_BITS 9
|
2007-05-06 13:23:12 +02:00
|
|
|
extern VLC vc1_norm6_vlc;
|
2007-05-06 12:58:32 +02:00
|
|
|
/* Could be optimized, one table only needs 8 bits */
|
|
|
|
#define VC1_TTMB_VLC_BITS 9 //12
|
2007-05-06 13:23:12 +02:00
|
|
|
extern VLC vc1_ttmb_vlc[3];
|
2007-05-06 12:58:32 +02:00
|
|
|
#define VC1_MV_DIFF_VLC_BITS 9 //15
|
2007-05-06 13:23:12 +02:00
|
|
|
extern VLC vc1_mv_diff_vlc[4];
|
2007-05-06 12:58:32 +02:00
|
|
|
#define VC1_CBPCY_P_VLC_BITS 9 //14
|
2007-05-06 13:23:12 +02:00
|
|
|
extern VLC vc1_cbpcy_p_vlc[4];
|
2007-05-06 12:58:32 +02:00
|
|
|
#define VC1_4MV_BLOCK_PATTERN_VLC_BITS 6
|
2007-05-06 13:23:12 +02:00
|
|
|
extern VLC vc1_4mv_block_pattern_vlc[4];
|
2007-05-06 12:58:32 +02:00
|
|
|
#define VC1_TTBLK_VLC_BITS 5
|
2007-05-06 13:23:12 +02:00
|
|
|
extern VLC vc1_ttblk_vlc[3];
|
2007-05-06 12:58:32 +02:00
|
|
|
#define VC1_SUBBLKPAT_VLC_BITS 6
|
2007-05-06 13:23:12 +02:00
|
|
|
extern VLC vc1_subblkpat_vlc[3];
|
2007-05-06 12:58:32 +02:00
|
|
|
|
2007-05-06 13:23:12 +02:00
|
|
|
extern VLC vc1_ac_coeff_table[8];
|
2007-05-06 12:58:32 +02:00
|
|
|
//@}
|
|
|
|
|
|
|
|
|
2006-09-09 13:21:56 +02:00
|
|
|
#if 0 //original bfraction from vc9data.h, not conforming to standard
|
2006-07-24 06:24:53 +02:00
|
|
|
/* Denominator used for vc1_bfraction_lut */
|
|
|
|
#define B_FRACTION_DEN 840
|
|
|
|
|
2005-01-22 18:52:01 +01:00
|
|
|
/* bfraction is fractional, we scale to the GCD 3*5*7*8 = 840 */
|
2007-05-06 13:23:12 +02:00
|
|
|
extern const int16_t vc1_bfraction_lut[23];
|
2006-09-09 13:21:56 +02:00
|
|
|
#else
|
|
|
|
/* Denominator used for vc1_bfraction_lut */
|
|
|
|
#define B_FRACTION_DEN 256
|
|
|
|
|
|
|
|
/* pre-computed scales for all bfractions and base=256 */
|
2007-05-06 13:23:12 +02:00
|
|
|
extern const int16_t vc1_bfraction_lut[23];
|
2006-09-09 13:21:56 +02:00
|
|
|
#endif
|
|
|
|
|
2007-05-06 13:23:12 +02:00
|
|
|
extern const uint8_t vc1_bfraction_bits[23];
|
|
|
|
extern const uint8_t vc1_bfraction_codes[23];
|
2005-01-22 18:52:01 +01:00
|
|
|
|
|
|
|
//Same as H.264
|
2007-05-06 13:23:12 +02:00
|
|
|
extern const AVRational vc1_pixel_aspect[16];
|
2005-01-22 18:52:01 +01:00
|
|
|
|
|
|
|
/* BitPlane IMODE - such a small table... */
|
2007-05-06 13:23:12 +02:00
|
|
|
extern const uint8_t vc1_imode_codes[7];
|
|
|
|
extern const uint8_t vc1_imode_bits[7];
|
2005-01-22 18:52:01 +01:00
|
|
|
|
|
|
|
/* Normal-2 imode */
|
2007-05-06 13:23:12 +02:00
|
|
|
extern const uint8_t vc1_norm2_codes[4];
|
|
|
|
extern const uint8_t vc1_norm2_bits[4];
|
|
|
|
extern const uint16_t vc1_norm6_codes[64];
|
|
|
|
extern const uint8_t vc1_norm6_bits[64];
|
2005-01-24 02:46:12 +01:00
|
|
|
/* Normal-6 imode */
|
2007-05-06 13:23:12 +02:00
|
|
|
extern const uint8_t vc1_norm6_spec[64][5];
|
2005-01-30 22:54:20 +01:00
|
|
|
|
2005-01-22 18:52:01 +01:00
|
|
|
/* 4MV Block pattern VLC tables */
|
2007-05-06 13:23:12 +02:00
|
|
|
extern const uint8_t vc1_4mv_block_pattern_codes[4][16];
|
|
|
|
extern const uint8_t vc1_4mv_block_pattern_bits[4][16];
|
2005-01-22 18:52:01 +01:00
|
|
|
|
2007-05-06 13:23:12 +02:00
|
|
|
extern const uint8_t wmv3_dc_scale_table[32];
|
2005-01-22 18:52:01 +01:00
|
|
|
|
|
|
|
/* P-Picture CBPCY VLC tables */
|
2007-05-06 13:23:12 +02:00
|
|
|
extern const uint16_t vc1_cbpcy_p_codes[4][64];
|
|
|
|
extern const uint8_t vc1_cbpcy_p_bits[4][64];
|
2005-01-22 18:52:01 +01:00
|
|
|
|
2005-01-25 00:01:18 +01:00
|
|
|
/* MacroBlock Transform Type: 7.1.3.11, p89
|
2005-01-22 18:52:01 +01:00
|
|
|
* 8x8:B
|
|
|
|
* 8x4:B:btm 8x4:B:top 8x4:B:both,
|
|
|
|
* 4x8:B:right 4x8:B:left 4x8:B:both
|
|
|
|
* 4x4:B 8x8:MB
|
|
|
|
* 8x4:MB:btm 8x4:MB:top 8x4,MB,both
|
|
|
|
* 4x8,MB,right 4x8,MB,left
|
|
|
|
* 4x4,MB */
|
2007-05-06 13:23:12 +02:00
|
|
|
extern const uint16_t vc1_ttmb_codes[3][16];
|
2005-01-22 18:52:01 +01:00
|
|
|
|
2007-05-06 13:23:12 +02:00
|
|
|
extern const uint8_t vc1_ttmb_bits[3][16];
|
2005-01-22 18:52:01 +01:00
|
|
|
|
2005-02-04 03:20:38 +01:00
|
|
|
/* TTBLK (Transform Type per Block) tables */
|
2007-05-06 13:23:12 +02:00
|
|
|
extern const uint8_t vc1_ttblk_codes[3][8];
|
|
|
|
extern const uint8_t vc1_ttblk_bits[3][8];
|
2005-02-04 03:20:38 +01:00
|
|
|
|
|
|
|
/* SUBBLKPAT tables, p93-94, reordered */
|
2007-05-06 13:23:12 +02:00
|
|
|
extern const uint8_t vc1_subblkpat_codes[3][15];
|
|
|
|
extern const uint8_t vc1_subblkpat_bits[3][15];
|
2005-01-22 18:52:01 +01:00
|
|
|
|
|
|
|
/* MV differential tables, p265 */
|
2007-05-06 13:23:12 +02:00
|
|
|
extern const uint16_t vc1_mv_diff_codes[4][73];
|
|
|
|
extern const uint8_t vc1_mv_diff_bits[4][73];
|
2005-01-22 18:52:01 +01:00
|
|
|
|
2005-01-26 13:01:35 +01:00
|
|
|
/* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */
|
2005-01-25 00:01:18 +01:00
|
|
|
|
|
|
|
/* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */
|
2007-05-06 13:23:12 +02:00
|
|
|
extern const int8_t vc1_normal_zz[64];
|
|
|
|
extern const int8_t vc1_horizontal_zz [64];
|
|
|
|
extern const int8_t vc1_vertical_zz [64];
|
|
|
|
extern const int8_t vc1_simple_progressive_8x8_zz [64];
|
|
|
|
extern const int8_t vc1_simple_progressive_8x4_zz [32];
|
|
|
|
extern const int8_t vc1_simple_progressive_4x8_zz [32];
|
|
|
|
extern const int8_t vc1_simple_progressive_4x4_zz [16];
|
|
|
|
extern const int8_t vc1_adv_progressive_8x4_zz [32];
|
|
|
|
extern const int8_t vc1_adv_progressive_4x8_zz [32];
|
|
|
|
extern const int8_t vc1_adv_interlaced_8x8_zz [64];
|
|
|
|
extern const int8_t vc1_adv_interlaced_8x4_zz [32];
|
|
|
|
extern const int8_t vc1_adv_interlaced_4x8_zz [32];
|
|
|
|
extern const int8_t vc1_adv_interlaced_4x4_zz [16];
|
2006-06-27 05:11:51 +02:00
|
|
|
|
|
|
|
/* DQScale as specified in 8.1.3.9 - almost identical to 0x40000/i */
|
2007-05-06 13:23:12 +02:00
|
|
|
extern const int32_t vc1_dqscale[63];
|
|
|
|
|
2006-06-27 04:55:54 +02:00
|
|
|
#endif /* VC1DATA_H */
|