predict.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /*****************************************************************************
  2. * predict.h: intra prediction
  3. *****************************************************************************
  4. * Copyright (C) 2003-2018 x264 project
  5. *
  6. * Authors: Loren Merritt <lorenm@u.washington.edu>
  7. * Laurent Aimar <fenrir@via.ecp.fr>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
  22. *
  23. * This program is also available under a commercial proprietary license.
  24. * For more information, contact us at licensing@x264.com.
  25. *****************************************************************************/
  26. #ifndef X264_PREDICT_H
  27. #define X264_PREDICT_H
  28. typedef void (*x264_predict_t)( pixel *src );
  29. typedef void (*x264_predict8x8_t)( pixel *src, pixel edge[36] );
  30. typedef void (*x264_predict_8x8_filter_t)( pixel *src, pixel edge[36], int i_neighbor, int i_filters );
  31. enum intra_chroma_pred_e
  32. {
  33. I_PRED_CHROMA_DC = 0,
  34. I_PRED_CHROMA_H = 1,
  35. I_PRED_CHROMA_V = 2,
  36. I_PRED_CHROMA_P = 3,
  37. I_PRED_CHROMA_DC_LEFT = 4,
  38. I_PRED_CHROMA_DC_TOP = 5,
  39. I_PRED_CHROMA_DC_128 = 6
  40. };
  41. static const uint8_t x264_mb_chroma_pred_mode_fix[7] =
  42. {
  43. I_PRED_CHROMA_DC, I_PRED_CHROMA_H, I_PRED_CHROMA_V, I_PRED_CHROMA_P,
  44. I_PRED_CHROMA_DC, I_PRED_CHROMA_DC,I_PRED_CHROMA_DC
  45. };
  46. enum intra16x16_pred_e
  47. {
  48. I_PRED_16x16_V = 0,
  49. I_PRED_16x16_H = 1,
  50. I_PRED_16x16_DC = 2,
  51. I_PRED_16x16_P = 3,
  52. I_PRED_16x16_DC_LEFT = 4,
  53. I_PRED_16x16_DC_TOP = 5,
  54. I_PRED_16x16_DC_128 = 6,
  55. };
  56. static const uint8_t x264_mb_pred_mode16x16_fix[7] =
  57. {
  58. I_PRED_16x16_V, I_PRED_16x16_H, I_PRED_16x16_DC, I_PRED_16x16_P,
  59. I_PRED_16x16_DC,I_PRED_16x16_DC,I_PRED_16x16_DC
  60. };
  61. enum intra4x4_pred_e
  62. {
  63. I_PRED_4x4_V = 0,
  64. I_PRED_4x4_H = 1,
  65. I_PRED_4x4_DC = 2,
  66. I_PRED_4x4_DDL= 3,
  67. I_PRED_4x4_DDR= 4,
  68. I_PRED_4x4_VR = 5,
  69. I_PRED_4x4_HD = 6,
  70. I_PRED_4x4_VL = 7,
  71. I_PRED_4x4_HU = 8,
  72. I_PRED_4x4_DC_LEFT = 9,
  73. I_PRED_4x4_DC_TOP = 10,
  74. I_PRED_4x4_DC_128 = 11,
  75. };
  76. static const int8_t x264_mb_pred_mode4x4_fix[13] =
  77. {
  78. -1,
  79. I_PRED_4x4_V, I_PRED_4x4_H, I_PRED_4x4_DC,
  80. I_PRED_4x4_DDL, I_PRED_4x4_DDR, I_PRED_4x4_VR,
  81. I_PRED_4x4_HD, I_PRED_4x4_VL, I_PRED_4x4_HU,
  82. I_PRED_4x4_DC, I_PRED_4x4_DC, I_PRED_4x4_DC
  83. };
  84. #define x264_mb_pred_mode4x4_fix(t) x264_mb_pred_mode4x4_fix[(t)+1]
  85. /* must use the same numbering as intra4x4_pred_e */
  86. enum intra8x8_pred_e
  87. {
  88. I_PRED_8x8_V = 0,
  89. I_PRED_8x8_H = 1,
  90. I_PRED_8x8_DC = 2,
  91. I_PRED_8x8_DDL= 3,
  92. I_PRED_8x8_DDR= 4,
  93. I_PRED_8x8_VR = 5,
  94. I_PRED_8x8_HD = 6,
  95. I_PRED_8x8_VL = 7,
  96. I_PRED_8x8_HU = 8,
  97. I_PRED_8x8_DC_LEFT = 9,
  98. I_PRED_8x8_DC_TOP = 10,
  99. I_PRED_8x8_DC_128 = 11,
  100. };
  101. #define x264_predict_8x8_dc_c x264_template(predict_8x8_dc_c)
  102. void x264_predict_8x8_dc_c ( pixel *src, pixel edge[36] );
  103. #define x264_predict_8x8_h_c x264_template(predict_8x8_h_c)
  104. void x264_predict_8x8_h_c ( pixel *src, pixel edge[36] );
  105. #define x264_predict_8x8_v_c x264_template(predict_8x8_v_c)
  106. void x264_predict_8x8_v_c ( pixel *src, pixel edge[36] );
  107. #define x264_predict_4x4_dc_c x264_template(predict_4x4_dc_c)
  108. void x264_predict_4x4_dc_c ( pixel *src );
  109. #define x264_predict_4x4_h_c x264_template(predict_4x4_h_c)
  110. void x264_predict_4x4_h_c ( pixel *src );
  111. #define x264_predict_4x4_v_c x264_template(predict_4x4_v_c)
  112. void x264_predict_4x4_v_c ( pixel *src );
  113. #define x264_predict_16x16_dc_c x264_template(predict_16x16_dc_c)
  114. void x264_predict_16x16_dc_c( pixel *src );
  115. #define x264_predict_16x16_h_c x264_template(predict_16x16_h_c)
  116. void x264_predict_16x16_h_c ( pixel *src );
  117. #define x264_predict_16x16_v_c x264_template(predict_16x16_v_c)
  118. void x264_predict_16x16_v_c ( pixel *src );
  119. #define x264_predict_16x16_p_c x264_template(predict_16x16_p_c)
  120. void x264_predict_16x16_p_c ( pixel *src );
  121. #define x264_predict_8x8c_dc_c x264_template(predict_8x8c_dc_c)
  122. void x264_predict_8x8c_dc_c ( pixel *src );
  123. #define x264_predict_8x8c_h_c x264_template(predict_8x8c_h_c)
  124. void x264_predict_8x8c_h_c ( pixel *src );
  125. #define x264_predict_8x8c_v_c x264_template(predict_8x8c_v_c)
  126. void x264_predict_8x8c_v_c ( pixel *src );
  127. #define x264_predict_8x8c_p_c x264_template(predict_8x8c_p_c)
  128. void x264_predict_8x8c_p_c ( pixel *src );
  129. #define x264_predict_8x16c_dc_c x264_template(predict_8x16c_dc_c)
  130. void x264_predict_8x16c_dc_c( pixel *src );
  131. #define x264_predict_8x16c_h_c x264_template(predict_8x16c_h_c)
  132. void x264_predict_8x16c_h_c ( pixel *src );
  133. #define x264_predict_8x16c_v_c x264_template(predict_8x16c_v_c)
  134. void x264_predict_8x16c_v_c ( pixel *src );
  135. #define x264_predict_8x16c_p_c x264_template(predict_8x16c_p_c)
  136. void x264_predict_8x16c_p_c ( pixel *src );
  137. #define x264_predict_16x16_init x264_template(predict_16x16_init)
  138. void x264_predict_16x16_init ( int cpu, x264_predict_t pf[7] );
  139. #define x264_predict_8x8c_init x264_template(predict_8x8c_init)
  140. void x264_predict_8x8c_init ( int cpu, x264_predict_t pf[7] );
  141. #define x264_predict_8x16c_init x264_template(predict_8x16c_init)
  142. void x264_predict_8x16c_init ( int cpu, x264_predict_t pf[7] );
  143. #define x264_predict_4x4_init x264_template(predict_4x4_init)
  144. void x264_predict_4x4_init ( int cpu, x264_predict_t pf[12] );
  145. #define x264_predict_8x8_init x264_template(predict_8x8_init)
  146. void x264_predict_8x8_init ( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
  147. #endif