Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * This file is part of FFmpeg. | ||
3 | * | ||
4 | * FFmpeg is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU Lesser General Public | ||
6 | * License as published by the Free Software Foundation; either | ||
7 | * version 2.1 of the License, or (at your option) any later version. | ||
8 | * | ||
9 | * FFmpeg is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | * Lesser General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU Lesser General Public | ||
15 | * License along with FFmpeg; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
17 | */ | ||
18 | |||
19 | #include <stdint.h> | ||
20 | |||
21 | #include "libavutil/attributes.h" | ||
22 | #include "libavutil/common.h" | ||
23 | #include "audiodsp.h" | ||
24 | |||
25 | 3755 | static void vector_clipf_c(float *dst, const float *src, int len, | |
26 | float min, float max) | ||
27 | { | ||
28 |
2/2✓ Branch 0 taken 87448 times.
✓ Branch 1 taken 3755 times.
|
91203 | for (int i = 0; i < len; i += 8) { |
29 | float tmp[8]; | ||
30 | |||
31 |
2/2✓ Branch 0 taken 699584 times.
✓ Branch 1 taken 87448 times.
|
787032 | for (int j = 0; j < 8; j++) |
32 | 699584 | tmp[j]= av_clipf(src[i + j], min, max); | |
33 |
2/2✓ Branch 0 taken 699584 times.
✓ Branch 1 taken 87448 times.
|
787032 | for (int j = 0; j < 8; j++) |
34 | 699584 | dst[i + j] = tmp[j]; | |
35 | } | ||
36 | 3755 | } | |
37 | |||
38 | 861032 | static int32_t scalarproduct_int16_c(const int16_t *v1, const int16_t *v2, | |
39 | int order) | ||
40 | { | ||
41 | 861032 | unsigned res = 0; | |
42 | |||
43 |
2/2✓ Branch 0 taken 46930392 times.
✓ Branch 1 taken 861032 times.
|
47791424 | while (order--) |
44 | 46930392 | res += *v1++ **v2++; | |
45 | |||
46 | 861032 | return res; | |
47 | } | ||
48 | |||
49 | 1041 | static void vector_clip_int32_c(int32_t *dst, const int32_t *src, int32_t min, | |
50 | int32_t max, unsigned int len) | ||
51 | { | ||
52 | do { | ||
53 | 8780 | *dst++ = av_clip(*src++, min, max); | |
54 | 8780 | *dst++ = av_clip(*src++, min, max); | |
55 | 8780 | *dst++ = av_clip(*src++, min, max); | |
56 | 8780 | *dst++ = av_clip(*src++, min, max); | |
57 | 8780 | *dst++ = av_clip(*src++, min, max); | |
58 | 8780 | *dst++ = av_clip(*src++, min, max); | |
59 | 8780 | *dst++ = av_clip(*src++, min, max); | |
60 | 8780 | *dst++ = av_clip(*src++, min, max); | |
61 | 8780 | len -= 8; | |
62 |
2/2✓ Branch 0 taken 7739 times.
✓ Branch 1 taken 1041 times.
|
8780 | } while (len > 0); |
63 | 1041 | } | |
64 | |||
65 | 38 | av_cold void ff_audiodsp_init(AudioDSPContext *c) | |
66 | { | ||
67 | 38 | c->scalarproduct_int16 = scalarproduct_int16_c; | |
68 | 38 | c->vector_clip_int32 = vector_clip_int32_c; | |
69 | 38 | c->vector_clipf = vector_clipf_c; | |
70 | |||
71 | #if ARCH_ARM | ||
72 | ff_audiodsp_init_arm(c); | ||
73 | #elif ARCH_PPC | ||
74 | ff_audiodsp_init_ppc(c); | ||
75 | #elif ARCH_RISCV | ||
76 | ff_audiodsp_init_riscv(c); | ||
77 | #elif ARCH_X86 | ||
78 | 38 | ff_audiodsp_init_x86(c); | |
79 | #endif | ||
80 | 38 | } | |
81 |