FFmpeg coverage


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