]> git.sesse.net Git - x264/blob - common/predict.h
Update file headers throughout x264
[x264] / common / predict.h
1 /*****************************************************************************
2  * predict.h: h264 encoder library
3  *****************************************************************************
4  * Copyright (C) 2003-2008 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
24 #ifndef X264_PREDICT_H
25 #define X264_PREDICT_H
26
27 typedef void (*x264_predict_t)( uint8_t *src );
28 typedef void (*x264_predict8x8_t)( uint8_t *src, uint8_t edge[33] );
29
30 enum intra_chroma_pred_e
31 {
32     I_PRED_CHROMA_DC = 0,
33     I_PRED_CHROMA_H  = 1,
34     I_PRED_CHROMA_V  = 2,
35     I_PRED_CHROMA_P  = 3,
36
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_pred_mode8x8c_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
47 enum intra16x16_pred_e
48 {
49     I_PRED_16x16_V  = 0,
50     I_PRED_16x16_H  = 1,
51     I_PRED_16x16_DC = 2,
52     I_PRED_16x16_P  = 3,
53
54     I_PRED_16x16_DC_LEFT = 4,
55     I_PRED_16x16_DC_TOP  = 5,
56     I_PRED_16x16_DC_128  = 6,
57 };
58 static const uint8_t x264_mb_pred_mode16x16_fix[7] =
59 {
60     I_PRED_16x16_V, I_PRED_16x16_H, I_PRED_16x16_DC, I_PRED_16x16_P,
61     I_PRED_16x16_DC,I_PRED_16x16_DC,I_PRED_16x16_DC
62 };
63
64 enum intra4x4_pred_e
65 {
66     I_PRED_4x4_V  = 0,
67     I_PRED_4x4_H  = 1,
68     I_PRED_4x4_DC = 2,
69     I_PRED_4x4_DDL= 3,
70     I_PRED_4x4_DDR= 4,
71     I_PRED_4x4_VR = 5,
72     I_PRED_4x4_HD = 6,
73     I_PRED_4x4_VL = 7,
74     I_PRED_4x4_HU = 8,
75
76     I_PRED_4x4_DC_LEFT = 9,
77     I_PRED_4x4_DC_TOP  = 10,
78     I_PRED_4x4_DC_128  = 11,
79 };
80 static const int8_t x264_mb_pred_mode4x4_fix[13] =
81 {
82     -1,
83     I_PRED_4x4_V,   I_PRED_4x4_H,   I_PRED_4x4_DC,
84     I_PRED_4x4_DDL, I_PRED_4x4_DDR, I_PRED_4x4_VR,
85     I_PRED_4x4_HD,  I_PRED_4x4_VL,  I_PRED_4x4_HU,
86     I_PRED_4x4_DC,  I_PRED_4x4_DC,  I_PRED_4x4_DC
87 };
88 #define x264_mb_pred_mode4x4_fix(t) x264_mb_pred_mode4x4_fix[(t)+1]
89
90 /* must use the same numbering as intra4x4_pred_e */
91 enum intra8x8_pred_e
92 {
93     I_PRED_8x8_V  = 0,
94     I_PRED_8x8_H  = 1,
95     I_PRED_8x8_DC = 2,
96     I_PRED_8x8_DDL= 3,
97     I_PRED_8x8_DDR= 4,
98     I_PRED_8x8_VR = 5,
99     I_PRED_8x8_HD = 6,
100     I_PRED_8x8_VL = 7,
101     I_PRED_8x8_HU = 8,
102
103     I_PRED_8x8_DC_LEFT = 9,
104     I_PRED_8x8_DC_TOP  = 10,
105     I_PRED_8x8_DC_128  = 11,
106 };
107
108 // FIXME enforce edge alignment via uint64_t ?
109 void x264_predict_8x8_filter( uint8_t *src, uint8_t edge[33], int i_neighbor, int i_filters );
110
111 void x264_predict_16x16_init ( int cpu, x264_predict_t pf[7] );
112 void x264_predict_8x8c_init  ( int cpu, x264_predict_t pf[7] );
113 void x264_predict_4x4_init   ( int cpu, x264_predict_t pf[12] );
114 void x264_predict_8x8_init   ( int cpu, x264_predict8x8_t pf[12] );
115
116
117 #endif