1 /***************************************************************************** 2 * predict.h: intra prediction 3 ***************************************************************************** 4 * Copyright (C) 2003-2021 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 27 #ifndef X264_PREDICT_H 28 #define X264_PREDICT_H 29 30 typedef void (*x264_predict_t)( pixel *src ); 31 typedef void (*x264_predict8x8_t)( pixel *src, pixel edge[36] ); 32 typedef void (*x264_predict_8x8_filter_t)( pixel *src, pixel edge[36], int i_neighbor, int i_filters ); 33 34 enum intra_chroma_pred_e 35 { 36 I_PRED_CHROMA_DC = 0, 37 I_PRED_CHROMA_H = 1, 38 I_PRED_CHROMA_V = 2, 39 I_PRED_CHROMA_P = 3, 40 41 I_PRED_CHROMA_DC_LEFT = 4, 42 I_PRED_CHROMA_DC_TOP = 5, 43 I_PRED_CHROMA_DC_128 = 6 44 }; 45 static const uint8_t x264_mb_chroma_pred_mode_fix[7] = 46 { 47 I_PRED_CHROMA_DC, I_PRED_CHROMA_H, I_PRED_CHROMA_V, I_PRED_CHROMA_P, 48 I_PRED_CHROMA_DC, I_PRED_CHROMA_DC,I_PRED_CHROMA_DC 49 }; 50 51 enum intra16x16_pred_e 52 { 53 I_PRED_16x16_V = 0, 54 I_PRED_16x16_H = 1, 55 I_PRED_16x16_DC = 2, 56 I_PRED_16x16_P = 3, 57 58 I_PRED_16x16_DC_LEFT = 4, 59 I_PRED_16x16_DC_TOP = 5, 60 I_PRED_16x16_DC_128 = 6, 61 }; 62 static const uint8_t x264_mb_pred_mode16x16_fix[7] = 63 { 64 I_PRED_16x16_V, I_PRED_16x16_H, I_PRED_16x16_DC, I_PRED_16x16_P, 65 I_PRED_16x16_DC,I_PRED_16x16_DC,I_PRED_16x16_DC 66 }; 67 68 enum intra4x4_pred_e 69 { 70 I_PRED_4x4_V = 0, 71 I_PRED_4x4_H = 1, 72 I_PRED_4x4_DC = 2, 73 I_PRED_4x4_DDL= 3, 74 I_PRED_4x4_DDR= 4, 75 I_PRED_4x4_VR = 5, 76 I_PRED_4x4_HD = 6, 77 I_PRED_4x4_VL = 7, 78 I_PRED_4x4_HU = 8, 79 80 I_PRED_4x4_DC_LEFT = 9, 81 I_PRED_4x4_DC_TOP = 10, 82 I_PRED_4x4_DC_128 = 11, 83 }; 84 static const int8_t x264_mb_pred_mode4x4_fix[13] = 85 { 86 -1, 87 I_PRED_4x4_V, I_PRED_4x4_H, I_PRED_4x4_DC, 88 I_PRED_4x4_DDL, I_PRED_4x4_DDR, I_PRED_4x4_VR, 89 I_PRED_4x4_HD, I_PRED_4x4_VL, I_PRED_4x4_HU, 90 I_PRED_4x4_DC, I_PRED_4x4_DC, I_PRED_4x4_DC 91 }; 92 #define x264_mb_pred_mode4x4_fix(t) x264_mb_pred_mode4x4_fix[(t)+1] 93 94 /* must use the same numbering as intra4x4_pred_e */ 95 enum intra8x8_pred_e 96 { 97 I_PRED_8x8_V = 0, 98 I_PRED_8x8_H = 1, 99 I_PRED_8x8_DC = 2, 100 I_PRED_8x8_DDL= 3, 101 I_PRED_8x8_DDR= 4, 102 I_PRED_8x8_VR = 5, 103 I_PRED_8x8_HD = 6, 104 I_PRED_8x8_VL = 7, 105 I_PRED_8x8_HU = 8, 106 107 I_PRED_8x8_DC_LEFT = 9, 108 I_PRED_8x8_DC_TOP = 10, 109 I_PRED_8x8_DC_128 = 11, 110 }; 111 112 #define x264_predict_8x8_dc_c x264_template(predict_8x8_dc_c) 113 void x264_predict_8x8_dc_c ( pixel *src, pixel edge[36] ); 114 #define x264_predict_8x8_h_c x264_template(predict_8x8_h_c) 115 void x264_predict_8x8_h_c ( pixel *src, pixel edge[36] ); 116 #define x264_predict_8x8_v_c x264_template(predict_8x8_v_c) 117 void x264_predict_8x8_v_c ( pixel *src, pixel edge[36] ); 118 #define x264_predict_4x4_dc_c x264_template(predict_4x4_dc_c) 119 void x264_predict_4x4_dc_c ( pixel *src ); 120 #define x264_predict_4x4_h_c x264_template(predict_4x4_h_c) 121 void x264_predict_4x4_h_c ( pixel *src ); 122 #define x264_predict_4x4_v_c x264_template(predict_4x4_v_c) 123 void x264_predict_4x4_v_c ( pixel *src ); 124 #define x264_predict_16x16_dc_c x264_template(predict_16x16_dc_c) 125 void x264_predict_16x16_dc_c( pixel *src ); 126 #define x264_predict_16x16_h_c x264_template(predict_16x16_h_c) 127 void x264_predict_16x16_h_c ( pixel *src ); 128 #define x264_predict_16x16_v_c x264_template(predict_16x16_v_c) 129 void x264_predict_16x16_v_c ( pixel *src ); 130 #define x264_predict_16x16_p_c x264_template(predict_16x16_p_c) 131 void x264_predict_16x16_p_c ( pixel *src ); 132 #define x264_predict_8x8c_dc_c x264_template(predict_8x8c_dc_c) 133 void x264_predict_8x8c_dc_c ( pixel *src ); 134 #define x264_predict_8x8c_h_c x264_template(predict_8x8c_h_c) 135 void x264_predict_8x8c_h_c ( pixel *src ); 136 #define x264_predict_8x8c_v_c x264_template(predict_8x8c_v_c) 137 void x264_predict_8x8c_v_c ( pixel *src ); 138 #define x264_predict_8x8c_p_c x264_template(predict_8x8c_p_c) 139 void x264_predict_8x8c_p_c ( pixel *src ); 140 #define x264_predict_8x16c_dc_c x264_template(predict_8x16c_dc_c) 141 void x264_predict_8x16c_dc_c( pixel *src ); 142 #define x264_predict_8x16c_h_c x264_template(predict_8x16c_h_c) 143 void x264_predict_8x16c_h_c ( pixel *src ); 144 #define x264_predict_8x16c_v_c x264_template(predict_8x16c_v_c) 145 void x264_predict_8x16c_v_c ( pixel *src ); 146 #define x264_predict_8x16c_p_c x264_template(predict_8x16c_p_c) 147 void x264_predict_8x16c_p_c ( pixel *src ); 148 149 #define x264_predict_16x16_init x264_template(predict_16x16_init) 150 void x264_predict_16x16_init ( uint32_t cpu, x264_predict_t pf[7] ); 151 #define x264_predict_8x8c_init x264_template(predict_8x8c_init) 152 void x264_predict_8x8c_init ( uint32_t cpu, x264_predict_t pf[7] ); 153 #define x264_predict_8x16c_init x264_template(predict_8x16c_init) 154 void x264_predict_8x16c_init ( uint32_t cpu, x264_predict_t pf[7] ); 155 #define x264_predict_4x4_init x264_template(predict_4x4_init) 156 void x264_predict_4x4_init ( uint32_t cpu, x264_predict_t pf[12] ); 157 #define x264_predict_8x8_init x264_template(predict_8x8_init) 158 void x264_predict_8x8_init ( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter ); 159 160 #endif 161