FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/h264pred.c
Date: 2021-09-23 20:34:37
Exec Total Coverage
Lines: 274 280 97.9%
Branches: 120 257 46.7%

Line Branch Exec Source
1 /*
2 * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /**
23 * @file
24 * H.264 / AVC / MPEG-4 part10 prediction functions.
25 * @author Michael Niedermayer <michaelni@gmx.at>
26 */
27
28 #include "config.h"
29 #include "libavutil/attributes.h"
30 #include "libavutil/avassert.h"
31 #include "libavutil/intreadwrite.h"
32 #include "codec_id.h"
33 #include "h264pred.h"
34 #include "mathops.h"
35
36 #define BIT_DEPTH 8
37 #include "h264pred_template.c"
38 #undef BIT_DEPTH
39
40 #define BIT_DEPTH 9
41 #include "h264pred_template.c"
42 #undef BIT_DEPTH
43
44 #define BIT_DEPTH 10
45 #include "h264pred_template.c"
46 #undef BIT_DEPTH
47
48 #define BIT_DEPTH 12
49 #include "h264pred_template.c"
50 #undef BIT_DEPTH
51
52 #define BIT_DEPTH 14
53 #include "h264pred_template.c"
54 #undef BIT_DEPTH
55
56 12962 static void pred4x4_vertical_vp8_c(uint8_t *src, const uint8_t *topright,
57 ptrdiff_t stride)
58 {
59 12962 const unsigned lt = src[-1-1*stride];
60 12962 LOAD_TOP_EDGE
61 12962 LOAD_TOP_RIGHT_EDGE
62 12962 uint32_t v = PACK_4U8((lt + 2*t0 + t1 + 2) >> 2,
63 (t0 + 2*t1 + t2 + 2) >> 2,
64 (t1 + 2*t2 + t3 + 2) >> 2,
65 (t2 + 2*t3 + t4 + 2) >> 2);
66
67 12962 AV_WN32A(src+0*stride, v);
68 12962 AV_WN32A(src+1*stride, v);
69 12962 AV_WN32A(src+2*stride, v);
70 12962 AV_WN32A(src+3*stride, v);
71 12962 }
72
73 19422 static void pred4x4_horizontal_vp8_c(uint8_t *src, const uint8_t *topright,
74 ptrdiff_t stride)
75 {
76 19422 const unsigned lt = src[-1-1*stride];
77 19422 LOAD_LEFT_EDGE
78
79 19422 AV_WN32A(src+0*stride, ((lt + 2*l0 + l1 + 2) >> 2)*0x01010101);
80 19422 AV_WN32A(src+1*stride, ((l0 + 2*l1 + l2 + 2) >> 2)*0x01010101);
81 19422 AV_WN32A(src+2*stride, ((l1 + 2*l2 + l3 + 2) >> 2)*0x01010101);
82 19422 AV_WN32A(src+3*stride, ((l2 + 2*l3 + l3 + 2) >> 2)*0x01010101);
83 19422 }
84
85 52951 static void pred4x4_down_left_svq3_c(uint8_t *src, const uint8_t *topright,
86 ptrdiff_t stride)
87 {
88 52951 LOAD_TOP_EDGE
89 52951 LOAD_LEFT_EDGE
90
91 52951 src[0+0*stride]=(l1 + t1)>>1;
92 52951 src[1+0*stride]=
93 52951 src[0+1*stride]=(l2 + t2)>>1;
94 52951 src[2+0*stride]=
95 52951 src[1+1*stride]=
96 52951 src[0+2*stride]=
97 52951 src[3+0*stride]=
98 52951 src[2+1*stride]=
99 52951 src[1+2*stride]=
100 52951 src[0+3*stride]=
101 52951 src[3+1*stride]=
102 52951 src[2+2*stride]=
103 52951 src[1+3*stride]=
104 52951 src[3+2*stride]=
105 52951 src[2+3*stride]=
106 52951 src[3+3*stride]=(l3 + t3)>>1;
107 52951 }
108
109 4445 static void pred4x4_down_left_rv40_c(uint8_t *src, const uint8_t *topright,
110 ptrdiff_t stride)
111 {
112 4445 LOAD_TOP_EDGE
113 4445 LOAD_TOP_RIGHT_EDGE
114 4445 LOAD_LEFT_EDGE
115 4445 LOAD_DOWN_LEFT_EDGE
116
117 4445 src[0+0*stride]=(t0 + t2 + 2*t1 + 2 + l0 + l2 + 2*l1 + 2)>>3;
118 4445 src[1+0*stride]=
119 4445 src[0+1*stride]=(t1 + t3 + 2*t2 + 2 + l1 + l3 + 2*l2 + 2)>>3;
120 4445 src[2+0*stride]=
121 4445 src[1+1*stride]=
122 4445 src[0+2*stride]=(t2 + t4 + 2*t3 + 2 + l2 + l4 + 2*l3 + 2)>>3;
123 4445 src[3+0*stride]=
124 4445 src[2+1*stride]=
125 4445 src[1+2*stride]=
126 4445 src[0+3*stride]=(t3 + t5 + 2*t4 + 2 + l3 + l5 + 2*l4 + 2)>>3;
127 4445 src[3+1*stride]=
128 4445 src[2+2*stride]=
129 4445 src[1+3*stride]=(t4 + t6 + 2*t5 + 2 + l4 + l6 + 2*l5 + 2)>>3;
130 4445 src[3+2*stride]=
131 4445 src[2+3*stride]=(t5 + t7 + 2*t6 + 2 + l5 + l7 + 2*l6 + 2)>>3;
132 4445 src[3+3*stride]=(t6 + t7 + 1 + l6 + l7 + 1)>>2;
133 4445 }
134
135 16271 static void pred4x4_down_left_rv40_nodown_c(uint8_t *src,
136 const uint8_t *topright,
137 ptrdiff_t stride)
138 {
139 16271 LOAD_TOP_EDGE
140 16271 LOAD_TOP_RIGHT_EDGE
141 16271 LOAD_LEFT_EDGE
142
143 16271 src[0+0*stride]=(t0 + t2 + 2*t1 + 2 + l0 + l2 + 2*l1 + 2)>>3;
144 16271 src[1+0*stride]=
145 16271 src[0+1*stride]=(t1 + t3 + 2*t2 + 2 + l1 + l3 + 2*l2 + 2)>>3;
146 16271 src[2+0*stride]=
147 16271 src[1+1*stride]=
148 16271 src[0+2*stride]=(t2 + t4 + 2*t3 + 2 + l2 + 3*l3 + 2)>>3;
149 16271 src[3+0*stride]=
150 16271 src[2+1*stride]=
151 16271 src[1+2*stride]=
152 16271 src[0+3*stride]=(t3 + t5 + 2*t4 + 2 + l3*4 + 2)>>3;
153 16271 src[3+1*stride]=
154 16271 src[2+2*stride]=
155 16271 src[1+3*stride]=(t4 + t6 + 2*t5 + 2 + l3*4 + 2)>>3;
156 16271 src[3+2*stride]=
157 16271 src[2+3*stride]=(t5 + t7 + 2*t6 + 2 + l3*4 + 2)>>3;
158 16271 src[3+3*stride]=(t6 + t7 + 1 + 2*l3 + 1)>>2;
159 16271 }
160
161 27536 static void pred4x4_vertical_left_rv40(uint8_t *src, const uint8_t *topright,
162 ptrdiff_t stride,
163 const int l0, const int l1, const int l2,
164 const int l3, const int l4)
165 {
166 27536 LOAD_TOP_EDGE
167 27536 LOAD_TOP_RIGHT_EDGE
168
169 27536 src[0+0*stride]=(2*t0 + 2*t1 + l1 + 2*l2 + l3 + 4)>>3;
170 27536 src[1+0*stride]=
171 27536 src[0+2*stride]=(t1 + t2 + 1)>>1;
172 27536 src[2+0*stride]=
173 27536 src[1+2*stride]=(t2 + t3 + 1)>>1;
174 27536 src[3+0*stride]=
175 27536 src[2+2*stride]=(t3 + t4+ 1)>>1;
176 27536 src[3+2*stride]=(t4 + t5+ 1)>>1;
177 27536 src[0+1*stride]=(t0 + 2*t1 + t2 + l2 + 2*l3 + l4 + 4)>>3;
178 27536 src[1+1*stride]=
179 27536 src[0+3*stride]=(t1 + 2*t2 + t3 + 2)>>2;
180 27536 src[2+1*stride]=
181 27536 src[1+3*stride]=(t2 + 2*t3 + t4 + 2)>>2;
182 27536 src[3+1*stride]=
183 27536 src[2+3*stride]=(t3 + 2*t4 + t5 + 2)>>2;
184 27536 src[3+3*stride]=(t4 + 2*t5 + t6 + 2)>>2;
185 27536 }
186
187 4338 static void pred4x4_vertical_left_rv40_c(uint8_t *src, const uint8_t *topright,
188 ptrdiff_t stride)
189 {
190 4338 LOAD_LEFT_EDGE
191 4338 LOAD_DOWN_LEFT_EDGE
192
193 4338 pred4x4_vertical_left_rv40(src, topright, stride, l0, l1, l2, l3, l4);
194 4338 }
195
196 23198 static void pred4x4_vertical_left_rv40_nodown_c(uint8_t *src,
197 const uint8_t *topright,
198 ptrdiff_t stride)
199 {
200 23198 LOAD_LEFT_EDGE
201
202 23198 pred4x4_vertical_left_rv40(src, topright, stride, l0, l1, l2, l3, l3);
203 23198 }
204
205 9943 static void pred4x4_vertical_left_vp8_c(uint8_t *src, const uint8_t *topright,
206 ptrdiff_t stride)
207 {
208 9943 LOAD_TOP_EDGE
209 9943 LOAD_TOP_RIGHT_EDGE
210
211 9943 src[0+0*stride]=(t0 + t1 + 1)>>1;
212 9943 src[1+0*stride]=
213 9943 src[0+2*stride]=(t1 + t2 + 1)>>1;
214 9943 src[2+0*stride]=
215 9943 src[1+2*stride]=(t2 + t3 + 1)>>1;
216 9943 src[3+0*stride]=
217 9943 src[2+2*stride]=(t3 + t4 + 1)>>1;
218 9943 src[0+1*stride]=(t0 + 2*t1 + t2 + 2)>>2;
219 9943 src[1+1*stride]=
220 9943 src[0+3*stride]=(t1 + 2*t2 + t3 + 2)>>2;
221 9943 src[2+1*stride]=
222 9943 src[1+3*stride]=(t2 + 2*t3 + t4 + 2)>>2;
223 9943 src[3+1*stride]=
224 9943 src[2+3*stride]=(t3 + 2*t4 + t5 + 2)>>2;
225 9943 src[3+2*stride]=(t4 + 2*t5 + t6 + 2)>>2;
226 9943 src[3+3*stride]=(t5 + 2*t6 + t7 + 2)>>2;
227 9943 }
228
229 2358 static void pred4x4_horizontal_up_rv40_c(uint8_t *src, const uint8_t *topright,
230 ptrdiff_t stride)
231 {
232 2358 LOAD_LEFT_EDGE
233 2358 LOAD_DOWN_LEFT_EDGE
234 2358 LOAD_TOP_EDGE
235 2358 LOAD_TOP_RIGHT_EDGE
236
237 2358 src[0+0*stride]=(t1 + 2*t2 + t3 + 2*l0 + 2*l1 + 4)>>3;
238 2358 src[1+0*stride]=(t2 + 2*t3 + t4 + l0 + 2*l1 + l2 + 4)>>3;
239 2358 src[2+0*stride]=
240 2358 src[0+1*stride]=(t3 + 2*t4 + t5 + 2*l1 + 2*l2 + 4)>>3;
241 2358 src[3+0*stride]=
242 2358 src[1+1*stride]=(t4 + 2*t5 + t6 + l1 + 2*l2 + l3 + 4)>>3;
243 2358 src[2+1*stride]=
244 2358 src[0+2*stride]=(t5 + 2*t6 + t7 + 2*l2 + 2*l3 + 4)>>3;
245 2358 src[3+1*stride]=
246 2358 src[1+2*stride]=(t6 + 3*t7 + l2 + 3*l3 + 4)>>3;
247 2358 src[3+2*stride]=
248 2358 src[1+3*stride]=(l3 + 2*l4 + l5 + 2)>>2;
249 2358 src[0+3*stride]=
250 2358 src[2+2*stride]=(t6 + t7 + l3 + l4 + 2)>>2;
251 2358 src[2+3*stride]=(l4 + l5 + 1)>>1;
252 2358 src[3+3*stride]=(l4 + 2*l5 + l6 + 2)>>2;
253 2358 }
254
255 9068 static void pred4x4_horizontal_up_rv40_nodown_c(uint8_t *src,
256 const uint8_t *topright,
257 ptrdiff_t stride)
258 {
259 9068 LOAD_LEFT_EDGE
260 9068 LOAD_TOP_EDGE
261 9068 LOAD_TOP_RIGHT_EDGE
262
263 9068 src[0+0*stride]=(t1 + 2*t2 + t3 + 2*l0 + 2*l1 + 4)>>3;
264 9068 src[1+0*stride]=(t2 + 2*t3 + t4 + l0 + 2*l1 + l2 + 4)>>3;
265 9068 src[2+0*stride]=
266 9068 src[0+1*stride]=(t3 + 2*t4 + t5 + 2*l1 + 2*l2 + 4)>>3;
267 9068 src[3+0*stride]=
268 9068 src[1+1*stride]=(t4 + 2*t5 + t6 + l1 + 2*l2 + l3 + 4)>>3;
269 9068 src[2+1*stride]=
270 9068 src[0+2*stride]=(t5 + 2*t6 + t7 + 2*l2 + 2*l3 + 4)>>3;
271 9068 src[3+1*stride]=
272 9068 src[1+2*stride]=(t6 + 3*t7 + l2 + 3*l3 + 4)>>3;
273 9068 src[3+2*stride]=
274 9068 src[1+3*stride]=l3;
275 9068 src[0+3*stride]=
276 9068 src[2+2*stride]=(t6 + t7 + 2*l3 + 2)>>2;
277 9068 src[2+3*stride]=
278 9068 src[3+3*stride]=l3;
279 9068 }
280
281 44959 static void pred4x4_tm_vp8_c(uint8_t *src, const uint8_t *topright,
282 ptrdiff_t stride)
283 {
284 44959 const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP - src[-1-stride];
285 44959 uint8_t *top = src-stride;
286 int y;
287
288
2/2
✓ Branch 0 taken 179836 times.
✓ Branch 1 taken 44959 times.
224795 for (y = 0; y < 4; y++) {
289 179836 const uint8_t *cm_in = cm + src[-1];
290 179836 src[0] = cm_in[top[0]];
291 179836 src[1] = cm_in[top[1]];
292 179836 src[2] = cm_in[top[2]];
293 179836 src[3] = cm_in[top[3]];
294 179836 src += stride;
295 }
296 44959 }
297
298 56 static void pred16x16_plane_svq3_c(uint8_t *src, ptrdiff_t stride)
299 {
300 56 pred16x16_plane_compat_8_c(src, stride, 1, 0);
301 56 }
302
303 1216 static void pred16x16_plane_rv40_c(uint8_t *src, ptrdiff_t stride)
304 {
305 1216 pred16x16_plane_compat_8_c(src, stride, 0, 1);
306 1216 }
307
308 371 static void pred16x16_tm_vp8_c(uint8_t *src, ptrdiff_t stride)
309 {
310 371 const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP - src[-1-stride];
311 371 uint8_t *top = src-stride;
312 int y;
313
314
2/2
✓ Branch 0 taken 5936 times.
✓ Branch 1 taken 371 times.
6307 for (y = 0; y < 16; y++) {
315 5936 const uint8_t *cm_in = cm + src[-1];
316 5936 src[0] = cm_in[top[0]];
317 5936 src[1] = cm_in[top[1]];
318 5936 src[2] = cm_in[top[2]];
319 5936 src[3] = cm_in[top[3]];
320 5936 src[4] = cm_in[top[4]];
321 5936 src[5] = cm_in[top[5]];
322 5936 src[6] = cm_in[top[6]];
323 5936 src[7] = cm_in[top[7]];
324 5936 src[8] = cm_in[top[8]];
325 5936 src[9] = cm_in[top[9]];
326 5936 src[10] = cm_in[top[10]];
327 5936 src[11] = cm_in[top[11]];
328 5936 src[12] = cm_in[top[12]];
329 5936 src[13] = cm_in[top[13]];
330 5936 src[14] = cm_in[top[14]];
331 5936 src[15] = cm_in[top[15]];
332 5936 src += stride;
333 }
334 371 }
335
336 9118 static void pred8x8_left_dc_rv40_c(uint8_t *src, ptrdiff_t stride)
337 {
338 int i;
339 unsigned dc0;
340
341 9118 dc0=0;
342
2/2
✓ Branch 0 taken 72944 times.
✓ Branch 1 taken 9118 times.
82062 for(i=0;i<8; i++)
343 72944 dc0+= src[-1+i*stride];
344 9118 dc0= 0x01010101*((dc0 + 4)>>3);
345
346
2/2
✓ Branch 0 taken 72944 times.
✓ Branch 1 taken 9118 times.
82062 for(i=0; i<8; i++){
347 72944 ((uint32_t*)(src+i*stride))[0]=
348 72944 ((uint32_t*)(src+i*stride))[1]= dc0;
349 }
350 9118 }
351
352 3820 static void pred8x8_top_dc_rv40_c(uint8_t *src, ptrdiff_t stride)
353 {
354 int i;
355 unsigned dc0;
356
357 3820 dc0=0;
358
2/2
✓ Branch 0 taken 30560 times.
✓ Branch 1 taken 3820 times.
34380 for(i=0;i<8; i++)
359 30560 dc0+= src[i-stride];
360 3820 dc0= 0x01010101*((dc0 + 4)>>3);
361
362
2/2
✓ Branch 0 taken 30560 times.
✓ Branch 1 taken 3820 times.
34380 for(i=0; i<8; i++){
363 30560 ((uint32_t*)(src+i*stride))[0]=
364 30560 ((uint32_t*)(src+i*stride))[1]= dc0;
365 }
366 3820 }
367
368 88724 static void pred8x8_dc_rv40_c(uint8_t *src, ptrdiff_t stride)
369 {
370 int i;
371 88724 unsigned dc0 = 0;
372
373
2/2
✓ Branch 0 taken 354896 times.
✓ Branch 1 taken 88724 times.
443620 for(i=0;i<4; i++){
374 354896 dc0+= src[-1+i*stride] + src[i-stride];
375 354896 dc0+= src[4+i-stride];
376 354896 dc0+= src[-1+(i+4)*stride];
377 }
378 88724 dc0= 0x01010101*((dc0 + 8)>>4);
379
380
2/2
✓ Branch 0 taken 354896 times.
✓ Branch 1 taken 88724 times.
443620 for(i=0; i<4; i++){
381 354896 ((uint32_t*)(src+i*stride))[0]= dc0;
382 354896 ((uint32_t*)(src+i*stride))[1]= dc0;
383 }
384
2/2
✓ Branch 0 taken 354896 times.
✓ Branch 1 taken 88724 times.
443620 for(i=4; i<8; i++){
385 354896 ((uint32_t*)(src+i*stride))[0]= dc0;
386 354896 ((uint32_t*)(src+i*stride))[1]= dc0;
387 }
388 88724 }
389
390 2843 static void pred8x8_tm_vp8_c(uint8_t *src, ptrdiff_t stride)
391 {
392 2843 const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP - src[-1-stride];
393 2843 uint8_t *top = src-stride;
394 int y;
395
396
2/2
✓ Branch 0 taken 22744 times.
✓ Branch 1 taken 2843 times.
25587 for (y = 0; y < 8; y++) {
397 22744 const uint8_t *cm_in = cm + src[-1];
398 22744 src[0] = cm_in[top[0]];
399 22744 src[1] = cm_in[top[1]];
400 22744 src[2] = cm_in[top[2]];
401 22744 src[3] = cm_in[top[3]];
402 22744 src[4] = cm_in[top[4]];
403 22744 src[5] = cm_in[top[5]];
404 22744 src[6] = cm_in[top[6]];
405 22744 src[7] = cm_in[top[7]];
406 22744 src += stride;
407 }
408 2843 }
409
410 /**
411 * Set the intra prediction function pointers.
412 */
413 1094 av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id,
414 const int bit_depth,
415 int chroma_format_idc)
416 {
417 #undef FUNC
418 #undef FUNCC
419 #define FUNC(a, depth) a ## _ ## depth
420 #define FUNCC(a, depth) a ## _ ## depth ## _c
421 #define FUNCD(a) a ## _c
422
423 #define H264_PRED(depth) \
424 if(codec_id != AV_CODEC_ID_RV40){\
425 if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) {\
426 h->pred4x4[VERT_PRED ]= FUNCD(pred4x4_vertical_vp8);\
427 h->pred4x4[HOR_PRED ]= FUNCD(pred4x4_horizontal_vp8);\
428 } else {\
429 h->pred4x4[VERT_PRED ]= FUNCC(pred4x4_vertical , depth);\
430 h->pred4x4[HOR_PRED ]= FUNCC(pred4x4_horizontal , depth);\
431 }\
432 h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc , depth);\
433 if(codec_id == AV_CODEC_ID_SVQ3)\
434 h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_svq3);\
435 else\
436 h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred4x4_down_left , depth);\
437 h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right , depth);\
438 h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right , depth);\
439 h->pred4x4[HOR_DOWN_PRED ]= FUNCC(pred4x4_horizontal_down , depth);\
440 if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) {\
441 h->pred4x4[VERT_LEFT_PRED ]= FUNCD(pred4x4_vertical_left_vp8);\
442 } else\
443 h->pred4x4[VERT_LEFT_PRED ]= FUNCC(pred4x4_vertical_left , depth);\
444 h->pred4x4[HOR_UP_PRED ]= FUNCC(pred4x4_horizontal_up , depth);\
445 if (codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) {\
446 h->pred4x4[LEFT_DC_PRED ]= FUNCC(pred4x4_left_dc , depth);\
447 h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc , depth);\
448 } else {\
449 h->pred4x4[TM_VP8_PRED ]= FUNCD(pred4x4_tm_vp8);\
450 h->pred4x4[DC_127_PRED ]= FUNCC(pred4x4_127_dc , depth);\
451 h->pred4x4[DC_129_PRED ]= FUNCC(pred4x4_129_dc , depth);\
452 h->pred4x4[VERT_VP8_PRED ]= FUNCC(pred4x4_vertical , depth);\
453 h->pred4x4[HOR_VP8_PRED ]= FUNCC(pred4x4_horizontal , depth);\
454 }\
455 if (codec_id != AV_CODEC_ID_VP8)\
456 h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\
457 }else{\
458 h->pred4x4[VERT_PRED ]= FUNCC(pred4x4_vertical , depth);\
459 h->pred4x4[HOR_PRED ]= FUNCC(pred4x4_horizontal , depth);\
460 h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc , depth);\
461 h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_rv40);\
462 h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right , depth);\
463 h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right , depth);\
464 h->pred4x4[HOR_DOWN_PRED ]= FUNCC(pred4x4_horizontal_down , depth);\
465 h->pred4x4[VERT_LEFT_PRED ]= FUNCD(pred4x4_vertical_left_rv40);\
466 h->pred4x4[HOR_UP_PRED ]= FUNCD(pred4x4_horizontal_up_rv40);\
467 h->pred4x4[LEFT_DC_PRED ]= FUNCC(pred4x4_left_dc , depth);\
468 h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc , depth);\
469 h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\
470 h->pred4x4[DIAG_DOWN_LEFT_PRED_RV40_NODOWN]= FUNCD(pred4x4_down_left_rv40_nodown);\
471 h->pred4x4[HOR_UP_PRED_RV40_NODOWN]= FUNCD(pred4x4_horizontal_up_rv40_nodown);\
472 h->pred4x4[VERT_LEFT_PRED_RV40_NODOWN]= FUNCD(pred4x4_vertical_left_rv40_nodown);\
473 }\
474 \
475 h->pred8x8l[VERT_PRED ]= FUNCC(pred8x8l_vertical , depth);\
476 h->pred8x8l[HOR_PRED ]= FUNCC(pred8x8l_horizontal , depth);\
477 h->pred8x8l[DC_PRED ]= FUNCC(pred8x8l_dc , depth);\
478 h->pred8x8l[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred8x8l_down_left , depth);\
479 h->pred8x8l[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred8x8l_down_right , depth);\
480 h->pred8x8l[VERT_RIGHT_PRED ]= FUNCC(pred8x8l_vertical_right , depth);\
481 h->pred8x8l[HOR_DOWN_PRED ]= FUNCC(pred8x8l_horizontal_down , depth);\
482 h->pred8x8l[VERT_LEFT_PRED ]= FUNCC(pred8x8l_vertical_left , depth);\
483 h->pred8x8l[HOR_UP_PRED ]= FUNCC(pred8x8l_horizontal_up , depth);\
484 h->pred8x8l[LEFT_DC_PRED ]= FUNCC(pred8x8l_left_dc , depth);\
485 h->pred8x8l[TOP_DC_PRED ]= FUNCC(pred8x8l_top_dc , depth);\
486 h->pred8x8l[DC_128_PRED ]= FUNCC(pred8x8l_128_dc , depth);\
487 \
488 if (chroma_format_idc <= 1) {\
489 h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x8_vertical , depth);\
490 h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x8_horizontal , depth);\
491 } else {\
492 h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x16_vertical , depth);\
493 h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x16_horizontal , depth);\
494 }\
495 if (codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) {\
496 if (chroma_format_idc <= 1) {\
497 h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x8_plane , depth);\
498 } else {\
499 h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x16_plane , depth);\
500 }\
501 } else\
502 h->pred8x8[PLANE_PRED8x8]= FUNCD(pred8x8_tm_vp8);\
503 if (codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP7 && \
504 codec_id != AV_CODEC_ID_VP8) {\
505 if (chroma_format_idc <= 1) {\
506 h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x8_dc , depth);\
507 h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc , depth);\
508 h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x8_top_dc , depth);\
509 h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\
510 h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\
511 h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\
512 h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\
513 } else {\
514 h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x16_dc , depth);\
515 h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x16_left_dc , depth);\
516 h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x16_top_dc , depth);\
517 h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l0t, depth);\
518 h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0lt, depth);\
519 h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l00, depth);\
520 h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0l0, depth);\
521 }\
522 }else{\
523 h->pred8x8[DC_PRED8x8 ]= FUNCD(pred8x8_dc_rv40);\
524 h->pred8x8[LEFT_DC_PRED8x8]= FUNCD(pred8x8_left_dc_rv40);\
525 h->pred8x8[TOP_DC_PRED8x8 ]= FUNCD(pred8x8_top_dc_rv40);\
526 if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) {\
527 h->pred8x8[DC_127_PRED8x8]= FUNCC(pred8x8_127_dc , depth);\
528 h->pred8x8[DC_129_PRED8x8]= FUNCC(pred8x8_129_dc , depth);\
529 }\
530 }\
531 if (chroma_format_idc <= 1) {\
532 h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x8_128_dc , depth);\
533 } else {\
534 h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x16_128_dc , depth);\
535 }\
536 \
537 h->pred16x16[DC_PRED8x8 ]= FUNCC(pred16x16_dc , depth);\
538 h->pred16x16[VERT_PRED8x8 ]= FUNCC(pred16x16_vertical , depth);\
539 h->pred16x16[HOR_PRED8x8 ]= FUNCC(pred16x16_horizontal , depth);\
540 switch(codec_id){\
541 case AV_CODEC_ID_SVQ3:\
542 h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_svq3);\
543 break;\
544 case AV_CODEC_ID_RV40:\
545 h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_rv40);\
546 break;\
547 case AV_CODEC_ID_VP7:\
548 case AV_CODEC_ID_VP8:\
549 h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_tm_vp8);\
550 h->pred16x16[DC_127_PRED8x8]= FUNCC(pred16x16_127_dc , depth);\
551 h->pred16x16[DC_129_PRED8x8]= FUNCC(pred16x16_129_dc , depth);\
552 break;\
553 default:\
554 h->pred16x16[PLANE_PRED8x8 ]= FUNCC(pred16x16_plane , depth);\
555 break;\
556 }\
557 h->pred16x16[LEFT_DC_PRED8x8]= FUNCC(pred16x16_left_dc , depth);\
558 h->pred16x16[TOP_DC_PRED8x8 ]= FUNCC(pred16x16_top_dc , depth);\
559 h->pred16x16[DC_128_PRED8x8 ]= FUNCC(pred16x16_128_dc , depth);\
560 \
561 /* special lossless h/v prediction for H.264 */ \
562 h->pred4x4_add [VERT_PRED ]= FUNCC(pred4x4_vertical_add , depth);\
563 h->pred4x4_add [ HOR_PRED ]= FUNCC(pred4x4_horizontal_add , depth);\
564 h->pred8x8l_add [VERT_PRED ]= FUNCC(pred8x8l_vertical_add , depth);\
565 h->pred8x8l_add [ HOR_PRED ]= FUNCC(pred8x8l_horizontal_add , depth);\
566 h->pred8x8l_filter_add [VERT_PRED ]= FUNCC(pred8x8l_vertical_filter_add , depth);\
567 h->pred8x8l_filter_add [ HOR_PRED ]= FUNCC(pred8x8l_horizontal_filter_add , depth);\
568 if (chroma_format_idc <= 1) {\
569 h->pred8x8_add [VERT_PRED8x8]= FUNCC(pred8x8_vertical_add , depth);\
570 h->pred8x8_add [ HOR_PRED8x8]= FUNCC(pred8x8_horizontal_add , depth);\
571 } else {\
572 h->pred8x8_add [VERT_PRED8x8]= FUNCC(pred8x16_vertical_add , depth);\
573 h->pred8x8_add [ HOR_PRED8x8]= FUNCC(pred8x16_horizontal_add , depth);\
574 }\
575 h->pred16x16_add[VERT_PRED8x8]= FUNCC(pred16x16_vertical_add , depth);\
576 h->pred16x16_add[ HOR_PRED8x8]= FUNCC(pred16x16_horizontal_add , depth);\
577
578
3/5
✓ Branch 0 taken 109 times.
✓ Branch 1 taken 141 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 844 times.
1094 switch (bit_depth) {
579 109 case 9:
580
25/46
✓ Branch 0 taken 109 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 109 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 109 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 109 times.
✓ Branch 8 taken 109 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 109 times.
✓ Branch 12 taken 109 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 109 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 109 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 55 times.
✓ Branch 19 taken 54 times.
✓ Branch 20 taken 109 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 109 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 55 times.
✓ Branch 25 taken 54 times.
✓ Branch 26 taken 109 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 109 times.
✗ Branch 29 not taken.
✓ Branch 30 taken 109 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 55 times.
✓ Branch 33 taken 54 times.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✓ Branch 38 taken 55 times.
✓ Branch 39 taken 54 times.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✓ Branch 43 taken 109 times.
✓ Branch 44 taken 55 times.
✓ Branch 45 taken 54 times.
327 H264_PRED(9)
581 109 break;
582 141 case 10:
583
25/46
✓ Branch 0 taken 141 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 141 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 141 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 141 times.
✓ Branch 8 taken 141 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 141 times.
✓ Branch 12 taken 141 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 141 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 141 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 68 times.
✓ Branch 19 taken 73 times.
✓ Branch 20 taken 141 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 141 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 68 times.
✓ Branch 25 taken 73 times.
✓ Branch 26 taken 141 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 141 times.
✗ Branch 29 not taken.
✓ Branch 30 taken 141 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 68 times.
✓ Branch 33 taken 73 times.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✓ Branch 38 taken 68 times.
✓ Branch 39 taken 73 times.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✓ Branch 43 taken 141 times.
✓ Branch 44 taken 68 times.
✓ Branch 45 taken 73 times.
423 H264_PRED(10)
584 141 break;
585 case 12:
586 H264_PRED(12)
587 break;
588 case 14:
589 H264_PRED(14)
590 break;
591 844 default:
592
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 844 times.
844 av_assert0(bit_depth<=8);
593
46/46
✓ Branch 0 taken 783 times.
✓ Branch 1 taken 61 times.
✓ Branch 2 taken 780 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 112 times.
✓ Branch 5 taken 668 times.
✓ Branch 6 taken 60 times.
✓ Branch 7 taken 723 times.
✓ Branch 8 taken 780 times.
✓ Branch 9 taken 3 times.
✓ Branch 10 taken 112 times.
✓ Branch 11 taken 668 times.
✓ Branch 12 taken 780 times.
✓ Branch 13 taken 3 times.
✓ Branch 14 taken 668 times.
✓ Branch 15 taken 112 times.
✓ Branch 16 taken 671 times.
✓ Branch 17 taken 112 times.
✓ Branch 18 taken 768 times.
✓ Branch 19 taken 76 times.
✓ Branch 20 taken 841 times.
✓ Branch 21 taken 3 times.
✓ Branch 22 taken 729 times.
✓ Branch 23 taken 112 times.
✓ Branch 24 taken 653 times.
✓ Branch 25 taken 76 times.
✓ Branch 26 taken 783 times.
✓ Branch 27 taken 61 times.
✓ Branch 28 taken 780 times.
✓ Branch 29 taken 3 times.
✓ Branch 30 taken 668 times.
✓ Branch 31 taken 112 times.
✓ Branch 32 taken 592 times.
✓ Branch 33 taken 76 times.
✓ Branch 34 taken 173 times.
✓ Branch 35 taken 3 times.
✓ Branch 36 taken 112 times.
✓ Branch 37 taken 61 times.
✓ Branch 38 taken 768 times.
✓ Branch 39 taken 76 times.
✓ Branch 40 taken 60 times.
✓ Branch 41 taken 61 times.
✓ Branch 42 taken 115 times.
✓ Branch 43 taken 608 times.
✓ Branch 44 taken 768 times.
✓ Branch 45 taken 76 times.
2241 H264_PRED(8)
594 844 break;
595 }
596
597 if (ARCH_AARCH64)
598 ff_h264_pred_init_aarch64(h, codec_id, bit_depth, chroma_format_idc);
599 if (ARCH_ARM)
600 ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc);
601 if (ARCH_X86)
602 1094 ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc);
603 if (ARCH_MIPS)
604 ff_h264_pred_init_mips(h, codec_id, bit_depth, chroma_format_idc);
605 1094 }
606