You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
5.2KB

  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. * @file vc1data.h
  24. * VC-1 tables.
  25. */
  26. #ifndef VC1DATA_H
  27. #define VC1DATA_H
  28. /** Table for conversion between TTBLK and TTMB */
  29. extern const int ff_vc1_ttblk_to_tt[3][8];
  30. extern const int ff_vc1_ttfrm_to_tt[4];
  31. /** MV P mode - the 5th element is only used for mode 1 */
  32. extern const uint8_t ff_vc1_mv_pmode_table[2][5];
  33. extern const uint8_t ff_vc1_mv_pmode_table2[2][4];
  34. extern const int ff_vc1_fps_nr[5], ff_vc1_fps_dr[2];
  35. extern const uint8_t ff_vc1_pquant_table[3][32];
  36. /** @name VC-1 VLC tables and defines
  37. * @todo TODO move this into the context
  38. */
  39. //@{
  40. #define VC1_BFRACTION_VLC_BITS 7
  41. extern VLC ff_vc1_bfraction_vlc;
  42. #define VC1_IMODE_VLC_BITS 4
  43. extern VLC ff_vc1_imode_vlc;
  44. #define VC1_NORM2_VLC_BITS 3
  45. extern VLC ff_vc1_norm2_vlc;
  46. #define VC1_NORM6_VLC_BITS 9
  47. extern VLC ff_vc1_norm6_vlc;
  48. /* Could be optimized, one table only needs 8 bits */
  49. #define VC1_TTMB_VLC_BITS 9 //12
  50. extern VLC ff_vc1_ttmb_vlc[3];
  51. #define VC1_MV_DIFF_VLC_BITS 9 //15
  52. extern VLC ff_vc1_mv_diff_vlc[4];
  53. #define VC1_CBPCY_P_VLC_BITS 9 //14
  54. extern VLC ff_vc1_cbpcy_p_vlc[4];
  55. #define VC1_4MV_BLOCK_PATTERN_VLC_BITS 6
  56. extern VLC ff_vc1_4mv_block_pattern_vlc[4];
  57. #define VC1_TTBLK_VLC_BITS 5
  58. extern VLC ff_vc1_ttblk_vlc[3];
  59. #define VC1_SUBBLKPAT_VLC_BITS 6
  60. extern VLC ff_vc1_subblkpat_vlc[3];
  61. extern VLC ff_vc1_ac_coeff_table[8];
  62. //@}
  63. #if 0 //original bfraction from vc9data.h, not conforming to standard
  64. /* Denominator used for ff_vc1_bfraction_lut */
  65. #define B_FRACTION_DEN 840
  66. /* bfraction is fractional, we scale to the GCD 3*5*7*8 = 840 */
  67. extern const int16_t ff_vc1_bfraction_lut[23];
  68. #else
  69. /* Denominator used for ff_vc1_bfraction_lut */
  70. #define B_FRACTION_DEN 256
  71. /* pre-computed scales for all bfractions and base=256 */
  72. extern const int16_t ff_vc1_bfraction_lut[23];
  73. #endif
  74. extern const uint8_t ff_vc1_bfraction_bits[23];
  75. extern const uint8_t ff_vc1_bfraction_codes[23];
  76. //Same as H.264
  77. extern const AVRational ff_vc1_pixel_aspect[16];
  78. /* BitPlane IMODE - such a small table... */
  79. extern const uint8_t ff_vc1_imode_codes[7];
  80. extern const uint8_t ff_vc1_imode_bits[7];
  81. /* Normal-2 imode */
  82. extern const uint8_t ff_vc1_norm2_codes[4];
  83. extern const uint8_t ff_vc1_norm2_bits[4];
  84. extern const uint16_t ff_vc1_norm6_codes[64];
  85. extern const uint8_t ff_vc1_norm6_bits[64];
  86. /* Normal-6 imode */
  87. extern const uint8_t ff_vc1_norm6_spec[64][5];
  88. /* 4MV Block pattern VLC tables */
  89. extern const uint8_t ff_vc1_4mv_block_pattern_codes[4][16];
  90. extern const uint8_t ff_vc1_4mv_block_pattern_bits[4][16];
  91. extern const uint8_t wmv3_dc_scale_table[32];
  92. /* P-Picture CBPCY VLC tables */
  93. extern const uint16_t ff_vc1_cbpcy_p_codes[4][64];
  94. extern const uint8_t ff_vc1_cbpcy_p_bits[4][64];
  95. /* MacroBlock Transform Type: 7.1.3.11, p89
  96. * 8x8:B
  97. * 8x4:B:btm 8x4:B:top 8x4:B:both,
  98. * 4x8:B:right 4x8:B:left 4x8:B:both
  99. * 4x4:B 8x8:MB
  100. * 8x4:MB:btm 8x4:MB:top 8x4,MB,both
  101. * 4x8,MB,right 4x8,MB,left
  102. * 4x4,MB */
  103. extern const uint16_t ff_vc1_ttmb_codes[3][16];
  104. extern const uint8_t ff_vc1_ttmb_bits[3][16];
  105. /* TTBLK (Transform Type per Block) tables */
  106. extern const uint8_t ff_vc1_ttblk_codes[3][8];
  107. extern const uint8_t ff_vc1_ttblk_bits[3][8];
  108. /* SUBBLKPAT tables, p93-94, reordered */
  109. extern const uint8_t ff_vc1_subblkpat_codes[3][15];
  110. extern const uint8_t ff_vc1_subblkpat_bits[3][15];
  111. /* MV differential tables, p265 */
  112. extern const uint16_t ff_vc1_mv_diff_codes[4][73];
  113. extern const uint8_t ff_vc1_mv_diff_bits[4][73];
  114. /* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */
  115. /* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */
  116. extern const int8_t ff_vc1_normal_zz[64];
  117. extern const int8_t ff_vc1_horizontal_zz [64];
  118. extern const int8_t ff_vc1_vertical_zz [64];
  119. extern const int8_t ff_vc1_simple_progressive_8x8_zz [64];
  120. extern const int8_t ff_vc1_simple_progressive_8x4_zz [32];
  121. extern const int8_t ff_vc1_simple_progressive_4x8_zz [32];
  122. extern const int8_t ff_vc1_simple_progressive_4x4_zz [16];
  123. extern const int8_t ff_vc1_adv_progressive_8x4_zz [32];
  124. extern const int8_t ff_vc1_adv_progressive_4x8_zz [32];
  125. extern const int8_t ff_vc1_adv_interlaced_8x8_zz [64];
  126. extern const int8_t ff_vc1_adv_interlaced_8x4_zz [32];
  127. extern const int8_t ff_vc1_adv_interlaced_4x8_zz [32];
  128. extern const int8_t ff_vc1_adv_interlaced_4x4_zz [16];
  129. /* DQScale as specified in 8.1.3.9 - almost identical to 0x40000/i */
  130. extern const int32_t ff_vc1_dqscale[63];
  131. #endif /* VC1DATA_H */