| 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 87454 times.
✓ Branch 1 taken 3755 times.
|
91209 | for (int i = 0; i < len; i += 8) { |
| 29 | float tmp[8]; | ||
| 30 | |||
| 31 |
2/2✓ Branch 0 taken 699632 times.
✓ Branch 1 taken 87454 times.
|
787086 | for (int j = 0; j < 8; j++) |
| 32 | 699632 | tmp[j]= av_clipf(src[i + j], min, max); | |
| 33 |
2/2✓ Branch 0 taken 699632 times.
✓ Branch 1 taken 87454 times.
|
787086 | for (int j = 0; j < 8; j++) |
| 34 | 699632 | 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 46926488 times.
✓ Branch 1 taken 861032 times.
|
47787520 | while (order--) |
| 44 | 46926488 | res += *v1++ **v2++; | |
| 45 | |||
| 46 | 861032 | return res; | |
| 47 | } | ||
| 48 | |||
| 49 | 1089 | 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 | 9928 | *dst++ = av_clip(*src++, min, max); | |
| 54 | 9928 | *dst++ = av_clip(*src++, min, max); | |
| 55 | 9928 | *dst++ = av_clip(*src++, min, max); | |
| 56 | 9928 | *dst++ = av_clip(*src++, min, max); | |
| 57 | 9928 | *dst++ = av_clip(*src++, min, max); | |
| 58 | 9928 | *dst++ = av_clip(*src++, min, max); | |
| 59 | 9928 | *dst++ = av_clip(*src++, min, max); | |
| 60 | 9928 | *dst++ = av_clip(*src++, min, max); | |
| 61 | 9928 | len -= 8; | |
| 62 |
2/2✓ Branch 0 taken 8839 times.
✓ Branch 1 taken 1089 times.
|
9928 | } while (len > 0); |
| 63 | 1089 | } | |
| 64 | |||
| 65 | 39 | av_cold void ff_audiodsp_init(AudioDSPContext *c) | |
| 66 | { | ||
| 67 | 39 | c->scalarproduct_int16 = scalarproduct_int16_c; | |
| 68 | 39 | c->vector_clip_int32 = vector_clip_int32_c; | |
| 69 | 39 | 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 | 39 | ff_audiodsp_init_x86(c); | |
| 79 | #endif | ||
| 80 | 39 | } | |
| 81 |