ReMAS
1.5
Real-time Musical Accompaniment System
|
Header file for using ReMAS with CPU, both x86_64 and ARM. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>
#include <unistd.h>
#include <stdbool.h>
#include <fftw3.h>
#include "../common/defines.h"
Go to the source code of this file.
Functions | |
int | AllocDataCPU (MyType **, int **, int **, int **, int **, int **, int *, const int, const int, DTWfiles) |
AllocDataCPU creates and initializes some structures reading info from files. More... | |
int | AllocDTWCPU (MyType **, MyType **, const int, const int, const int) |
AllocDTWCPU Allocates memory for DTW vectors and initializes them. More... | |
int | AllocS_fkCPU (MyType **, MyType **, MyType **, const MyType, const int, const int, DTWfiles) |
AllocS_fkCPU Allocates memory for S_fk vector, read its data from file and initializes other auxiliar vectors. More... | |
int | AllocFFTCPU (MyFFTCPUType *, MyType **, MyType **, MyType **, int *, int *, const int, DTWfiles) |
AllocFFTCPU Allocates memory for FFT vector and reads some fft information from files. More... | |
int | AllocAuxiCPU (MyType **, short **, MyType **, MyType **, const int, const int, const int) |
AllocAuxiCPU Memory reservation for norms, frame, v_cfreq and v_dxState vectors. More... | |
void | ApplyWindow (MyType *__restrict, const short *, const MyType *, const int, const int) |
void | ComputeNorms (MyType *, MyType *, const MyType *, const int, const int, const MyType) |
ComputeNorms fills norms vector. More... | |
void | FFT (MyType *, const int *, const int *, MyType *, MyType *, MyType *, MyFFTCPUType, const int, const int) |
FFT computes FFT and updates v_cfreq vector. More... | |
int | DTWProc (const MyType *, const MyType *, MyType *__restrict, const int, const int, const int) |
void | ApplyDist (const MyType *, MyType *, const int *, const int, const MyType) |
ApplyDist applies distortion. More... | |
void | ComputeDist (const MyType *, MyType *__restrict, MyType *, const MyType *, const MyType *, const MyType *, const MyType, const int, const int) |
int | ReadWavCPU1st (short *, FILE *) |
ReadWavCPU1st reads first audio (frame) from WAV file when ARM is used. More... | |
int | ReadWavCPU (short *, FILE *) |
ReadWavCPU reads current audio (frame) from WAV file when ARM is used. More... | |
int | SeqIdamin (const int, const MyType *) |
SeqIdamin returns the pos of the minimum in a vector. More... | |
void | BetaNorm (MyType *, const int, MyType) |
BetaNorm normalizes v_cfreq vector to have beta-norm 1. More... | |
Header file for using ReMAS with CPU, both x86_64 and ARM.
Definition in file CPUFunctions.h.
int AllocAuxiCPU | ( | MyType ** | norms, |
short ** | frame, | ||
MyType ** | v_cfreq, | ||
MyType ** | v_dxState, | ||
const int | nbases, | ||
const int | tamframe, | ||
const int | nmidi | ||
) |
AllocAuxiCPU Memory reservation for norms, frame, v_cfreq and v_dxState vectors.
norms | (out) Norms vector |
frame | (out) Vector for frames |
v_cfreq | (out) v_cfreq vector |
v_dxState | (out) v_dxState vector |
nbases | (in) Number of bases/combinations, sizeof norms and v_dxState |
tamframe | (in) Size of frames in samples |
nmidi | (in) Number of midi notes, sizeof v_cfreq |
Definition at line 152 of file CPUFunctions.c.
int AllocDataCPU | ( | MyType ** | v_hanning, |
int ** | states_time_i, | ||
int ** | states_time_e, | ||
int ** | states_seq, | ||
int ** | states_corr, | ||
int ** | I_SxD, | ||
int * | DTWSize, | ||
const int | tamframe, | ||
const int | nstates, | ||
DTWfiles | NameFiles | ||
) |
AllocDataCPU creates and initializes some structures reading info from files.
v_hanning | (out) v_hanning vector |
states_time_i | (out) states_time_i vector, contains the start-time of each state in frames |
states_time_e | (out) states_time_e vector, contains the end-time of each state in frames |
states_seq | (out) states_seq vector, contains the base/combination that is performed in each state |
states_corr | (out) states_corr vector |
I_SxD | (out) I_SxD vector |
DTWSize | (in) Size of DTW vectors |
tamframe | (in) Size of frames in samples |
nstates | (in) Number of states |
NameFiles | (in) Struct with the file names |
Definition at line 310 of file CPUFunctions.c.
int AllocDTWCPU | ( | MyType ** | pV, |
MyType ** | v_SxD, | ||
const int | DTWSize, | ||
const int | DTWSizePlusPad, | ||
const int | startin | ||
) |
AllocDTWCPU Allocates memory for DTW vectors and initializes them.
pV | (out) DTW pV vector |
v_SxD | (out) v_SxD vector |
DTWSize | (in) Size of DTW vectors |
DTWSizePlusPad | (in) Size of DTW vectors plus padding |
startin | (in) Where we start to store data within circular-buffer |
Definition at line 270 of file CPUFunctions.c.
int AllocFFTCPU | ( | MyFFTCPUType * | plan, |
MyType ** | X_fft, | ||
MyType ** | Out_fft, | ||
MyType ** | Mod_fft, | ||
int * | kmin_fft, | ||
int * | kmax_fft, | ||
const int | nfft, | ||
DTWfiles | NameFiles | ||
) |
AllocFFTCPU Allocates memory for FFT vector and reads some fft information from files.
plan | (out) FFT scheduler |
X_fft | (out) X_fft vector |
Out_fft | (out) Out_fft vector |
Mod_fft | (out) Mod_fft vector |
kmin_fft | (out) Where kmin_fft is stored |
kmax_fft | (out) Where kmax_fft is stored |
nfft | (in) As is to be, Mod_fft and Out_fft size |
NameFiles | (in) Struct with the file names |
Definition at line 177 of file CPUFunctions.c.
int AllocS_fkCPU | ( | MyType ** | s_fk, |
MyType ** | tauxi, | ||
MyType ** | ts_fk, | ||
const MyType | BETA, | ||
const int | nmidi, | ||
const int | nbases, | ||
DTWfiles | NameFiles | ||
) |
AllocS_fkCPU Allocates memory for S_fk vector, read its data from file and initializes other auxiliar vectors.
s_fk | (out) s_fk vector |
tauxi | (out) Auxiliar vector tauxi |
ts_fk | (out) Auxiliar vector ts_fk |
BETA | (in) BETA value |
nmidi | (in) Number of midi notes |
nbases | (in) Number of bases/combinations |
NameFiles | (in) Struct with the file names |
Definition at line 231 of file CPUFunctions.c.
void ApplyDist | ( | const MyType * | v_dxState, |
MyType * | v_SxD, | ||
const int * | I_SxD, | ||
const int | size, | ||
const MyType | ALPHA | ||
) |
ApplyDist applies distortion.
v_dxState | (in) v_dxState vector |
v_SxD | (out) v_SxD vector |
I_SxD | (in) I_SxD vector |
size | (in) Size of the vectors |
ALPHA | (in) ALPHA value |
Definition at line 550 of file CPUFunctions.c.
void BetaNorm | ( | MyType * | v_cfreq, |
const int | nmidi, | ||
MyType | BETA | ||
) |
BetaNorm normalizes v_cfreq vector to have beta-norm 1.
v_cfreq | (inout) v_cfreq vector |
BETA | (in) BETA value |
nmidi | (in) Number of midi notes |
Definition at line 817 of file CPUFunctions.c.
void ComputeNorms | ( | MyType * | norms, |
MyType * | ts_fk, | ||
const MyType * | s_fk, | ||
const int | nmidi, | ||
const int | nbases, | ||
const MyType | beta | ||
) |
ComputeNorms fills norms vector.
norms | (out) Vector with the norms |
ts_fk | (in) Auxiliar vector |
s_fk | (in) Vector s_fk |
nmidi | (in) Number of midi notes |
nbases | (in) Number of bases/combinations |
beta | (in) BETA value |
Definition at line 73 of file CPUFunctions.c.
void FFT | ( | MyType * | v_cfreq, |
const int * | kmin, | ||
const int * | kmax, | ||
MyType * | X_fft, | ||
MyType * | Mod_fft, | ||
MyType * | Out_fft, | ||
MyFFTCPUType | plan, | ||
const int | nfft, | ||
const int | nmidi | ||
) |
FFT computes FFT and updates v_cfreq vector.
v_cfreq | (out) v_cfreq vector |
kmin | (input) kmin vector |
kmax | (input) kmax vector |
X_fft | (inout) X_fft vector |
Mod_fft | (inout) Mod_fft vector |
Out_fft | (inout) Out_fft vector |
plan | (out) FFT scheduler |
nfft | (in) As is to be, Mod_fft and Out_fft size |
nmidi | (in) Number of midi notes |
Definition at line 356 of file CPUFunctions.c.
int ReadWavCPU | ( | short * | frame, |
FILE * | fp | ||
) |
ReadWavCPU reads current audio (frame) from WAV file when ARM is used.
frame | (out) Vector to store the current frame |
fp | (in) ID of file with data |
Definition at line 756 of file CPUFunctions.c.
int ReadWavCPU1st | ( | short * | frame, |
FILE * | fp | ||
) |
ReadWavCPU1st reads first audio (frame) from WAV file when ARM is used.
frame | (out) Vector to store the first frame |
fp | (in) ID of file with the information |
Definition at line 742 of file CPUFunctions.c.
int SeqIdamin | ( | const int | N, |
const MyType * | v | ||
) |
SeqIdamin returns the pos of the minimum in a vector.
When minimum's number of occurrences > 1 => returns the position of the 1st occurrence
N | (in) Vector size |
v | (in) The vector |
Definition at line 462 of file CPUFunctions.c.