Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * Copyright (c) 2023 Institue of Software Chinese Academy of Sciences (ISCAS). | ||
3 | * | ||
4 | * This file is part of FFmpeg. | ||
5 | * | ||
6 | * FFmpeg is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * FFmpeg is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with FFmpeg; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | */ | ||
20 | |||
21 | #include <string.h> | ||
22 | |||
23 | #include "libavutil/mem_internal.h" | ||
24 | |||
25 | #include "libavcodec/aacencdsp.h" | ||
26 | |||
27 | #include "checkasm.h" | ||
28 | |||
29 | #define randomize_float(buf, len) \ | ||
30 | do { \ | ||
31 | int i; \ | ||
32 | for (i = 0; i < len; i++) { \ | ||
33 | float f = (float)rnd() / (UINT_MAX >> 5) - 16.0f; \ | ||
34 | buf[i] = f; \ | ||
35 | } \ | ||
36 | } while (0) | ||
37 | |||
38 | 13 | static void test_abs_pow34(AACEncDSPContext *s) | |
39 | { | ||
40 | #define BUF_SIZE 1024 | ||
41 | 13 | LOCAL_ALIGNED_32(float, in, [BUF_SIZE]); | |
42 | |||
43 | 13 | declare_func(void, float *, const float *, int); | |
44 | |||
45 |
2/2✓ Branch 1 taken 13312 times.
✓ Branch 2 taken 13 times.
|
13325 | randomize_float(in, BUF_SIZE); |
46 | |||
47 |
2/2✓ Branch 3 taken 2 times.
✓ Branch 4 taken 11 times.
|
13 | if (check_func(s->abs_pow34, "abs_pow34")) { |
48 | 2 | LOCAL_ALIGNED_32(float, out, [BUF_SIZE]); | |
49 | 2 | LOCAL_ALIGNED_32(float, out2, [BUF_SIZE]); | |
50 | |||
51 | 2 | call_ref(out, in, BUF_SIZE); | |
52 | 2 | call_new(out2, in, BUF_SIZE); | |
53 | |||
54 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
|
2 | if (!float_near_ulp_array(out, out2, 1, BUF_SIZE)) |
55 | ✗ | fail(); | |
56 | |||
57 |
1/8✗ Branch 1 not taken.
✓ Branch 2 taken 2 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.
|
2 | bench_new(out, in, BUF_SIZE); |
58 | } | ||
59 | |||
60 | 13 | report("abs_pow34"); | |
61 | 13 | } | |
62 | |||
63 | |||
64 | 13 | void checkasm_check_aacencdsp(void) | |
65 | { | ||
66 | 13 | AACEncDSPContext s = { 0 }; | |
67 | 13 | ff_aacenc_dsp_init(&s); | |
68 | |||
69 | 13 | test_abs_pow34(&s); | |
70 | 13 | } | |
71 |