This commit is contained in:
OBattler
2021-08-27 20:11:17 +02:00
2 changed files with 35 additions and 0 deletions

View File

@@ -120,7 +120,11 @@ void codegen_allocator_clean_blocks(struct mem_block_t *block)
#if defined __ARM_EABI__ || defined _ARM_ || defined __aarch64__ || defined _M_ARM || defined _M_ARM64
while (1)
{
#ifndef _MSC_VER
__clear_cache(&mem_block_alloc[block->offset], &mem_block_alloc[block->offset + MEM_BLOCK_SIZE]);
#else
FlushInstructionCache(GetCurrentProcess(), &mem_block_alloc[block->offset], MEM_BLOCK_SIZE);
#endif
if (block->next)
block = &mem_blocks[block->next - 1];
else

View File

@@ -299,6 +299,37 @@ static inline double high_cut_iir(int c, int i, double NewSample) {
return y[c][i][0];
}
/* fc=5.283kHz, gain=-9.477dB, width=0.4845 */
static inline double deemph_iir(int i, double NewSample) {
double ACoef[NCoef+1] = {
0.46035077886318842566,
-0.28440821191249848754,
0.03388877229118691936
};
double BCoef[NCoef+1] = {
1.00000000000000000000,
-1.05429146278569141337,
0.26412280202756849290
};
static double y[2][NCoef+1]; /* output samples */
static double x[2][NCoef+1]; /* input samples */
int n;
/* shift the old samples */
for(n=NCoef; n>0; n--) {
x[i][n] = x[i][n-1];
y[i][n] = y[i][n-1];
}
/* Calculate the new output */
x[i][0] = NewSample;
y[i][0] = ACoef[0] * x[i][0];
for(n=1; n<=NCoef; n++)
y[i][0] += ACoef[n] * x[i][n] - BCoef[n] * y[i][n];
return y[i][0];
}
#undef NCoef
#define NCoef 2