FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/tests/checkasm/hevc_pel.c
Date: 2025-04-25 22:50:00
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 13 static void checkasm_check_hevc_qpel(void)
79 {
80 13 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE + SRC_EXTRA]);
81 13 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE + SRC_EXTRA]);
82 13 LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
83 13 LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
84
85 HEVCDSPContext h;
86 int size, bit_depth, i, j;
87 13 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 65 times.
✓ Branch 1 taken 13 times.
78 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
91 65 ff_hevc_dsp_init(&h, bit_depth);
92
93
2/2
✓ Branch 0 taken 130 times.
✓ Branch 1 taken 65 times.
195 for (i = 0; i < 2; i++) {
94
2/2
✓ Branch 0 taken 260 times.
✓ Branch 1 taken 130 times.
390 for (j = 0; j < 2; j++) {
95
2/2
✓ Branch 0 taken 2340 times.
✓ Branch 1 taken 260 times.
2600 for (size = 1; size < 10; size++) {
96 const char *type;
97
4/5
✓ Branch 0 taken 585 times.
✓ Branch 1 taken 585 times.
✓ Branch 2 taken 585 times.
✓ Branch 3 taken 585 times.
✗ Branch 4 not taken.
2340 switch ((j << 1) | i) {
98 585 case 0: type = "pel_pixels"; break; // 0 0
99 585 case 1: type = "qpel_h"; break; // 0 1
100 585 case 2: type = "qpel_v"; break; // 1 0
101 585 case 3: type = "qpel_hv"; break; // 1 1
102 }
103
104
2/2
✓ Branch 3 taken 305 times.
✓ Branch 4 taken 2035 times.
2340 if (check_func(h.put_hevc_qpel[size][j][i],
105 "put_hevc_%s%d_%d", type, sizes[size], 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[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
110 305 call_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
111 305 checkasm_check(int16_t, dstw0, MAX_PB_SIZE * sizeof(int16_t),
112 dstw1, MAX_PB_SIZE * sizeof(int16_t),
113 size[sizes], size[sizes], "dst");
114
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 305 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
305 bench_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
115 }
116 }
117 }
118 }
119 }
120 13 report("qpel");
121 13 }
122
123 13 static void checkasm_check_hevc_qpel_uni(void)
124 {
125 13 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE + SRC_EXTRA]);
126 13 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE + SRC_EXTRA]);
127 13 PIXEL_RECT(dst0, 64, 64);
128 13 PIXEL_RECT(dst1, 64, 64);
129
130 HEVCDSPContext h;
131 int size, bit_depth, i, j;
132 13 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 65 times.
✓ Branch 1 taken 13 times.
78 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
136 65 ff_hevc_dsp_init(&h, bit_depth);
137
138
2/2
✓ Branch 0 taken 130 times.
✓ Branch 1 taken 65 times.
195 for (i = 0; i < 2; i++) {
139
2/2
✓ Branch 0 taken 260 times.
✓ Branch 1 taken 130 times.
390 for (j = 0; j < 2; j++) {
140
2/2
✓ Branch 0 taken 2340 times.
✓ Branch 1 taken 260 times.
2600 for (size = 1; size < 10; size++) {
141 const char *type;
142
4/5
✓ Branch 0 taken 585 times.
✓ Branch 1 taken 585 times.
✓ Branch 2 taken 585 times.
✓ Branch 3 taken 585 times.
✗ Branch 4 not taken.
2340 switch ((j << 1) | i) {
143 585 case 0: type = "pel_uni_pixels"; break; // 0 0
144 585 case 1: type = "qpel_uni_h"; break; // 0 1
145 585 case 2: type = "qpel_uni_v"; break; // 1 0
146 585 case 3: type = "qpel_uni_hv"; break; // 1 1
147 }
148
149
2/2
✓ Branch 3 taken 305 times.
✓ Branch 4 taken 2035 times.
2340 if (check_func(h.put_hevc_qpel_uni[size][j][i],
150 "put_hevc_%s%d_%d", type, sizes[size], 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[size] * SIZEOF_PIXEL,
156 sizes[size], i, j, sizes[size]);
157 305 call_new(dst1, dst1_stride,
158 src1, sizes[size] * SIZEOF_PIXEL,
159 sizes[size], i, j, sizes[size]);
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 size[sizes], size[sizes], "dst");
163
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 305 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
305 bench_new(dst1, dst1_stride,
164 src1, sizes[size] * SIZEOF_PIXEL,
165 sizes[size], i, j, sizes[size]);
166 }
167 }
168 }
169 }
170 }
171 13 report("qpel_uni");
172 13 }
173
174 13 static void checkasm_check_hevc_qpel_uni_w(void)
175 {
176 13 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE + SRC_EXTRA]);
177 13 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE + SRC_EXTRA]);
178 13 PIXEL_RECT(dst0, 64, 64);
179 13 PIXEL_RECT(dst1, 64, 64);
180
181 HEVCDSPContext h;
182 int size, bit_depth, i, j;
183 const int *denom, *wx, *ox;
184 13 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 65 times.
✓ Branch 1 taken 13 times.
78 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
188 65 ff_hevc_dsp_init(&h, bit_depth);
189
190
2/2
✓ Branch 0 taken 130 times.
✓ Branch 1 taken 65 times.
195 for (i = 0; i < 2; i++) {
191
2/2
✓ Branch 0 taken 260 times.
✓ Branch 1 taken 130 times.
390 for (j = 0; j < 2; j++) {
192
2/2
✓ Branch 0 taken 2340 times.
✓ Branch 1 taken 260 times.
2600 for (size = 1; size < 10; size++) {
193 const char *type;
194
4/5
✓ Branch 0 taken 585 times.
✓ Branch 1 taken 585 times.
✓ Branch 2 taken 585 times.
✓ Branch 3 taken 585 times.
✗ Branch 4 not taken.
2340 switch ((j << 1) | i) {
195 585 case 0: type = "pel_uni_w_pixels"; break; // 0 0
196 585 case 1: type = "qpel_uni_w_h"; break; // 0 1
197 585 case 2: type = "qpel_uni_w_v"; break; // 1 0
198 585 case 3: type = "qpel_uni_w_hv"; break; // 1 1
199 }
200
201
2/2
✓ Branch 3 taken 276 times.
✓ Branch 4 taken 2064 times.
2340 if (check_func(h.put_hevc_qpel_uni_w[size][j][i],
202 "put_hevc_%s%d_%d", type, sizes[size], 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[size] * SIZEOF_PIXEL,
211 sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
212 4968 call_new(dst1, dst1_stride,
213 src1, sizes[size] * SIZEOF_PIXEL,
214 sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
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 size[sizes], size[sizes], "dst");
218
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 4968 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
4968 bench_new(dst1, dst1_stride,
219 src1, sizes[size] * SIZEOF_PIXEL,
220 sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
221 }
222 }
223 }
224 }
225 }
226 }
227 }
228 }
229 13 report("qpel_uni_w");
230 13 }
231
232 13 static void checkasm_check_hevc_qpel_bi(void)
233 {
234 13 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE + SRC_EXTRA]);
235 13 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE + SRC_EXTRA]);
236 13 PIXEL_RECT(dst0, 64, 64);
237 13 PIXEL_RECT(dst1, 64, 64);
238 13 LOCAL_ALIGNED_32(int16_t, ref0, [BUF_SIZE]);
239 13 LOCAL_ALIGNED_32(int16_t, ref1, [BUF_SIZE]);
240
241 HEVCDSPContext h;
242 int size, bit_depth, i, j;
243 13 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 65 times.
✓ Branch 1 taken 13 times.
78 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
248 65 ff_hevc_dsp_init(&h, bit_depth);
249
250
2/2
✓ Branch 0 taken 130 times.
✓ Branch 1 taken 65 times.
195 for (i = 0; i < 2; i++) {
251
2/2
✓ Branch 0 taken 260 times.
✓ Branch 1 taken 130 times.
390 for (j = 0; j < 2; j++) {
252
2/2
✓ Branch 0 taken 2340 times.
✓ Branch 1 taken 260 times.
2600 for (size = 1; size < 10; size++) {
253 const char *type;
254
4/5
✓ Branch 0 taken 585 times.
✓ Branch 1 taken 585 times.
✓ Branch 2 taken 585 times.
✓ Branch 3 taken 585 times.
✗ Branch 4 not taken.
2340 switch ((j << 1) | i) {
255 585 case 0: type = "pel_bi_pixels"; break; // 0 0
256 585 case 1: type = "qpel_bi_h"; break; // 0 1
257 585 case 2: type = "qpel_bi_v"; break; // 1 0
258 585 case 3: type = "qpel_bi_hv"; break; // 1 1
259 }
260
261
2/2
✓ Branch 3 taken 305 times.
✓ Branch 4 taken 2035 times.
2340 if (check_func(h.put_hevc_qpel_bi[size][j][i],
262 "put_hevc_%s%d_%d", type, sizes[size], 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[size] * SIZEOF_PIXEL,
268 ref0, sizes[size], i, j, sizes[size]);
269 305 call_new(dst1, dst1_stride,
270 src1, sizes[size] * SIZEOF_PIXEL,
271 ref1, sizes[size], i, j, sizes[size]);
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 size[sizes], size[sizes], "dst");
275
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 305 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
305 bench_new(dst1, dst1_stride,
276 src1, sizes[size] * SIZEOF_PIXEL,
277 ref1, sizes[size], i, j, sizes[size]);
278 }
279 }
280 }
281 }
282 }
283 13 report("qpel_bi");
284 13 }
285
286 13 static void checkasm_check_hevc_qpel_bi_w(void)
287 {
288 13 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE + SRC_EXTRA]);
289 13 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE + SRC_EXTRA]);
290 13 PIXEL_RECT(dst0, 64, 64);
291 13 PIXEL_RECT(dst1, 64, 64);
292 13 LOCAL_ALIGNED_32(int16_t, ref0, [BUF_SIZE]);
293 13 LOCAL_ALIGNED_32(int16_t, ref1, [BUF_SIZE]);
294
295 HEVCDSPContext h;
296 int size, bit_depth, i, j;
297 const int *denom, *wx, *ox;
298 13 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 65 times.
✓ Branch 1 taken 13 times.
78 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
304 65 ff_hevc_dsp_init(&h, bit_depth);
305
306
2/2
✓ Branch 0 taken 130 times.
✓ Branch 1 taken 65 times.
195 for (i = 0; i < 2; i++) {
307
2/2
✓ Branch 0 taken 260 times.
✓ Branch 1 taken 130 times.
390 for (j = 0; j < 2; j++) {
308
2/2
✓ Branch 0 taken 2340 times.
✓ Branch 1 taken 260 times.
2600 for (size = 1; size < 10; size++) {
309 const char *type;
310
4/5
✓ Branch 0 taken 585 times.
✓ Branch 1 taken 585 times.
✓ Branch 2 taken 585 times.
✓ Branch 3 taken 585 times.
✗ Branch 4 not taken.
2340 switch ((j << 1) | i) {
311 585 case 0: type = "pel_bi_w_pixels"; break; // 0 0
312 585 case 1: type = "qpel_bi_w_h"; break; // 0 1
313 585 case 2: type = "qpel_bi_w_v"; break; // 1 0
314 585 case 3: type = "qpel_bi_w_hv"; break; // 1 1
315 }
316
317
2/2
✓ Branch 3 taken 276 times.
✓ Branch 4 taken 2064 times.
2340 if (check_func(h.put_hevc_qpel_bi_w[size][j][i],
318 "put_hevc_%s%d_%d", type, sizes[size], 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[size] * SIZEOF_PIXEL,
327 ref0, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);
328 4968 call_new(dst1, dst1_stride,
329 src1, sizes[size] * SIZEOF_PIXEL,
330 ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);
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 size[sizes], size[sizes], "dst");
334
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 4968 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
4968 bench_new(dst1, dst1_stride,
335 src1, sizes[size] * SIZEOF_PIXEL,
336 ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);
337 }
338 }
339 }
340 }
341 }
342 }
343 }
344 }
345 13 report("qpel_bi_w");
346 13 }
347
348 #undef SRC_EXTRA
349 #define SRC_EXTRA 0
350
351 13 static void checkasm_check_hevc_epel(void)
352 {
353 13 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]);
354 13 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]);
355 13 LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
356 13 LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
357
358 HEVCDSPContext h;
359 int size, bit_depth, i, j;
360 13 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 65 times.
✓ Branch 1 taken 13 times.
78 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
364 65 ff_hevc_dsp_init(&h, bit_depth);
365
366
2/2
✓ Branch 0 taken 130 times.
✓ Branch 1 taken 65 times.
195 for (i = 0; i < 2; i++) {
367
2/2
✓ Branch 0 taken 260 times.
✓ Branch 1 taken 130 times.
390 for (j = 0; j < 2; j++) {
368
2/2
✓ Branch 0 taken 2340 times.
✓ Branch 1 taken 260 times.
2600 for (size = 1; size < 10; size++) {
369 const char *type;
370
4/5
✓ Branch 0 taken 585 times.
✓ Branch 1 taken 585 times.
✓ Branch 2 taken 585 times.
✓ Branch 3 taken 585 times.
✗ Branch 4 not taken.
2340 switch ((j << 1) | i) {
371 585 case 0: type = "pel_pixels"; break; // 0 0
372 585 case 1: type = "epel_h"; break; // 0 1
373 585 case 2: type = "epel_v"; break; // 1 0
374 585 case 3: type = "epel_hv"; break; // 1 1
375 }
376
377
2/2
✓ Branch 3 taken 243 times.
✓ Branch 4 taken 2097 times.
2340 if (check_func(h.put_hevc_epel[size][j][i],
378 "put_hevc_%s%d_%d", type, sizes[size], 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[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
383 243 call_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
384 243 checkasm_check(int16_t, dstw0, MAX_PB_SIZE * sizeof(int16_t),
385 dstw1, MAX_PB_SIZE * sizeof(int16_t),
386 size[sizes], size[sizes], "dst");
387
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 243 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
243 bench_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
388 }
389 }
390 }
391 }
392 }
393 13 report("epel");
394 13 }
395
396 13 static void checkasm_check_hevc_epel_uni(void)
397 {
398 13 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]);
399 13 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]);
400 13 PIXEL_RECT(dst0, 64, 64);
401 13 PIXEL_RECT(dst1, 64, 64);
402
403 HEVCDSPContext h;
404 int size, bit_depth, i, j;
405 13 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 65 times.
✓ Branch 1 taken 13 times.
78 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
409 65 ff_hevc_dsp_init(&h, bit_depth);
410
411
2/2
✓ Branch 0 taken 130 times.
✓ Branch 1 taken 65 times.
195 for (i = 0; i < 2; i++) {
412
2/2
✓ Branch 0 taken 260 times.
✓ Branch 1 taken 130 times.
390 for (j = 0; j < 2; j++) {
413
2/2
✓ Branch 0 taken 2340 times.
✓ Branch 1 taken 260 times.
2600 for (size = 1; size < 10; size++) {
414 const char *type;
415
4/5
✓ Branch 0 taken 585 times.
✓ Branch 1 taken 585 times.
✓ Branch 2 taken 585 times.
✓ Branch 3 taken 585 times.
✗ Branch 4 not taken.
2340 switch ((j << 1) | i) {
416 585 case 0: type = "pel_uni_pixels"; break; // 0 0
417 585 case 1: type = "epel_uni_h"; break; // 0 1
418 585 case 2: type = "epel_uni_v"; break; // 1 0
419 585 case 3: type = "epel_uni_hv"; break; // 1 1
420 }
421
422
2/2
✓ Branch 3 taken 243 times.
✓ Branch 4 taken 2097 times.
2340 if (check_func(h.put_hevc_epel_uni[size][j][i],
423 "put_hevc_%s%d_%d", type, sizes[size], 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[size] * SIZEOF_PIXEL,
429 sizes[size], i, j, sizes[size]);
430 243 call_new(dst1, dst1_stride,
431 src1, sizes[size] * SIZEOF_PIXEL,
432 sizes[size], i, j, sizes[size]);
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 size[sizes], size[sizes], "dst");
436
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 243 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
243 bench_new(dst1, dst1_stride,
437 src1, sizes[size] * SIZEOF_PIXEL,
438 sizes[size], i, j, sizes[size]);
439 }
440 }
441 }
442 }
443 }
444 13 report("epel_uni");
445 13 }
446
447 13 static void checkasm_check_hevc_epel_uni_w(void)
448 {
449 13 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]);
450 13 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]);
451 13 PIXEL_RECT(dst0, 64, 64);
452 13 PIXEL_RECT(dst1, 64, 64);
453
454 HEVCDSPContext h;
455 int size, bit_depth, i, j;
456 const int *denom, *wx, *ox;
457 13 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 65 times.
✓ Branch 1 taken 13 times.
78 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
461 65 ff_hevc_dsp_init(&h, bit_depth);
462
463
2/2
✓ Branch 0 taken 130 times.
✓ Branch 1 taken 65 times.
195 for (i = 0; i < 2; i++) {
464
2/2
✓ Branch 0 taken 260 times.
✓ Branch 1 taken 130 times.
390 for (j = 0; j < 2; j++) {
465
2/2
✓ Branch 0 taken 2340 times.
✓ Branch 1 taken 260 times.
2600 for (size = 1; size < 10; size++) {
466 const char *type;
467
4/5
✓ Branch 0 taken 585 times.
✓ Branch 1 taken 585 times.
✓ Branch 2 taken 585 times.
✓ Branch 3 taken 585 times.
✗ Branch 4 not taken.
2340 switch ((j << 1) | i) {
468 585 case 0: type = "pel_uni_w_pixels"; break; // 0 0
469 585 case 1: type = "epel_uni_w_h"; break; // 0 1
470 585 case 2: type = "epel_uni_w_v"; break; // 1 0
471 585 case 3: type = "epel_uni_w_hv"; break; // 1 1
472 }
473
474
2/2
✓ Branch 3 taken 219 times.
✓ Branch 4 taken 2121 times.
2340 if (check_func(h.put_hevc_epel_uni_w[size][j][i],
475 "put_hevc_%s%d_%d", type, sizes[size], 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[size] * SIZEOF_PIXEL,
484 sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
485 3942 call_new(dst1, dst1_stride,
486 src1, sizes[size] * SIZEOF_PIXEL,
487 sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
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 size[sizes], size[sizes], "dst");
491
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 3942 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
3942 bench_new(dst1, dst1_stride,
492 src1, sizes[size] * SIZEOF_PIXEL,
493 sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
494 }
495 }
496 }
497 }
498 }
499 }
500 }
501 }
502 13 report("epel_uni_w");
503 13 }
504
505 13 static void checkasm_check_hevc_epel_bi(void)
506 {
507 13 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]);
508 13 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]);
509 13 PIXEL_RECT(dst0, 64, 64);
510 13 PIXEL_RECT(dst1, 64, 64);
511 13 LOCAL_ALIGNED_32(int16_t, ref0, [BUF_SIZE]);
512 13 LOCAL_ALIGNED_32(int16_t, ref1, [BUF_SIZE]);
513
514 HEVCDSPContext h;
515 int size, bit_depth, i, j;
516 13 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 65 times.
✓ Branch 1 taken 13 times.
78 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
521 65 ff_hevc_dsp_init(&h, bit_depth);
522
523
2/2
✓ Branch 0 taken 130 times.
✓ Branch 1 taken 65 times.
195 for (i = 0; i < 2; i++) {
524
2/2
✓ Branch 0 taken 260 times.
✓ Branch 1 taken 130 times.
390 for (j = 0; j < 2; j++) {
525
2/2
✓ Branch 0 taken 2340 times.
✓ Branch 1 taken 260 times.
2600 for (size = 1; size < 10; size++) {
526 const char *type;
527
4/5
✓ Branch 0 taken 585 times.
✓ Branch 1 taken 585 times.
✓ Branch 2 taken 585 times.
✓ Branch 3 taken 585 times.
✗ Branch 4 not taken.
2340 switch ((j << 1) | i) {
528 585 case 0: type = "pel_bi_pixels"; break; // 0 0
529 585 case 1: type = "epel_bi_h"; break; // 0 1
530 585 case 2: type = "epel_bi_v"; break; // 1 0
531 585 case 3: type = "epel_bi_hv"; break; // 1 1
532 }
533
534
2/2
✓ Branch 3 taken 243 times.
✓ Branch 4 taken 2097 times.
2340 if (check_func(h.put_hevc_epel_bi[size][j][i],
535 "put_hevc_%s%d_%d", type, sizes[size], 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[size] * SIZEOF_PIXEL,
541 ref0, sizes[size], i, j, sizes[size]);
542 243 call_new(dst1, dst1_stride,
543 src1, sizes[size] * SIZEOF_PIXEL,
544 ref1, sizes[size], i, j, sizes[size]);
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 size[sizes], size[sizes], "dst");
548
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 243 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
243 bench_new(dst1, dst1_stride,
549 src1, sizes[size] * SIZEOF_PIXEL,
550 ref1, sizes[size], i, j, sizes[size]);
551 }
552 }
553 }
554 }
555 }
556 13 report("epel_bi");
557 13 }
558
559 13 static void checkasm_check_hevc_epel_bi_w(void)
560 {
561 13 LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]);
562 13 LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]);
563 13 PIXEL_RECT(dst0, 64, 64);
564 13 PIXEL_RECT(dst1, 64, 64);
565 13 LOCAL_ALIGNED_32(int16_t, ref0, [BUF_SIZE]);
566 13 LOCAL_ALIGNED_32(int16_t, ref1, [BUF_SIZE]);
567
568 HEVCDSPContext h;
569 int size, bit_depth, i, j;
570 const int *denom, *wx, *ox;
571 13 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 65 times.
✓ Branch 1 taken 13 times.
78 for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
577 65 ff_hevc_dsp_init(&h, bit_depth);
578
579
2/2
✓ Branch 0 taken 130 times.
✓ Branch 1 taken 65 times.
195 for (i = 0; i < 2; i++) {
580
2/2
✓ Branch 0 taken 260 times.
✓ Branch 1 taken 130 times.
390 for (j = 0; j < 2; j++) {
581
2/2
✓ Branch 0 taken 2340 times.
✓ Branch 1 taken 260 times.
2600 for (size = 1; size < 10; size++) {
582 const char *type;
583
4/5
✓ Branch 0 taken 585 times.
✓ Branch 1 taken 585 times.
✓ Branch 2 taken 585 times.
✓ Branch 3 taken 585 times.
✗ Branch 4 not taken.
2340 switch ((j << 1) | i) {
584 585 case 0: type = "pel_bi_w_pixels"; break; // 0 0
585 585 case 1: type = "epel_bi_w_h"; break; // 0 1
586 585 case 2: type = "epel_bi_w_v"; break; // 1 0
587 585 case 3: type = "epel_bi_w_hv"; break; // 1 1
588 }
589
590
2/2
✓ Branch 3 taken 219 times.
✓ Branch 4 taken 2121 times.
2340 if (check_func(h.put_hevc_epel_bi_w[size][j][i],
591 "put_hevc_%s%d_%d", type, sizes[size], 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[size] * SIZEOF_PIXEL,
600 ref0, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);
601 3942 call_new(dst1, dst1_stride,
602 src1, sizes[size] * SIZEOF_PIXEL,
603 ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);
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 size[sizes], size[sizes], "dst");
607
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 3942 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
3942 bench_new(dst1, dst1_stride,
608 src1, sizes[size] * SIZEOF_PIXEL,
609 ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);
610 }
611 }
612 }
613 }
614 }
615 }
616 }
617 }
618 13 report("epel_bi_w");
619 13 }
620
621 13 void checkasm_check_hevc_pel(void)
622 {
623 13 checkasm_check_hevc_qpel();
624 13 checkasm_check_hevc_qpel_uni();
625 13 checkasm_check_hevc_qpel_uni_w();
626 13 checkasm_check_hevc_qpel_bi();
627 13 checkasm_check_hevc_qpel_bi_w();
628 13 checkasm_check_hevc_epel();
629 13 checkasm_check_hevc_epel_uni();
630 13 checkasm_check_hevc_epel_uni_w();
631 13 checkasm_check_hevc_epel_bi();
632 13 checkasm_check_hevc_epel_bi_w();
633 13 }
634