CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/ext/at3_standalone/float_dsp.h
Views: 1401
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
#pragma once
20
21
#include "compat.h"
22
23
inline void vector_fmul(float * av_restrict dst, const float * av_restrict src, int len) {
24
for (int i = 0; i < len; i++)
25
dst[i] = dst[i] * src[i];
26
}
27
28
/**
29
* Multiply a vector of floats by a scalar float. Source and
30
* destination vectors must overlap exactly or not at all.
31
*/
32
inline void vector_fmul_scalar(float *dst, float mul, int len) {
33
for (int i = 0; i < len; i++)
34
dst[i] *= mul;
35
}
36
37
/**
38
* Calculate the entry wise product of two vectors of floats, and store the result
39
* in a vector of floats. The second vector of floats is iterated over
40
* in reverse order.
41
*
42
* @param dst output and first input vector
43
* constraints: 32-byte aligned
44
* @param src second input vector
45
* constraints: 32-byte aligned
46
* @param len number of elements in the input
47
* constraints: multiple of 16
48
*/
49
inline void vector_fmul_reverse(float * av_restrict dst, const float * av_restrict src, int len) {
50
src += len - 1;
51
for (int i = 0; i < len; i++)
52
dst[i] *= src[-i];
53
}
54
55