Lun Dong | a43730e | 2022-06-22 21:52:14 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2022 Google LLC |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Cindy Liu | 3c4d627 | 2022-08-04 18:54:12 -0700 | [diff] [blame] | 17 | #ifndef AUDIO_PREP_UTIL_H_ |
| 18 | #define AUDIO_PREP_UTIL_H_ |
Lun Dong | a43730e | 2022-06-22 21:52:14 -0700 | [diff] [blame] | 19 | |
| 20 | #ifndef M_PI |
| 21 | #define M_PI 3.14159265358979323846 |
| 22 | #endif |
| 23 | |
| 24 | // Evenly linear spaced array |
| 25 | void linspace(float* x, float start, float end, int n); |
| 26 | |
| 27 | // Calculate the dot product of two vectors |
| 28 | float dot_product(float* v, float* u, int n); |
| 29 | |
| 30 | /*--------------------------------------------------------------------------- |
| 31 | * FUNCTION NAME: rfft |
| 32 | * |
| 33 | * PURPOSE: Real valued, in-place split-radix FFT |
| 34 | * |
| 35 | * INPUT: |
| 36 | * x Pointer to input and output array |
| 37 | * m 2^m = n is the Length of FFT |
| 38 | * |
| 39 | * OUTPUT Output order |
| 40 | * Re(0), Re(1), ..., Re(n/2), Im(N/2-1), ..., Im(1) |
| 41 | * |
| 42 | * RETURN VALUE |
| 43 | * none |
| 44 | * |
| 45 | *---------------------------------------------------------------------------*/ |
| 46 | void rfft(float* x, int m); |
| 47 | |
Cindy Liu | 3c4d627 | 2022-08-04 18:54:12 -0700 | [diff] [blame] | 48 | #endif // AUDIO_PREP_UTIL_H_ |