quant.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /*!
  2. ************************************************************************
  3. * \file quant.h
  4. *
  5. * \brief
  6. * definitions for quantization functions
  7. *
  8. * \author
  9. *
  10. ************************************************************************
  11. */
  12. #ifndef _QUANT_H_
  13. #define _QUANT_H_
  14. // exported variables
  15. static const int dequant_coef8[6][64] =
  16. {
  17. {
  18. 20, 19, 25, 19, 20, 19, 25, 19,
  19. 19, 18, 24, 18, 19, 18, 24, 18,
  20. 25, 24, 32, 24, 25, 24, 32, 24,
  21. 19, 18, 24, 18, 19, 18, 24, 18,
  22. 20, 19, 25, 19, 20, 19, 25, 19,
  23. 19, 18, 24, 18, 19, 18, 24, 18,
  24. 25, 24, 32, 24, 25, 24, 32, 24,
  25. 19, 18, 24, 18, 19, 18, 24, 18
  26. },
  27. {
  28. 22, 21, 28, 21, 22, 21, 28, 21,
  29. 21, 19, 26, 19, 21, 19, 26, 19,
  30. 28, 26, 35, 26, 28, 26, 35, 26,
  31. 21, 19, 26, 19, 21, 19, 26, 19,
  32. 22, 21, 28, 21, 22, 21, 28, 21,
  33. 21, 19, 26, 19, 21, 19, 26, 19,
  34. 28, 26, 35, 26, 28, 26, 35, 26,
  35. 21, 19, 26, 19, 21, 19, 26, 19
  36. },
  37. {
  38. 26, 24, 33, 24, 26, 24, 33, 24,
  39. 24, 23, 31, 23, 24, 23, 31, 23,
  40. 33, 31, 42, 31, 33, 31, 42, 31,
  41. 24, 23, 31, 23, 24, 23, 31, 23,
  42. 26, 24, 33, 24, 26, 24, 33, 24,
  43. 24, 23, 31, 23, 24, 23, 31, 23,
  44. 33, 31, 42, 31, 33, 31, 42, 31,
  45. 24, 23, 31, 23, 24, 23, 31, 23
  46. },
  47. {
  48. 28, 26, 35, 26, 28, 26, 35, 26,
  49. 26, 25, 33, 25, 26, 25, 33, 25,
  50. 35, 33, 45, 33, 35, 33, 45, 33,
  51. 26, 25, 33, 25, 26, 25, 33, 25,
  52. 28, 26, 35, 26, 28, 26, 35, 26,
  53. 26, 25, 33, 25, 26, 25, 33, 25,
  54. 35, 33, 45, 33, 35, 33, 45, 33,
  55. 26, 25, 33, 25, 26, 25, 33, 25
  56. },
  57. {
  58. 32, 30, 40, 30, 32, 30, 40, 30,
  59. 30, 28, 38, 28, 30, 28, 38, 28,
  60. 40, 38, 51, 38, 40, 38, 51, 38,
  61. 30, 28, 38, 28, 30, 28, 38, 28,
  62. 32, 30, 40, 30, 32, 30, 40, 30,
  63. 30, 28, 38, 28, 30, 28, 38, 28,
  64. 40, 38, 51, 38, 40, 38, 51, 38,
  65. 30, 28, 38, 28, 30, 28, 38, 28
  66. },
  67. {
  68. 36, 34, 46, 34, 36, 34, 46, 34,
  69. 34, 32, 43, 32, 34, 32, 43, 32,
  70. 46, 43, 58, 43, 46, 43, 58, 43,
  71. 34, 32, 43, 32, 34, 32, 43, 32,
  72. 36, 34, 46, 34, 36, 34, 46, 34,
  73. 34, 32, 43, 32, 34, 32, 43, 32,
  74. 46, 43, 58, 43, 46, 43, 58, 43,
  75. 34, 32, 43, 32, 34, 32, 43, 32
  76. }
  77. };
  78. //! Dequantization coefficients
  79. static const int dequant_coef[6][4][4] = {
  80. {
  81. { 10, 13, 10, 13},
  82. { 13, 16, 13, 16},
  83. { 10, 13, 10, 13},
  84. { 13, 16, 13, 16}},
  85. {
  86. { 11, 14, 11, 14},
  87. { 14, 18, 14, 18},
  88. { 11, 14, 11, 14},
  89. { 14, 18, 14, 18}},
  90. {
  91. { 13, 16, 13, 16},
  92. { 16, 20, 16, 20},
  93. { 13, 16, 13, 16},
  94. { 16, 20, 16, 20}},
  95. {
  96. { 14, 18, 14, 18},
  97. { 18, 23, 18, 23},
  98. { 14, 18, 14, 18},
  99. { 18, 23, 18, 23}},
  100. {
  101. { 16, 20, 16, 20},
  102. { 20, 25, 20, 25},
  103. { 16, 20, 16, 20},
  104. { 20, 25, 20, 25}},
  105. {
  106. { 18, 23, 18, 23},
  107. { 23, 29, 23, 29},
  108. { 18, 23, 18, 23},
  109. { 23, 29, 23, 29}}
  110. };
  111. static const int quant_coef[6][4][4] = {
  112. {
  113. { 13107, 8066, 13107, 8066},
  114. { 8066, 5243, 8066, 5243},
  115. { 13107, 8066, 13107, 8066},
  116. { 8066, 5243, 8066, 5243}},
  117. {
  118. { 11916, 7490, 11916, 7490},
  119. { 7490, 4660, 7490, 4660},
  120. { 11916, 7490, 11916, 7490},
  121. { 7490, 4660, 7490, 4660}},
  122. {
  123. { 10082, 6554, 10082, 6554},
  124. { 6554, 4194, 6554, 4194},
  125. { 10082, 6554, 10082, 6554},
  126. { 6554, 4194, 6554, 4194}},
  127. {
  128. { 9362, 5825, 9362, 5825},
  129. { 5825, 3647, 5825, 3647},
  130. { 9362, 5825, 9362, 5825},
  131. { 5825, 3647, 5825, 3647}},
  132. {
  133. { 8192, 5243, 8192, 5243},
  134. { 5243, 3355, 5243, 3355},
  135. { 8192, 5243, 8192, 5243},
  136. { 5243, 3355, 5243, 3355}},
  137. {
  138. { 7282, 4559, 7282, 4559},
  139. { 4559, 2893, 4559, 2893},
  140. { 7282, 4559, 7282, 4559},
  141. { 4559, 2893, 4559, 2893}}
  142. };
  143. // SP decoding parameter (EQ. 8-425)
  144. static const int A[4][4] = {
  145. { 16, 20, 16, 20},
  146. { 20, 25, 20, 25},
  147. { 16, 20, 16, 20},
  148. { 20, 25, 20, 25}
  149. };
  150. // exported functions
  151. // quantization initialization
  152. extern void init_qp_process (VideoParameters *p_Vid);
  153. extern void free_qp_matrices(VideoParameters *p_Vid);
  154. // For Q-matrix
  155. extern void assign_quant_params (Slice *currslice);
  156. extern void CalculateQuant4x4Param(Slice *currslice);
  157. #endif