FFmpeg
Loading...
Searching...
No Matches
audiodsp.c
Go to the documentation of this file.
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
22#include "libavutil/common.h"
23#include "audiodsp.h"
24
25static void vector_clipf_c(float *dst, const float *src, int len,
26 float min, float max)
27{
28 for (int i = 0; i < len; i += 8) {
29 float tmp[8];
30
31 for (int j = 0; j < 8; j++)
32 tmp[j]= av_clipf(src[i + j], min, max);
33 for (int j = 0; j < 8; j++)
34 dst[i + j] = tmp[j];
35 }
36}
37
38static int32_t scalarproduct_int16_c(const int16_t *v1, const int16_t *v2,
39 int order)
40{
41 unsigned res = 0;
42
43 while (order--)
44 res += *v1++ **v2++;
45
46 return res;
47}
48
50 int32_t max, unsigned int len)
51{
52 do {
53 *dst++ = av_clip(*src++, min, max);
54 *dst++ = av_clip(*src++, min, max);
55 *dst++ = av_clip(*src++, min, max);
56 *dst++ = av_clip(*src++, min, max);
57 *dst++ = av_clip(*src++, min, max);
58 *dst++ = av_clip(*src++, min, max);
59 *dst++ = av_clip(*src++, min, max);
60 *dst++ = av_clip(*src++, min, max);
61 len -= 8;
62 } while (len > 0);
63}
64
66{
67 c->scalarproduct_int16 = scalarproduct_int16_c;
68 c->vector_clip_int32 = vector_clip_int32_c;
69 c->vector_clipf = vector_clipf_c;
70
71#if ARCH_ARM
73#elif ARCH_PPC
75#elif ARCH_RISCV
77#elif ARCH_X86 && HAVE_X86ASM
79#endif
80}
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
int32_t
void ff_audiodsp_init_ppc(AudioDSPContext *c)
Definition audiodsp.c:86
void ff_audiodsp_init_riscv(AudioDSPContext *c)
void ff_audiodsp_init_x86(AudioDSPContext *c)
av_cold void ff_audiodsp_init_arm(AudioDSPContext *c)
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
common internal and external API header
#define av_clip
Definition common.h:100
#define av_clipf
Definition common.h:145
#define min(a, b)
#define max(a, b)
static int32_t scalarproduct_int16_c(const int16_t *v1, const int16_t *v2, int order)
Definition audiodsp.c:38
static void vector_clip_int32_c(int32_t *dst, const int32_t *src, int32_t min, int32_t max, unsigned int len)
Definition audiodsp.c:49
av_cold void ff_audiodsp_init(AudioDSPContext *c)
Definition audiodsp.c:65
static void vector_clipf_c(float *dst, const float *src, int len, float min, float max)
Definition audiodsp.c:25
Macro definitions for various function/variable attributes.
#define av_cold
Definition attributes.h:117
static uint8_t tmp[40]
Definition aes_ctr.c:52
#define src
Definition vp8dsp.c:248
int len
static double c[64]