FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/tests/checkasm/hevc_pel.c
Date: 2025-01-20 09:27:23
Exec Total Coverage
Lines: 274 274 100.0%
Functions: 11 11 100.0%
Branches: 233 318 73.3%

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