26 uint32_t maxi, uint32_t maxisign)
30 else if ((a ^ (1
U << 31)) > maxisign)
40 uint32_t mini = *(uint32_t *) min;
41 uint32_t maxi = *(uint32_t *) max;
42 uint32_t maxisign = maxi ^ (1
U << 31);
43 uint32_t *dsti = (uint32_t *) dst;
44 const uint32_t *srci = (
const uint32_t *) src;
46 for (i = 0; i <
len; i += 8) {
47 dsti[i + 0] =
clipf_c_one(srci[i + 0], mini, maxi, maxisign);
48 dsti[i + 1] =
clipf_c_one(srci[i + 1], mini, maxi, maxisign);
49 dsti[i + 2] =
clipf_c_one(srci[i + 2], mini, maxi, maxisign);
50 dsti[i + 3] =
clipf_c_one(srci[i + 3], mini, maxi, maxisign);
51 dsti[i + 4] =
clipf_c_one(srci[i + 4], mini, maxi, maxisign);
52 dsti[i + 5] =
clipf_c_one(srci[i + 5], mini, maxi, maxisign);
53 dsti[i + 6] =
clipf_c_one(srci[i + 6], mini, maxi, maxisign);
54 dsti[i + 7] =
clipf_c_one(srci[i + 7], mini, maxi, maxisign);
63 if (min < 0 && max > 0) {
66 for (i = 0; i <
len; i += 8) {
68 dst[i + 1] =
av_clipf(src[i + 1], min, max);
69 dst[i + 2] =
av_clipf(src[i + 2], min, max);
70 dst[i + 3] =
av_clipf(src[i + 3], min, max);
71 dst[i + 4] =
av_clipf(src[i + 4], min, max);
72 dst[i + 5] =
av_clipf(src[i + 5], min, max);
73 dst[i + 6] =
av_clipf(src[i + 6], min, max);
74 dst[i + 7] =
av_clipf(src[i + 7], min, max);
94 *dst++ =
av_clip(*src++, min, max);
95 *dst++ =
av_clip(*src++, min, max);
96 *dst++ =
av_clip(*src++, min, max);
97 *dst++ =
av_clip(*src++, min, max);
98 *dst++ =
av_clip(*src++, min, max);
99 *dst++ =
av_clip(*src++, min, max);
100 *dst++ =
av_clip(*src++, min, max);
101 *dst++ =
av_clip(*src++, min, max);
static void vector_clipf_c_opposite_sign(float *dst, const float *src, float *min, float *max, int len)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
static void vector_clipf_c(float *dst, const float *src, int len, float min, float max)
Macro definitions for various function/variable attributes.
av_cold void ff_audiodsp_init_arm(AudioDSPContext *c)
void(* vector_clip_int32)(int32_t *dst, const int32_t *src, int32_t min, int32_t max, unsigned int len)
Clip each element in an array of int32_t to a given minimum and maximum value.
av_cold void ff_audiodsp_init(AudioDSPContext *c)
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
void(* vector_clipf)(float *dst, const float *src, int len, float min, float max)
av_cold void ff_audiodsp_init_ppc(AudioDSPContext *c)
static uint32_t clipf_c_one(uint32_t a, uint32_t mini, uint32_t maxi, uint32_t maxisign)
static int32_t scalarproduct_int16_c(const int16_t *v1, const int16_t *v2, int order)
int32_t(* scalarproduct_int16)(const int16_t *v1, const int16_t *v2, int len)
Calculate scalar product of two vectors.
common internal and external API header
static void vector_clip_int32_c(int32_t *dst, const int32_t *src, int32_t min, int32_t max, unsigned int len)
void ff_audiodsp_init_x86(AudioDSPContext *c)