Mercurial > libavcodec.hg
comparison h264data.h @ 10866:d26e9b4d2ca1 libavcodec
Split cavlc out of h264.c.
Seems to speed the code up a little...
The placement of many generic functions between h264.c and h264.h is still open
Currently they are a little randomly placed between them.
author | michael |
---|---|
date | Wed, 13 Jan 2010 01:59:19 +0000 |
parents | 762e6bb0ba40 |
children | 13a84faba50d |
comparison
equal
deleted
inserted
replaced
10865:bcdc5343a577 | 10866:d26e9b4d2ca1 |
---|---|
35 #include "h264.h" | 35 #include "h264.h" |
36 | 36 |
37 | 37 |
38 static const uint8_t golomb_to_pict_type[5]= | 38 static const uint8_t golomb_to_pict_type[5]= |
39 {FF_P_TYPE, FF_B_TYPE, FF_I_TYPE, FF_SP_TYPE, FF_SI_TYPE}; | 39 {FF_P_TYPE, FF_B_TYPE, FF_I_TYPE, FF_SP_TYPE, FF_SI_TYPE}; |
40 | |
41 static const uint8_t golomb_to_intra4x4_cbp[48]={ | |
42 47, 31, 15, 0, 23, 27, 29, 30, 7, 11, 13, 14, 39, 43, 45, 46, | |
43 16, 3, 5, 10, 12, 19, 21, 26, 28, 35, 37, 42, 44, 1, 2, 4, | |
44 8, 17, 18, 20, 24, 6, 9, 22, 25, 32, 33, 34, 36, 40, 38, 41 | |
45 }; | |
46 | |
47 static const uint8_t golomb_to_inter_cbp[48]={ | |
48 0, 16, 1, 2, 4, 8, 32, 3, 5, 10, 12, 15, 47, 7, 11, 13, | |
49 14, 6, 9, 31, 35, 37, 42, 44, 33, 34, 36, 40, 39, 43, 45, 46, | |
50 17, 18, 20, 24, 19, 21, 26, 28, 23, 27, 29, 30, 22, 25, 38, 41 | |
51 }; | |
52 | |
53 static const uint8_t golomb_to_inter_cbp_gray[16]={ | |
54 0, 1, 2, 4, 8, 3, 5,10,12,15, 7,11,13,14, 6, 9, | |
55 }; | |
56 | |
57 static const uint8_t golomb_to_intra4x4_cbp_gray[16]={ | |
58 15, 0, 7,11,13,14, 3, 5,10,12, 1, 2, 4, 8, 6, 9, | |
59 }; | |
60 | |
61 static const uint8_t chroma_dc_coeff_token_len[4*5]={ | |
62 2, 0, 0, 0, | |
63 6, 1, 0, 0, | |
64 6, 6, 3, 0, | |
65 6, 7, 7, 6, | |
66 6, 8, 8, 7, | |
67 }; | |
68 | |
69 static const uint8_t chroma_dc_coeff_token_bits[4*5]={ | |
70 1, 0, 0, 0, | |
71 7, 1, 0, 0, | |
72 4, 6, 1, 0, | |
73 3, 3, 2, 5, | |
74 2, 3, 2, 0, | |
75 }; | |
76 | |
77 static const uint8_t coeff_token_len[4][4*17]={ | |
78 { | |
79 1, 0, 0, 0, | |
80 6, 2, 0, 0, 8, 6, 3, 0, 9, 8, 7, 5, 10, 9, 8, 6, | |
81 11,10, 9, 7, 13,11,10, 8, 13,13,11, 9, 13,13,13,10, | |
82 14,14,13,11, 14,14,14,13, 15,15,14,14, 15,15,15,14, | |
83 16,15,15,15, 16,16,16,15, 16,16,16,16, 16,16,16,16, | |
84 }, | |
85 { | |
86 2, 0, 0, 0, | |
87 6, 2, 0, 0, 6, 5, 3, 0, 7, 6, 6, 4, 8, 6, 6, 4, | |
88 8, 7, 7, 5, 9, 8, 8, 6, 11, 9, 9, 6, 11,11,11, 7, | |
89 12,11,11, 9, 12,12,12,11, 12,12,12,11, 13,13,13,12, | |
90 13,13,13,13, 13,14,13,13, 14,14,14,13, 14,14,14,14, | |
91 }, | |
92 { | |
93 4, 0, 0, 0, | |
94 6, 4, 0, 0, 6, 5, 4, 0, 6, 5, 5, 4, 7, 5, 5, 4, | |
95 7, 5, 5, 4, 7, 6, 6, 4, 7, 6, 6, 4, 8, 7, 7, 5, | |
96 8, 8, 7, 6, 9, 8, 8, 7, 9, 9, 8, 8, 9, 9, 9, 8, | |
97 10, 9, 9, 9, 10,10,10,10, 10,10,10,10, 10,10,10,10, | |
98 }, | |
99 { | |
100 6, 0, 0, 0, | |
101 6, 6, 0, 0, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 6, | |
102 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | |
103 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | |
104 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | |
105 } | |
106 }; | |
107 | |
108 static const uint8_t coeff_token_bits[4][4*17]={ | |
109 { | |
110 1, 0, 0, 0, | |
111 5, 1, 0, 0, 7, 4, 1, 0, 7, 6, 5, 3, 7, 6, 5, 3, | |
112 7, 6, 5, 4, 15, 6, 5, 4, 11,14, 5, 4, 8,10,13, 4, | |
113 15,14, 9, 4, 11,10,13,12, 15,14, 9,12, 11,10,13, 8, | |
114 15, 1, 9,12, 11,14,13, 8, 7,10, 9,12, 4, 6, 5, 8, | |
115 }, | |
116 { | |
117 3, 0, 0, 0, | |
118 11, 2, 0, 0, 7, 7, 3, 0, 7,10, 9, 5, 7, 6, 5, 4, | |
119 4, 6, 5, 6, 7, 6, 5, 8, 15, 6, 5, 4, 11,14,13, 4, | |
120 15,10, 9, 4, 11,14,13,12, 8,10, 9, 8, 15,14,13,12, | |
121 11,10, 9,12, 7,11, 6, 8, 9, 8,10, 1, 7, 6, 5, 4, | |
122 }, | |
123 { | |
124 15, 0, 0, 0, | |
125 15,14, 0, 0, 11,15,13, 0, 8,12,14,12, 15,10,11,11, | |
126 11, 8, 9,10, 9,14,13, 9, 8,10, 9, 8, 15,14,13,13, | |
127 11,14,10,12, 15,10,13,12, 11,14, 9,12, 8,10,13, 8, | |
128 13, 7, 9,12, 9,12,11,10, 5, 8, 7, 6, 1, 4, 3, 2, | |
129 }, | |
130 { | |
131 3, 0, 0, 0, | |
132 0, 1, 0, 0, 4, 5, 6, 0, 8, 9,10,11, 12,13,14,15, | |
133 16,17,18,19, 20,21,22,23, 24,25,26,27, 28,29,30,31, | |
134 32,33,34,35, 36,37,38,39, 40,41,42,43, 44,45,46,47, | |
135 48,49,50,51, 52,53,54,55, 56,57,58,59, 60,61,62,63, | |
136 } | |
137 }; | |
138 | |
139 static const uint8_t total_zeros_len[16][16]= { | |
140 {1,3,3,4,4,5,5,6,6,7,7,8,8,9,9,9}, | |
141 {3,3,3,3,3,4,4,4,4,5,5,6,6,6,6}, | |
142 {4,3,3,3,4,4,3,3,4,5,5,6,5,6}, | |
143 {5,3,4,4,3,3,3,4,3,4,5,5,5}, | |
144 {4,4,4,3,3,3,3,3,4,5,4,5}, | |
145 {6,5,3,3,3,3,3,3,4,3,6}, | |
146 {6,5,3,3,3,2,3,4,3,6}, | |
147 {6,4,5,3,2,2,3,3,6}, | |
148 {6,6,4,2,2,3,2,5}, | |
149 {5,5,3,2,2,2,4}, | |
150 {4,4,3,3,1,3}, | |
151 {4,4,2,1,3}, | |
152 {3,3,1,2}, | |
153 {2,2,1}, | |
154 {1,1}, | |
155 }; | |
156 | |
157 static const uint8_t total_zeros_bits[16][16]= { | |
158 {1,3,2,3,2,3,2,3,2,3,2,3,2,3,2,1}, | |
159 {7,6,5,4,3,5,4,3,2,3,2,3,2,1,0}, | |
160 {5,7,6,5,4,3,4,3,2,3,2,1,1,0}, | |
161 {3,7,5,4,6,5,4,3,3,2,2,1,0}, | |
162 {5,4,3,7,6,5,4,3,2,1,1,0}, | |
163 {1,1,7,6,5,4,3,2,1,1,0}, | |
164 {1,1,5,4,3,3,2,1,1,0}, | |
165 {1,1,1,3,3,2,2,1,0}, | |
166 {1,0,1,3,2,1,1,1}, | |
167 {1,0,1,3,2,1,1}, | |
168 {0,1,1,2,1,3}, | |
169 {0,1,1,1,1}, | |
170 {0,1,1,1}, | |
171 {0,1,1}, | |
172 {0,1}, | |
173 }; | |
174 | |
175 static const uint8_t chroma_dc_total_zeros_len[3][4]= { | |
176 { 1, 2, 3, 3,}, | |
177 { 1, 2, 2, 0,}, | |
178 { 1, 1, 0, 0,}, | |
179 }; | |
180 | |
181 static const uint8_t chroma_dc_total_zeros_bits[3][4]= { | |
182 { 1, 1, 1, 0,}, | |
183 { 1, 1, 0, 0,}, | |
184 { 1, 0, 0, 0,}, | |
185 }; | |
186 | |
187 static const uint8_t run_len[7][16]={ | |
188 {1,1}, | |
189 {1,2,2}, | |
190 {2,2,2,2}, | |
191 {2,2,2,3,3}, | |
192 {2,2,3,3,3,3}, | |
193 {2,3,3,3,3,3,3}, | |
194 {3,3,3,3,3,3,3,4,5,6,7,8,9,10,11}, | |
195 }; | |
196 | |
197 static const uint8_t run_bits[7][16]={ | |
198 {1,0}, | |
199 {1,1,0}, | |
200 {3,2,1,0}, | |
201 {3,2,1,1,0}, | |
202 {3,2,3,2,1,0}, | |
203 {3,0,1,3,2,5,4}, | |
204 {7,6,5,4,3,2,1,1,1,1,1,1,1,1,1}, | |
205 }; | |
206 | |
207 | 40 |
208 static const uint8_t zigzag_scan[16]={ | 41 static const uint8_t zigzag_scan[16]={ |
209 0+0*4, 1+0*4, 0+1*4, 0+2*4, | 42 0+0*4, 1+0*4, 0+1*4, 0+2*4, |
210 1+1*4, 2+0*4, 3+0*4, 2+1*4, | 43 1+1*4, 2+0*4, 3+0*4, 2+1*4, |
211 1+2*4, 0+3*4, 1+3*4, 2+2*4, | 44 1+2*4, 0+3*4, 1+3*4, 2+2*4, |