rv40data.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * RealVideo 4 decoder
  3. * copyright (c) 2007 Konstantin Shishkov
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. /**
  22. * @file libavcodec/rv40data.h
  23. * miscellaneous RV40 tables
  24. */
  25. #ifndef AVCODEC_RV40DATA_H
  26. #define AVCODEC_RV40DATA_H
  27. #include <stdint.h>
  28. /**
  29. * standard widths and heights coded in RV40
  30. */
  31. //@{
  32. static const int rv40_standard_widths[] = { 160, 172, 240, 320, 352, 640, 704, 0};
  33. static const int rv40_standard_heights[] = { 120, 132, 144, 240, 288, 480, -8, -10, 180, 360, 576, 0};
  34. //@}
  35. #define MODE2_PATTERNS_NUM 20
  36. /**
  37. * intra types table
  38. *
  39. * These values are actually coded 3-tuples
  40. * used for detecting standard block configurations.
  41. */
  42. static const uint16_t rv40_aic_table_index[MODE2_PATTERNS_NUM] = {
  43. 0x000, 0x100, 0x200,
  44. 0x011, 0x111, 0x211, 0x511, 0x611,
  45. 0x022, 0x122, 0x222, 0x722,
  46. 0x272, 0x227,
  47. 0x822, 0x282, 0x228,
  48. 0x112, 0x116, 0x221
  49. };
  50. /**
  51. * luma quantizer values
  52. * The second table is used for inter blocks.
  53. */
  54. static const uint8_t rv40_luma_dc_quant[2][32] = {
  55. { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  56. 16, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 22, 22, 22, 22 },
  57. { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  58. 16, 17, 18, 19, 20, 20, 21, 21, 22, 23, 23, 23, 24, 24, 24, 24 }
  59. };
  60. /**
  61. * @begingroup loopfilter coefficients used by the RV40 loop filter
  62. * @{
  63. */
  64. /**
  65. * dither values for deblocking filter - left/top values
  66. */
  67. static const uint8_t rv40_dither_l[16] = {
  68. 0x40, 0x50, 0x20, 0x60, 0x30, 0x50, 0x40, 0x30,
  69. 0x50, 0x40, 0x50, 0x30, 0x60, 0x20, 0x50, 0x40
  70. };
  71. /**
  72. * dither values for deblocking filter - right/bottom values
  73. */
  74. static const uint8_t rv40_dither_r[16] = {
  75. 0x40, 0x30, 0x60, 0x20, 0x50, 0x30, 0x30, 0x40,
  76. 0x40, 0x40, 0x50, 0x30, 0x20, 0x60, 0x30, 0x40
  77. };
  78. /** alpha parameter for RV40 loop filter - almost the same as in JVT-A003r1 */
  79. static const uint8_t rv40_alpha_tab[32] = {
  80. 128, 128, 128, 128, 128, 128, 128, 128,
  81. 128, 128, 122, 96, 75, 59, 47, 37,
  82. 29, 23, 18, 15, 13, 11, 10, 9,
  83. 8, 7, 6, 5, 4, 3, 2, 1
  84. };
  85. /** beta parameter for RV40 loop filter - almost the same as in JVT-A003r1 */
  86. static const uint8_t rv40_beta_tab[32] = {
  87. 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 4, 4, 4, 6, 6,
  88. 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 13, 14, 15, 16, 17
  89. };
  90. /** clip table for RV40 loop filter - the same as in JVT-A003r1 */
  91. static const uint8_t rv40_filter_clip_tbl[3][32] = {
  92. {
  93. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  94. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  95. },
  96. {
  97. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
  98. 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 5, 5
  99. },
  100. {
  101. 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
  102. 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 7, 8, 9
  103. }
  104. };
  105. /** @} */ // end loopfilter group
  106. #endif /* AVCODEC_RV40DATA_H */