2006-09-10 14:02:42 +00:00
|
|
|
/*
|
|
|
|
* VC-1 and WMV3 decoder
|
|
|
|
* copyright (c) 2006 Konstantin Shishkov
|
|
|
|
* (c) 2005 anonymous, Alex Beregszaszi, Michael Niedermayer
|
|
|
|
*
|
2006-10-07 15:30:46 +00:00
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
2006-09-10 14:02:42 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2006-10-07 15:30:46 +00:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2006-09-10 14:02:42 +00:00
|
|
|
*
|
2006-10-07 15:30:46 +00:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2006-09-10 14:02:42 +00: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 15:30:46 +00:00
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
2006-09-10 14:02:42 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2005-01-22 17:52:01 +00:00
|
|
|
/**
|
2010-04-20 14:45:34 +00:00
|
|
|
* @file
|
2006-06-27 03:11:51 +00:00
|
|
|
* VC-1 tables.
|
2005-01-22 17:52:01 +00:00
|
|
|
*/
|
|
|
|
|
2008-08-31 07:39:47 +00:00
|
|
|
#ifndef AVCODEC_VC1DATA_H
|
|
|
|
#define AVCODEC_VC1DATA_H
|
2005-01-22 17:52:01 +00:00
|
|
|
|
2007-06-16 22:59:13 +00:00
|
|
|
#include <stdint.h>
|
2016-06-04 11:45:16 +02:00
|
|
|
|
2022-10-28 16:36:57 +02:00
|
|
|
#include "libavutil/attributes_internal.h"
|
2008-05-09 11:56:36 +00:00
|
|
|
#include "libavutil/rational.h"
|
2016-06-04 11:45:16 +02:00
|
|
|
|
|
|
|
#include "vlc.h"
|
2007-06-16 22:59:13 +00:00
|
|
|
|
2022-10-28 16:36:57 +02:00
|
|
|
FF_VISIBILITY_PUSH_HIDDEN
|
2007-05-06 10:58:32 +00:00
|
|
|
/** Table for conversion between TTBLK and TTMB */
|
2007-05-09 16:59:46 +00:00
|
|
|
extern const int ff_vc1_ttblk_to_tt[3][8];
|
2007-05-06 10:58:32 +00:00
|
|
|
|
2007-05-09 16:59:46 +00:00
|
|
|
extern const int ff_vc1_ttfrm_to_tt[4];
|
2007-05-06 10:58:32 +00:00
|
|
|
|
|
|
|
/** MV P mode - the 5th element is only used for mode 1 */
|
2007-05-09 16:59:46 +00:00
|
|
|
extern const uint8_t ff_vc1_mv_pmode_table[2][5];
|
|
|
|
extern const uint8_t ff_vc1_mv_pmode_table2[2][4];
|
2007-05-06 10:58:32 +00:00
|
|
|
|
2012-03-10 22:43:14 +01:00
|
|
|
extern const int ff_vc1_fps_nr[7], ff_vc1_fps_dr[2];
|
2007-05-09 16:59:46 +00:00
|
|
|
extern const uint8_t ff_vc1_pquant_table[3][32];
|
2007-05-06 10:58:32 +00:00
|
|
|
|
2011-10-07 00:00:25 +05:00
|
|
|
/* MBMODE table for interlaced frame P-picture */
|
|
|
|
extern const uint8_t ff_vc1_mbmode_intfrp[2][15][4];
|
|
|
|
|
2007-05-06 10:58:32 +00:00
|
|
|
/** @name VC-1 VLC tables and defines
|
|
|
|
* @todo TODO move this into the context
|
|
|
|
*/
|
|
|
|
//@{
|
|
|
|
#define VC1_IMODE_VLC_BITS 4
|
2023-09-24 17:14:07 +02:00
|
|
|
extern VLCElem ff_vc1_imode_vlc[1 << VC1_IMODE_VLC_BITS];
|
2007-05-06 10:58:32 +00:00
|
|
|
#define VC1_NORM2_VLC_BITS 3
|
2023-09-24 17:14:07 +02:00
|
|
|
extern VLCElem ff_vc1_norm2_vlc[1 << VC1_NORM2_VLC_BITS];
|
2007-05-06 10:58:32 +00:00
|
|
|
#define VC1_NORM6_VLC_BITS 9
|
2023-09-24 17:14:07 +02:00
|
|
|
extern VLCElem ff_vc1_norm6_vlc[556];
|
2007-05-06 10:58:32 +00:00
|
|
|
/* Could be optimized, one table only needs 8 bits */
|
|
|
|
#define VC1_TTMB_VLC_BITS 9 //12
|
2023-09-24 17:14:07 +02:00
|
|
|
extern const VLCElem *ff_vc1_ttmb_vlc[3];
|
2007-05-06 10:58:32 +00:00
|
|
|
#define VC1_MV_DIFF_VLC_BITS 9 //15
|
2023-09-24 17:14:07 +02:00
|
|
|
extern const VLCElem *ff_vc1_mv_diff_vlc[4];
|
2007-05-06 10:58:32 +00:00
|
|
|
#define VC1_CBPCY_P_VLC_BITS 9 //14
|
2023-09-24 17:14:07 +02:00
|
|
|
extern const VLCElem *ff_vc1_cbpcy_p_vlc[4];
|
2011-10-07 00:00:25 +05:00
|
|
|
#define VC1_ICBPCY_VLC_BITS 9
|
2023-09-24 17:14:07 +02:00
|
|
|
extern const VLCElem *ff_vc1_icbpcy_vlc[8];
|
2007-05-06 10:58:32 +00:00
|
|
|
#define VC1_4MV_BLOCK_PATTERN_VLC_BITS 6
|
2023-09-24 17:14:07 +02:00
|
|
|
extern const VLCElem *ff_vc1_4mv_block_pattern_vlc[4];
|
2011-10-07 00:00:25 +05:00
|
|
|
#define VC1_2MV_BLOCK_PATTERN_VLC_BITS 3
|
2023-09-24 17:14:07 +02:00
|
|
|
extern const VLCElem *ff_vc1_2mv_block_pattern_vlc[4];
|
2007-05-06 10:58:32 +00:00
|
|
|
#define VC1_TTBLK_VLC_BITS 5
|
2023-09-24 17:14:07 +02:00
|
|
|
extern const VLCElem *ff_vc1_ttblk_vlc[3];
|
2007-05-06 10:58:32 +00:00
|
|
|
#define VC1_SUBBLKPAT_VLC_BITS 6
|
2023-09-24 17:14:07 +02:00
|
|
|
extern const VLCElem *ff_vc1_subblkpat_vlc[3];
|
2011-10-07 00:00:25 +05:00
|
|
|
#define VC1_INTFR_4MV_MBMODE_VLC_BITS 9
|
2023-09-24 17:14:07 +02:00
|
|
|
extern const VLCElem *ff_vc1_intfr_4mv_mbmode_vlc[4];
|
2011-10-07 00:00:25 +05:00
|
|
|
#define VC1_INTFR_NON4MV_MBMODE_VLC_BITS 6
|
2023-09-24 17:14:07 +02:00
|
|
|
extern const VLCElem *ff_vc1_intfr_non4mv_mbmode_vlc[4];
|
2011-10-07 00:00:25 +05:00
|
|
|
#define VC1_IF_MMV_MBMODE_VLC_BITS 5
|
2023-09-24 17:14:07 +02:00
|
|
|
extern const VLCElem *ff_vc1_if_mmv_mbmode_vlc[8];
|
2011-10-07 00:00:25 +05:00
|
|
|
#define VC1_IF_1MV_MBMODE_VLC_BITS 5
|
2023-09-24 17:14:07 +02:00
|
|
|
extern const VLCElem *ff_vc1_if_1mv_mbmode_vlc[8];
|
2011-10-07 00:00:25 +05:00
|
|
|
#define VC1_1REF_MVDATA_VLC_BITS 9
|
2023-09-24 17:14:07 +02:00
|
|
|
extern const VLCElem *ff_vc1_1ref_mvdata_vlc[4];
|
2011-10-07 00:00:25 +05:00
|
|
|
#define VC1_2REF_MVDATA_VLC_BITS 9
|
2023-09-24 17:14:07 +02:00
|
|
|
extern const VLCElem *ff_vc1_2ref_mvdata_vlc[8];
|
2007-05-06 10:58:32 +00:00
|
|
|
|
2023-09-24 17:14:07 +02:00
|
|
|
extern const VLCElem *ff_vc1_ac_coeff_table[8];
|
2011-10-07 00:00:25 +05:00
|
|
|
|
2022-10-30 03:19:14 +01:00
|
|
|
#define VC1_IF_MBMODE_VLC_BITS 5 // as a placeholder for VC1_IF_MMV_MBMODE_VLC_BITS
|
|
|
|
// or VC1_IF_1MV_MBMODE_VLC_BITS since they are the same
|
2007-05-06 10:58:32 +00:00
|
|
|
//@}
|
|
|
|
|
2006-09-09 11:21:56 +00:00
|
|
|
#define B_FRACTION_DEN 256
|
|
|
|
|
|
|
|
/* pre-computed scales for all bfractions and base=256 */
|
2007-05-09 16:59:46 +00:00
|
|
|
extern const int16_t ff_vc1_bfraction_lut[23];
|
2005-01-22 17:52:01 +00:00
|
|
|
|
|
|
|
//Same as H.264
|
2007-05-09 16:59:46 +00:00
|
|
|
extern const AVRational ff_vc1_pixel_aspect[16];
|
2005-01-22 17:52:01 +00:00
|
|
|
|
2012-02-15 13:00:08 +02:00
|
|
|
extern const uint8_t ff_wmv3_dc_scale_table[32];
|
2005-01-22 17:52:01 +00:00
|
|
|
|
2005-01-26 12:01:35 +00:00
|
|
|
/* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */
|
2005-01-24 23:01:18 +00:00
|
|
|
|
|
|
|
/* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */
|
2012-03-23 21:21:47 +01:00
|
|
|
extern const uint8_t ff_vc1_simple_progressive_4x4_zz [16];
|
|
|
|
extern const uint8_t ff_vc1_adv_progressive_8x4_zz [32];
|
|
|
|
extern const uint8_t ff_vc1_adv_progressive_4x8_zz [32];
|
|
|
|
extern const uint8_t ff_vc1_adv_interlaced_8x8_zz [64];
|
|
|
|
extern const uint8_t ff_vc1_adv_interlaced_8x4_zz [32];
|
|
|
|
extern const uint8_t ff_vc1_adv_interlaced_4x8_zz [32];
|
|
|
|
extern const uint8_t ff_vc1_adv_interlaced_4x4_zz [16];
|
2006-06-27 03:11:51 +00:00
|
|
|
|
|
|
|
/* DQScale as specified in 8.1.3.9 - almost identical to 0x40000/i */
|
2007-05-09 16:59:46 +00:00
|
|
|
extern const int32_t ff_vc1_dqscale[63];
|
2007-05-06 11:23:12 +00:00
|
|
|
|
2011-10-07 00:00:25 +05:00
|
|
|
/* P Interlaced field picture MV predictor scaling values (Table 114) */
|
2012-02-15 13:00:08 +02:00
|
|
|
extern const uint16_t ff_vc1_field_mvpred_scales[2][7][4];
|
2011-10-07 00:00:25 +05:00
|
|
|
/* B Interlaced field picture backward MV predictor scaling values for first field (Table 115) */
|
2012-02-15 13:00:08 +02:00
|
|
|
extern const uint16_t ff_vc1_b_field_mvpred_scales[7][4];
|
2012-03-06 18:59:03 +01:00
|
|
|
|
|
|
|
#define AC_MODES 8
|
|
|
|
|
|
|
|
extern const int ff_vc1_ac_sizes[AC_MODES];
|
2022-10-28 16:36:57 +02:00
|
|
|
FF_VISIBILITY_POP_HIDDEN
|
2012-03-06 18:59:03 +01:00
|
|
|
|
2008-08-31 07:39:47 +00:00
|
|
|
#endif /* AVCODEC_VC1DATA_H */
|