FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/tests/checkasm/hevc_pel.c
Date: 2026-04-24 10:13:59
Exec Total Coverage
Lines: 292 292 100.0%
Functions: 11 11 100.0%
Branches: 222 302 73.5%

Line Branch Exec Source
1 /*
2 * Copyright (c) 2015 Henrik Gramner
3 * Copyright (c) 2021 Josh Dekker
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (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
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 */
21
22 #include <string.h>
23 #include "checkasm.h"
24 #include "libavcodec/hevc/dsp.h"
25 #include "libavutil/common.h"
26 #include "libavutil/internal.h"
27 #include "libavutil/intreadwrite.h"
28
29 static const uint32_t pixel_mask[] = { 0xffffffff, 0x01ff01ff, 0x03ff03ff, 0x07ff07ff, 0x0fff0fff };
30 static const uint32_t pixel_mask16[] = { 0x00ff00ff, 0x01ff01ff, 0x03ff03ff, 0x07ff07ff, 0x0fff0fff };
31 static const int sizes[] = { -1, 4, 6, 8, 12, 16, 24, 32, 48, 64 };
32 static const int weights[] = { 0, 128, 255, -1 };
33 static const int denoms[] = {0, 7, 12, -1 };
34 static const int offsets[] = {0, 255, -1 };
35
36 #define SIZEOF_PIXEL ((bit_depth + 7) / 8)
37 #define BUF_SIZE (2 * MAX_PB_SIZE * (2 * 4 + MAX_PB_SIZE))
38
39 #define randomize_buffers() \
40 do { \
41 uint32_t mask = pixel_mask[bit_depth - 8]; \
42 int k; \
43 for (k = 0; k < BUF_SIZE + SRC_EXTRA; k += 4) { \
44 uint32_t r = rnd() & mask; \
45 AV_WN32A(buf0 + k, r); \
46 AV_WN32A(buf1 + k, r); \
47 } \
48 } while (0)
49
50 #define randomize_buffers_dst() \
51 do { \
52 int k; \
53 for (k = 0; k < BUF_SIZE; k += 4) { \
54 uint32_t r = rnd(); \
55 AV_WN32A(dst0 + k, r); \
56 AV_WN32A(dst1 + k, r); \
57 } \
58 } while (0)
59
60 #define randomize_buffers_ref() \
61 randomize_buffers(); \
62 do { \
63 uint32_t mask = pixel_mask16[bit_depth - 8]; \
64 int k; \
65 for (k = 0; k < BUF_SIZE; k += 2) { \
66 uint32_t r = rnd() & mask; \
67 AV_WN32A(ref0 + k, r); \
68 AV_WN32A(ref1 + k, r); \
69 } \
70 } while (0)
71
72 #define src0 (buf0 + 2 * 4 * MAX_PB_SIZE) /* hevc qpel functions read data from negative src pointer offsets */
73 #define src1 (buf1 + 2 * 4 * MAX_PB_SIZE)
74
75 /* FIXME: Does the need for SRC_EXTRA for these tests indicate a bug? */
76 #define SRC_EXTRA 8
77
78 14 static void checkasm_check_hevc_qpel(void)
79 {
80 14 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE + SRC_EXTRA]);
81 14 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE + SRC_EXTRA]);
82 14 LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
83 14 LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
84
85 HEVCDSPContext h;
86 int idx, bit_depth, i, j;
87 14 declare_func(void, int16_t *dst, const uint8_t *src, ptrdiff_t srcstride,
88 int height, intptr_t mx, intptr_t my, int width);
89
90
2/2
✓ Branch 0 taken 70 times.
✓ Branch 1 taken 14 times.
84 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
91 70 ff_hevc_dsp_init(&h, bit_depth);
92
93
2/2
✓ Branch 0 taken 140 times.
✓ Branch 1 taken 70 times.
210 for (i = 0; i < 2; i++) {
94
2/2
✓ Branch 0 taken 280 times.
✓ Branch 1 taken 140 times.
420 for (j = 0; j < 2; j++) {
95
2/2
✓ Branch 0 taken 2520 times.
✓ Branch 1 taken 280 times.
2800 for (idx = 1; idx < FF_ARRAY_ELEMS(sizes); idx++) {
96 const char *type;
97
4/5
✓ Branch 0 taken 630 times.
✓ Branch 1 taken 630 times.
✓ Branch 2 taken 630 times.
✓ Branch 3 taken 630 times.
✗ Branch 4 not taken.
2520 switch ((j << 1) | i) {
98 630 case 0: type = "pel_pixels"; break; // 0 0
99 630 case 1: type = "qpel_h"; break; // 0 1
100 630 case 2: type = "qpel_v"; break; // 1 0
101 630 case 3: type = "qpel_hv"; break; // 1 1
102 }
103
104
2/2
✓ Branch 3 taken 305 times.
✓ Branch 4 taken 2215 times.
2520 if (check_func(h.put_hevc_qpel[idx][j][i],
105 "put_hevc_%s%d_%d", type, sizes[idx], bit_depth)) {
106 305 int16_t *dstw0 = (int16_t *) dst0, *dstw1 = (int16_t *) dst1;
107
2/2
✓ Branch 1 taken 703330 times.
✓ Branch 2 taken 305 times.
703635 randomize_buffers();
108
2/2
✓ Branch 1 taken 702720 times.
✓ Branch 2 taken 305 times.
703025 randomize_buffers_dst();
109 305 call_ref(dstw0, src0, sizes[idx] * SIZEOF_PIXEL, sizes[idx], i, j, sizes[idx]);
110 305 call_new(dstw1, src1, sizes[idx] * SIZEOF_PIXEL, sizes[idx], i, j, sizes[idx]);
111 305 checkasm_check(int16_t, dstw0, MAX_PB_SIZE * sizeof(int16_t),
112 dstw1, MAX_PB_SIZE * sizeof(int16_t),
113 sizes[idx], sizes[idx], "dst");
114
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 305 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
305 bench_new(dstw1, src1, sizes[idx] * SIZEOF_PIXEL, sizes[idx], i, j, sizes[idx]);
115 }
116 }
117 }
118 }
119 }
120 14 report("qpel");
121 14 }
122
123 14 static void checkasm_check_hevc_qpel_uni(void)
124 {
125 14 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE + SRC_EXTRA]);
126 14 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE + SRC_EXTRA]);
127 14 PIXEL_RECT(dst0, 64, 64);
128 14 PIXEL_RECT(dst1, 64, 64);
129
130 HEVCDSPContext h;
131 int idx, bit_depth, i, j;
132 14 declare_func(void, uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
133 int height, intptr_t mx, intptr_t my, int width);
134
135
2/2
✓ Branch 0 taken 70 times.
✓ Branch 1 taken 14 times.
84 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
136 70 ff_hevc_dsp_init(&h, bit_depth);
137
138
2/2
✓ Branch 0 taken 140 times.
✓ Branch 1 taken 70 times.
210 for (i = 0; i < 2; i++) {
139
2/2
✓ Branch 0 taken 280 times.
✓ Branch 1 taken 140 times.
420 for (j = 0; j < 2; j++) {
140
2/2
✓ Branch 0 taken 2520 times.
✓ Branch 1 taken 280 times.
2800 for (idx = 1; idx < FF_ARRAY_ELEMS(sizes); idx++) {
141 const char *type;
142
4/5
✓ Branch 0 taken 630 times.
✓ Branch 1 taken 630 times.
✓ Branch 2 taken 630 times.
✓ Branch 3 taken 630 times.
✗ Branch 4 not taken.
2520 switch ((j << 1) | i) {
143 630 case 0: type = "pel_uni_pixels"; break; // 0 0
144 630 case 1: type = "qpel_uni_h"; break; // 0 1
145 630 case 2: type = "qpel_uni_v"; break; // 1 0
146 630 case 3: type = "qpel_uni_hv"; break; // 1 1
147 }
148
149
2/2
✓ Branch 3 taken 305 times.
✓ Branch 4 taken 2215 times.
2520 if (check_func(h.put_hevc_qpel_uni[idx][j][i],
150 "put_hevc_%s%d_%d", type, sizes[idx], bit_depth)) {
151
2/2
✓ Branch 1 taken 703330 times.
✓ Branch 2 taken 305 times.
703635 randomize_buffers();
152 305 CLEAR_PIXEL_RECT(dst0);
153 305 CLEAR_PIXEL_RECT(dst1);
154 305 call_ref(dst0, dst0_stride,
155 src0, sizes[idx] * SIZEOF_PIXEL,
156 sizes[idx], i, j, sizes[idx]);
157 305 call_new(dst1, dst1_stride,
158 src1, sizes[idx] * SIZEOF_PIXEL,
159 sizes[idx], i, j, sizes[idx]);
160
2/2
✓ Branch 0 taken 228 times.
✓ Branch 1 taken 77 times.
305 checkasm_check_pixel_padded(dst0, dst0_stride,
161 dst1, dst1_stride,
162 sizes[idx], sizes[idx], "dst");
163
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 305 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
305 bench_new(dst1, dst1_stride,
164 src1, sizes[idx] * SIZEOF_PIXEL,
165 sizes[idx], i, j, sizes[idx]);
166 }
167 }
168 }
169 }
170 }
171 14 report("qpel_uni");
172 14 }
173
174 14 static void checkasm_check_hevc_qpel_uni_w(void)
175 {
176 14 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE + SRC_EXTRA]);
177 14 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE + SRC_EXTRA]);
178 14 PIXEL_RECT(dst0, 64, 64);
179 14 PIXEL_RECT(dst1, 64, 64);
180
181 HEVCDSPContext h;
182 int idx, bit_depth, i, j;
183 const int *denom, *wx, *ox;
184 14 declare_func(void, uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
185 int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width);
186
187
2/2
✓ Branch 0 taken 70 times.
✓ Branch 1 taken 14 times.
84 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
188 70 ff_hevc_dsp_init(&h, bit_depth);
189
190
2/2
✓ Branch 0 taken 140 times.
✓ Branch 1 taken 70 times.
210 for (i = 0; i < 2; i++) {
191
2/2
✓ Branch 0 taken 280 times.
✓ Branch 1 taken 140 times.
420 for (j = 0; j < 2; j++) {
192
2/2
✓ Branch 0 taken 2520 times.
✓ Branch 1 taken 280 times.
2800 for (idx = 1; idx < FF_ARRAY_ELEMS(sizes); idx++) {
193 const char *type;
194
4/5
✓ Branch 0 taken 630 times.
✓ Branch 1 taken 630 times.
✓ Branch 2 taken 630 times.
✓ Branch 3 taken 630 times.
✗ Branch 4 not taken.
2520 switch ((j << 1) | i) {
195 630 case 0: type = "pel_uni_w_pixels"; break; // 0 0
196 630 case 1: type = "qpel_uni_w_h"; break; // 0 1
197 630 case 2: type = "qpel_uni_w_v"; break; // 1 0
198 630 case 3: type = "qpel_uni_w_hv"; break; // 1 1
199 }
200
201
2/2
✓ Branch 3 taken 276 times.
✓ Branch 4 taken 2244 times.
2520 if (check_func(h.put_hevc_qpel_uni_w[idx][j][i],
202 "put_hevc_%s%d_%d", type, sizes[idx], bit_depth)) {
203
2/2
✓ Branch 0 taken 828 times.
✓ Branch 1 taken 276 times.
1104 for (denom = denoms; *denom >= 0; denom++) {
204
2/2
✓ Branch 0 taken 2484 times.
✓ Branch 1 taken 828 times.
3312 for (wx = weights; *wx >= 0; wx++) {
205
2/2
✓ Branch 0 taken 4968 times.
✓ Branch 1 taken 2484 times.
7452 for (ox = offsets; *ox >= 0; ox++) {
206
2/2
✓ Branch 1 taken 11456208 times.
✓ Branch 2 taken 4968 times.
11461176 randomize_buffers();
207 4968 CLEAR_PIXEL_RECT(dst0);
208 4968 CLEAR_PIXEL_RECT(dst1);
209 4968 call_ref(dst0, dst0_stride,
210 src0, sizes[idx] * SIZEOF_PIXEL,
211 sizes[idx], *denom, *wx, *ox, i, j, sizes[idx]);
212 4968 call_new(dst1, dst1_stride,
213 src1, sizes[idx] * SIZEOF_PIXEL,
214 sizes[idx], *denom, *wx, *ox, i, j, sizes[idx]);
215
2/2
✓ Branch 0 taken 3744 times.
✓ Branch 1 taken 1224 times.
4968 checkasm_check_pixel_padded(dst0, dst0_stride,
216 dst1, dst1_stride,
217 sizes[idx], sizes[idx], "dst");
218
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 4968 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
4968 bench_new(dst1, dst1_stride,
219 src1, sizes[idx] * SIZEOF_PIXEL,
220 sizes[idx], *denom, *wx, *ox, i, j, sizes[idx]);
221 }
222 }
223 }
224 }
225 }
226 }
227 }
228 }
229 14 report("qpel_uni_w");
230 14 }
231
232 14 static void checkasm_check_hevc_qpel_bi(void)
233 {
234 14 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE + SRC_EXTRA]);
235 14 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE + SRC_EXTRA]);
236 14 PIXEL_RECT(dst0, 64, 64);
237 14 PIXEL_RECT(dst1, 64, 64);
238 14 LOCAL_ALIGNED_32(int16_t, ref0, [BUF_SIZE]);
239 14 LOCAL_ALIGNED_32(int16_t, ref1, [BUF_SIZE]);
240
241 HEVCDSPContext h;
242 int idx, bit_depth, i, j;
243 14 declare_func(void, uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
244 const int16_t *src2,
245 int height, intptr_t mx, intptr_t my, int width);
246
247
2/2
✓ Branch 0 taken 70 times.
✓ Branch 1 taken 14 times.
84 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
248 70 ff_hevc_dsp_init(&h, bit_depth);
249
250
2/2
✓ Branch 0 taken 140 times.
✓ Branch 1 taken 70 times.
210 for (i = 0; i < 2; i++) {
251
2/2
✓ Branch 0 taken 280 times.
✓ Branch 1 taken 140 times.
420 for (j = 0; j < 2; j++) {
252
2/2
✓ Branch 0 taken 2520 times.
✓ Branch 1 taken 280 times.
2800 for (idx = 1; idx < FF_ARRAY_ELEMS(sizes); idx++) {
253 const char *type;
254
4/5
✓ Branch 0 taken 630 times.
✓ Branch 1 taken 630 times.
✓ Branch 2 taken 630 times.
✓ Branch 3 taken 630 times.
✗ Branch 4 not taken.
2520 switch ((j << 1) | i) {
255 630 case 0: type = "pel_bi_pixels"; break; // 0 0
256 630 case 1: type = "qpel_bi_h"; break; // 0 1
257 630 case 2: type = "qpel_bi_v"; break; // 1 0
258 630 case 3: type = "qpel_bi_hv"; break; // 1 1
259 }
260
261
2/2
✓ Branch 3 taken 305 times.
✓ Branch 4 taken 2215 times.
2520 if (check_func(h.put_hevc_qpel_bi[idx][j][i],
262 "put_hevc_%s%d_%d", type, sizes[idx], bit_depth)) {
263
4/4
✓ Branch 1 taken 703330 times.
✓ Branch 2 taken 305 times.
✓ Branch 4 taken 1405440 times.
✓ Branch 5 taken 305 times.
2109075 randomize_buffers_ref();
264 305 CLEAR_PIXEL_RECT(dst0);
265 305 CLEAR_PIXEL_RECT(dst1);
266 305 call_ref(dst0, dst0_stride,
267 src0, sizes[idx] * SIZEOF_PIXEL,
268 ref0, sizes[idx], i, j, sizes[idx]);
269 305 call_new(dst1, dst1_stride,
270 src1, sizes[idx] * SIZEOF_PIXEL,
271 ref1, sizes[idx], i, j, sizes[idx]);
272
2/2
✓ Branch 0 taken 228 times.
✓ Branch 1 taken 77 times.
305 checkasm_check_pixel_padded(dst0, dst0_stride,
273 dst1, dst1_stride,
274 sizes[idx], sizes[idx], "dst");
275
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 305 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
305 bench_new(dst1, dst1_stride,
276 src1, sizes[idx] * SIZEOF_PIXEL,
277 ref1, sizes[idx], i, j, sizes[idx]);
278 }
279 }
280 }
281 }
282 }
283 14 report("qpel_bi");
284 14 }
285
286 14 static void checkasm_check_hevc_qpel_bi_w(void)
287 {
288 14 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE + SRC_EXTRA]);
289 14 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE + SRC_EXTRA]);
290 14 PIXEL_RECT(dst0, 64, 64);
291 14 PIXEL_RECT(dst1, 64, 64);
292 14 LOCAL_ALIGNED_32(int16_t, ref0, [BUF_SIZE]);
293 14 LOCAL_ALIGNED_32(int16_t, ref1, [BUF_SIZE]);
294
295 HEVCDSPContext h;
296 int idx, bit_depth, i, j;
297 const int *denom, *wx, *ox;
298 14 declare_func(void, uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
299 const int16_t *src2,
300 int height, int denom, int wx0, int wx1,
301 int ox0, int ox1, intptr_t mx, intptr_t my, int width);
302
303
2/2
✓ Branch 0 taken 70 times.
✓ Branch 1 taken 14 times.
84 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
304 70 ff_hevc_dsp_init(&h, bit_depth);
305
306
2/2
✓ Branch 0 taken 140 times.
✓ Branch 1 taken 70 times.
210 for (i = 0; i < 2; i++) {
307
2/2
✓ Branch 0 taken 280 times.
✓ Branch 1 taken 140 times.
420 for (j = 0; j < 2; j++) {
308
2/2
✓ Branch 0 taken 2520 times.
✓ Branch 1 taken 280 times.
2800 for (idx = 1; idx < FF_ARRAY_ELEMS(sizes); idx++) {
309 const char *type;
310
4/5
✓ Branch 0 taken 630 times.
✓ Branch 1 taken 630 times.
✓ Branch 2 taken 630 times.
✓ Branch 3 taken 630 times.
✗ Branch 4 not taken.
2520 switch ((j << 1) | i) {
311 630 case 0: type = "pel_bi_w_pixels"; break; // 0 0
312 630 case 1: type = "qpel_bi_w_h"; break; // 0 1
313 630 case 2: type = "qpel_bi_w_v"; break; // 1 0
314 630 case 3: type = "qpel_bi_w_hv"; break; // 1 1
315 }
316
317
2/2
✓ Branch 3 taken 276 times.
✓ Branch 4 taken 2244 times.
2520 if (check_func(h.put_hevc_qpel_bi_w[idx][j][i],
318 "put_hevc_%s%d_%d", type, sizes[idx], bit_depth)) {
319
2/2
✓ Branch 0 taken 828 times.
✓ Branch 1 taken 276 times.
1104 for (denom = denoms; *denom >= 0; denom++) {
320
2/2
✓ Branch 0 taken 2484 times.
✓ Branch 1 taken 828 times.
3312 for (wx = weights; *wx >= 0; wx++) {
321
2/2
✓ Branch 0 taken 4968 times.
✓ Branch 1 taken 2484 times.
7452 for (ox = offsets; *ox >= 0; ox++) {
322
4/4
✓ Branch 1 taken 11456208 times.
✓ Branch 2 taken 4968 times.
✓ Branch 4 taken 22892544 times.
✓ Branch 5 taken 4968 times.
34353720 randomize_buffers_ref();
323 4968 CLEAR_PIXEL_RECT(dst0);
324 4968 CLEAR_PIXEL_RECT(dst1);
325 4968 call_ref(dst0, dst0_stride,
326 src0, sizes[idx] * SIZEOF_PIXEL,
327 ref0, sizes[idx], *denom, *wx, *wx, *ox, *ox, i, j, sizes[idx]);
328 4968 call_new(dst1, dst1_stride,
329 src1, sizes[idx] * SIZEOF_PIXEL,
330 ref1, sizes[idx], *denom, *wx, *wx, *ox, *ox, i, j, sizes[idx]);
331
2/2
✓ Branch 0 taken 3744 times.
✓ Branch 1 taken 1224 times.
4968 checkasm_check_pixel_padded(dst0, dst0_stride,
332 dst1, dst1_stride,
333 sizes[idx], sizes[idx], "dst");
334
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 4968 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
4968 bench_new(dst1, dst1_stride,
335 src1, sizes[idx] * SIZEOF_PIXEL,
336 ref1, sizes[idx], *denom, *wx, *wx, *ox, *ox, i, j, sizes[idx]);
337 }
338 }
339 }
340 }
341 }
342 }
343 }
344 }
345 14 report("qpel_bi_w");
346 14 }
347
348 #undef SRC_EXTRA
349 #define SRC_EXTRA 0
350
351 14 static void checkasm_check_hevc_epel(void)
352 {
353 14 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]);
354 14 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]);
355 14 LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
356 14 LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
357
358 HEVCDSPContext h;
359 int idx, bit_depth, i, j;
360 14 declare_func(void, int16_t *dst, const uint8_t *src, ptrdiff_t srcstride,
361 int height, intptr_t mx, intptr_t my, int width);
362
363
2/2
✓ Branch 0 taken 70 times.
✓ Branch 1 taken 14 times.
84 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
364 70 ff_hevc_dsp_init(&h, bit_depth);
365
366
2/2
✓ Branch 0 taken 140 times.
✓ Branch 1 taken 70 times.
210 for (i = 0; i < 2; i++) {
367
2/2
✓ Branch 0 taken 280 times.
✓ Branch 1 taken 140 times.
420 for (j = 0; j < 2; j++) {
368
2/2
✓ Branch 0 taken 2520 times.
✓ Branch 1 taken 280 times.
2800 for (idx = 1; idx < FF_ARRAY_ELEMS(sizes); idx++) {
369 const char *type;
370
4/5
✓ Branch 0 taken 630 times.
✓ Branch 1 taken 630 times.
✓ Branch 2 taken 630 times.
✓ Branch 3 taken 630 times.
✗ Branch 4 not taken.
2520 switch ((j << 1) | i) {
371 630 case 0: type = "pel_pixels"; break; // 0 0
372 630 case 1: type = "epel_h"; break; // 0 1
373 630 case 2: type = "epel_v"; break; // 1 0
374 630 case 3: type = "epel_hv"; break; // 1 1
375 }
376
377
2/2
✓ Branch 3 taken 243 times.
✓ Branch 4 taken 2277 times.
2520 if (check_func(h.put_hevc_epel[idx][j][i],
378 "put_hevc_%s%d_%d", type, sizes[idx], bit_depth)) {
379 243 int16_t *dstw0 = (int16_t *) dst0, *dstw1 = (int16_t *) dst1;
380
2/2
✓ Branch 1 taken 559872 times.
✓ Branch 2 taken 243 times.
560115 randomize_buffers();
381
2/2
✓ Branch 1 taken 559872 times.
✓ Branch 2 taken 243 times.
560115 randomize_buffers_dst();
382 243 call_ref(dstw0, src0, sizes[idx] * SIZEOF_PIXEL, sizes[idx], i, j, sizes[idx]);
383 243 call_new(dstw1, src1, sizes[idx] * SIZEOF_PIXEL, sizes[idx], i, j, sizes[idx]);
384 243 checkasm_check(int16_t, dstw0, MAX_PB_SIZE * sizeof(int16_t),
385 dstw1, MAX_PB_SIZE * sizeof(int16_t),
386 sizes[idx], sizes[idx], "dst");
387
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 243 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
243 bench_new(dstw1, src1, sizes[idx] * SIZEOF_PIXEL, sizes[idx], i, j, sizes[idx]);
388 }
389 }
390 }
391 }
392 }
393 14 report("epel");
394 14 }
395
396 14 static void checkasm_check_hevc_epel_uni(void)
397 {
398 14 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]);
399 14 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]);
400 14 PIXEL_RECT(dst0, 64, 64);
401 14 PIXEL_RECT(dst1, 64, 64);
402
403 HEVCDSPContext h;
404 int idx, bit_depth, i, j;
405 14 declare_func(void, uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
406 int height, intptr_t mx, intptr_t my, int width);
407
408
2/2
✓ Branch 0 taken 70 times.
✓ Branch 1 taken 14 times.
84 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
409 70 ff_hevc_dsp_init(&h, bit_depth);
410
411
2/2
✓ Branch 0 taken 140 times.
✓ Branch 1 taken 70 times.
210 for (i = 0; i < 2; i++) {
412
2/2
✓ Branch 0 taken 280 times.
✓ Branch 1 taken 140 times.
420 for (j = 0; j < 2; j++) {
413
2/2
✓ Branch 0 taken 2520 times.
✓ Branch 1 taken 280 times.
2800 for (idx = 1; idx < FF_ARRAY_ELEMS(sizes); idx++) {
414 const char *type;
415
4/5
✓ Branch 0 taken 630 times.
✓ Branch 1 taken 630 times.
✓ Branch 2 taken 630 times.
✓ Branch 3 taken 630 times.
✗ Branch 4 not taken.
2520 switch ((j << 1) | i) {
416 630 case 0: type = "pel_uni_pixels"; break; // 0 0
417 630 case 1: type = "epel_uni_h"; break; // 0 1
418 630 case 2: type = "epel_uni_v"; break; // 1 0
419 630 case 3: type = "epel_uni_hv"; break; // 1 1
420 }
421
422
2/2
✓ Branch 3 taken 243 times.
✓ Branch 4 taken 2277 times.
2520 if (check_func(h.put_hevc_epel_uni[idx][j][i],
423 "put_hevc_%s%d_%d", type, sizes[idx], bit_depth)) {
424
2/2
✓ Branch 1 taken 559872 times.
✓ Branch 2 taken 243 times.
560115 randomize_buffers();
425 243 CLEAR_PIXEL_RECT(dst0);
426 243 CLEAR_PIXEL_RECT(dst1);
427 243 call_ref(dst0, dst0_stride,
428 src0, sizes[idx] * SIZEOF_PIXEL,
429 sizes[idx], i, j, sizes[idx]);
430 243 call_new(dst1, dst1_stride,
431 src1, sizes[idx] * SIZEOF_PIXEL,
432 sizes[idx], i, j, sizes[idx]);
433
2/2
✓ Branch 0 taken 179 times.
✓ Branch 1 taken 64 times.
243 checkasm_check_pixel_padded(dst0, dst0_stride,
434 dst1, dst1_stride,
435 sizes[idx], sizes[idx], "dst");
436
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 243 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
243 bench_new(dst1, dst1_stride,
437 src1, sizes[idx] * SIZEOF_PIXEL,
438 sizes[idx], i, j, sizes[idx]);
439 }
440 }
441 }
442 }
443 }
444 14 report("epel_uni");
445 14 }
446
447 14 static void checkasm_check_hevc_epel_uni_w(void)
448 {
449 14 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]);
450 14 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]);
451 14 PIXEL_RECT(dst0, 64, 64);
452 14 PIXEL_RECT(dst1, 64, 64);
453
454 HEVCDSPContext h;
455 int idx, bit_depth, i, j;
456 const int *denom, *wx, *ox;
457 14 declare_func(void, uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
458 int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width);
459
460
2/2
✓ Branch 0 taken 70 times.
✓ Branch 1 taken 14 times.
84 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
461 70 ff_hevc_dsp_init(&h, bit_depth);
462
463
2/2
✓ Branch 0 taken 140 times.
✓ Branch 1 taken 70 times.
210 for (i = 0; i < 2; i++) {
464
2/2
✓ Branch 0 taken 280 times.
✓ Branch 1 taken 140 times.
420 for (j = 0; j < 2; j++) {
465
2/2
✓ Branch 0 taken 2520 times.
✓ Branch 1 taken 280 times.
2800 for (idx = 1; idx < FF_ARRAY_ELEMS(sizes); idx++) {
466 const char *type;
467
4/5
✓ Branch 0 taken 630 times.
✓ Branch 1 taken 630 times.
✓ Branch 2 taken 630 times.
✓ Branch 3 taken 630 times.
✗ Branch 4 not taken.
2520 switch ((j << 1) | i) {
468 630 case 0: type = "pel_uni_w_pixels"; break; // 0 0
469 630 case 1: type = "epel_uni_w_h"; break; // 0 1
470 630 case 2: type = "epel_uni_w_v"; break; // 1 0
471 630 case 3: type = "epel_uni_w_hv"; break; // 1 1
472 }
473
474
2/2
✓ Branch 3 taken 219 times.
✓ Branch 4 taken 2301 times.
2520 if (check_func(h.put_hevc_epel_uni_w[idx][j][i],
475 "put_hevc_%s%d_%d", type, sizes[idx], bit_depth)) {
476
2/2
✓ Branch 0 taken 657 times.
✓ Branch 1 taken 219 times.
876 for (denom = denoms; *denom >= 0; denom++) {
477
2/2
✓ Branch 0 taken 1971 times.
✓ Branch 1 taken 657 times.
2628 for (wx = weights; *wx >= 0; wx++) {
478
2/2
✓ Branch 0 taken 3942 times.
✓ Branch 1 taken 1971 times.
5913 for (ox = offsets; *ox >= 0; ox++) {
479
2/2
✓ Branch 1 taken 9082368 times.
✓ Branch 2 taken 3942 times.
9086310 randomize_buffers();
480 3942 CLEAR_PIXEL_RECT(dst0);
481 3942 CLEAR_PIXEL_RECT(dst1);
482 3942 call_ref(dst0, dst0_stride,
483 src0, sizes[idx] * SIZEOF_PIXEL,
484 sizes[idx], *denom, *wx, *ox, i, j, sizes[idx]);
485 3942 call_new(dst1, dst1_stride,
486 src1, sizes[idx] * SIZEOF_PIXEL,
487 sizes[idx], *denom, *wx, *ox, i, j, sizes[idx]);
488
2/2
✓ Branch 0 taken 2952 times.
✓ Branch 1 taken 990 times.
3942 checkasm_check_pixel_padded(dst0, dst0_stride,
489 dst1, dst1_stride,
490 sizes[idx], sizes[idx], "dst");
491
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 3942 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
3942 bench_new(dst1, dst1_stride,
492 src1, sizes[idx] * SIZEOF_PIXEL,
493 sizes[idx], *denom, *wx, *ox, i, j, sizes[idx]);
494 }
495 }
496 }
497 }
498 }
499 }
500 }
501 }
502 14 report("epel_uni_w");
503 14 }
504
505 14 static void checkasm_check_hevc_epel_bi(void)
506 {
507 14 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]);
508 14 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]);
509 14 PIXEL_RECT(dst0, 64, 64);
510 14 PIXEL_RECT(dst1, 64, 64);
511 14 LOCAL_ALIGNED_32(int16_t, ref0, [BUF_SIZE]);
512 14 LOCAL_ALIGNED_32(int16_t, ref1, [BUF_SIZE]);
513
514 HEVCDSPContext h;
515 int idx, bit_depth, i, j;
516 14 declare_func(void, uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
517 const int16_t *src2,
518 int height, intptr_t mx, intptr_t my, int width);
519
520
2/2
✓ Branch 0 taken 70 times.
✓ Branch 1 taken 14 times.
84 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
521 70 ff_hevc_dsp_init(&h, bit_depth);
522
523
2/2
✓ Branch 0 taken 140 times.
✓ Branch 1 taken 70 times.
210 for (i = 0; i < 2; i++) {
524
2/2
✓ Branch 0 taken 280 times.
✓ Branch 1 taken 140 times.
420 for (j = 0; j < 2; j++) {
525
2/2
✓ Branch 0 taken 2520 times.
✓ Branch 1 taken 280 times.
2800 for (idx = 1; idx < FF_ARRAY_ELEMS(sizes); idx++) {
526 const char *type;
527
4/5
✓ Branch 0 taken 630 times.
✓ Branch 1 taken 630 times.
✓ Branch 2 taken 630 times.
✓ Branch 3 taken 630 times.
✗ Branch 4 not taken.
2520 switch ((j << 1) | i) {
528 630 case 0: type = "pel_bi_pixels"; break; // 0 0
529 630 case 1: type = "epel_bi_h"; break; // 0 1
530 630 case 2: type = "epel_bi_v"; break; // 1 0
531 630 case 3: type = "epel_bi_hv"; break; // 1 1
532 }
533
534
2/2
✓ Branch 3 taken 243 times.
✓ Branch 4 taken 2277 times.
2520 if (check_func(h.put_hevc_epel_bi[idx][j][i],
535 "put_hevc_%s%d_%d", type, sizes[idx], bit_depth)) {
536
4/4
✓ Branch 1 taken 559872 times.
✓ Branch 2 taken 243 times.
✓ Branch 4 taken 1119744 times.
✓ Branch 5 taken 243 times.
1679859 randomize_buffers_ref();
537 243 CLEAR_PIXEL_RECT(dst0);
538 243 CLEAR_PIXEL_RECT(dst1);
539 243 call_ref(dst0, dst0_stride,
540 src0, sizes[idx] * SIZEOF_PIXEL,
541 ref0, sizes[idx], i, j, sizes[idx]);
542 243 call_new(dst1, dst1_stride,
543 src1, sizes[idx] * SIZEOF_PIXEL,
544 ref1, sizes[idx], i, j, sizes[idx]);
545
2/2
✓ Branch 0 taken 179 times.
✓ Branch 1 taken 64 times.
243 checkasm_check_pixel_padded(dst0, dst0_stride,
546 dst1, dst1_stride,
547 sizes[idx], sizes[idx], "dst");
548
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 243 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
243 bench_new(dst1, dst1_stride,
549 src1, sizes[idx] * SIZEOF_PIXEL,
550 ref1, sizes[idx], i, j, sizes[idx]);
551 }
552 }
553 }
554 }
555 }
556 14 report("epel_bi");
557 14 }
558
559 14 static void checkasm_check_hevc_epel_bi_w(void)
560 {
561 14 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]);
562 14 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]);
563 14 PIXEL_RECT(dst0, 64, 64);
564 14 PIXEL_RECT(dst1, 64, 64);
565 14 LOCAL_ALIGNED_32(int16_t, ref0, [BUF_SIZE]);
566 14 LOCAL_ALIGNED_32(int16_t, ref1, [BUF_SIZE]);
567
568 HEVCDSPContext h;
569 int idx, bit_depth, i, j;
570 const int *denom, *wx, *ox;
571 14 declare_func(void, uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
572 const int16_t *src2,
573 int height, int denom, int wx0, int wx1,
574 int ox0, int ox1, intptr_t mx, intptr_t my, int width);
575
576
2/2
✓ Branch 0 taken 70 times.
✓ Branch 1 taken 14 times.
84 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
577 70 ff_hevc_dsp_init(&h, bit_depth);
578
579
2/2
✓ Branch 0 taken 140 times.
✓ Branch 1 taken 70 times.
210 for (i = 0; i < 2; i++) {
580
2/2
✓ Branch 0 taken 280 times.
✓ Branch 1 taken 140 times.
420 for (j = 0; j < 2; j++) {
581
2/2
✓ Branch 0 taken 2520 times.
✓ Branch 1 taken 280 times.
2800 for (idx = 1; idx < FF_ARRAY_ELEMS(sizes); idx++) {
582 const char *type;
583
4/5
✓ Branch 0 taken 630 times.
✓ Branch 1 taken 630 times.
✓ Branch 2 taken 630 times.
✓ Branch 3 taken 630 times.
✗ Branch 4 not taken.
2520 switch ((j << 1) | i) {
584 630 case 0: type = "pel_bi_w_pixels"; break; // 0 0
585 630 case 1: type = "epel_bi_w_h"; break; // 0 1
586 630 case 2: type = "epel_bi_w_v"; break; // 1 0
587 630 case 3: type = "epel_bi_w_hv"; break; // 1 1
588 }
589
590
2/2
✓ Branch 3 taken 219 times.
✓ Branch 4 taken 2301 times.
2520 if (check_func(h.put_hevc_epel_bi_w[idx][j][i],
591 "put_hevc_%s%d_%d", type, sizes[idx], bit_depth)) {
592
2/2
✓ Branch 0 taken 657 times.
✓ Branch 1 taken 219 times.
876 for (denom = denoms; *denom >= 0; denom++) {
593
2/2
✓ Branch 0 taken 1971 times.
✓ Branch 1 taken 657 times.
2628 for (wx = weights; *wx >= 0; wx++) {
594
2/2
✓ Branch 0 taken 3942 times.
✓ Branch 1 taken 1971 times.
5913 for (ox = offsets; *ox >= 0; ox++) {
595
4/4
✓ Branch 1 taken 9082368 times.
✓ Branch 2 taken 3942 times.
✓ Branch 4 taken 18164736 times.
✓ Branch 5 taken 3942 times.
27251046 randomize_buffers_ref();
596 3942 CLEAR_PIXEL_RECT(dst0);
597 3942 CLEAR_PIXEL_RECT(dst1);
598 3942 call_ref(dst0, dst0_stride,
599 src0, sizes[idx] * SIZEOF_PIXEL,
600 ref0, sizes[idx], *denom, *wx, *wx, *ox, *ox, i, j, sizes[idx]);
601 3942 call_new(dst1, dst1_stride,
602 src1, sizes[idx] * SIZEOF_PIXEL,
603 ref1, sizes[idx], *denom, *wx, *wx, *ox, *ox, i, j, sizes[idx]);
604
2/2
✓ Branch 0 taken 2952 times.
✓ Branch 1 taken 990 times.
3942 checkasm_check_pixel_padded(dst0, dst0_stride,
605 dst1, dst1_stride,
606 sizes[idx], sizes[idx], "dst");
607
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 3942 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
3942 bench_new(dst1, dst1_stride,
608 src1, sizes[idx] * SIZEOF_PIXEL,
609 ref1, sizes[idx], *denom, *wx, *wx, *ox, *ox, i, j, sizes[idx]);
610 }
611 }
612 }
613 }
614 }
615 }
616 }
617 }
618 14 report("epel_bi_w");
619 14 }
620
621 14 void checkasm_check_hevc_pel(void)
622 {
623 14 checkasm_check_hevc_qpel();
624 14 checkasm_check_hevc_qpel_uni();
625 14 checkasm_check_hevc_qpel_uni_w();
626 14 checkasm_check_hevc_qpel_bi();
627 14 checkasm_check_hevc_qpel_bi_w();
628 14 checkasm_check_hevc_epel();
629 14 checkasm_check_hevc_epel_uni();
630 14 checkasm_check_hevc_epel_uni_w();
631 14 checkasm_check_hevc_epel_bi();
632 14 checkasm_check_hevc_epel_bi_w();
633 14 }
634