0
1
mirror of https://github.com/radio95-rnt/fm95.git synced 2026-02-26 19:23:51 +01:00

get rid of the lookahead

This commit is contained in:
2025-07-15 21:06:40 +02:00
parent f7cd9d47e1
commit 3d338bda38
2 changed files with 1 additions and 10 deletions

View File

@@ -29,11 +29,7 @@ void init_bs412(BS412Compressor* mpx, float mpx_deviation, float target_power, f
}
float bs412_compress(BS412Compressor* mpx, float sample) {
if(mpx->lookahead_counter >= BS412_LOOKAHEAD) mpx->lookahead_counter = 0;
float process_sample = mpx->lookahead_samples[mpx->lookahead_counter];
mpx->lookahead_samples[mpx->lookahead_counter++] = sample;
mpx->average += process_sample * process_sample * mpx->mpx_deviation * mpx->mpx_deviation;
mpx->average += sample * sample * mpx->mpx_deviation * mpx->mpx_deviation;
mpx->average_counter++;
float avg_power = mpx->average / mpx->average_counter;

View File

@@ -10,8 +10,6 @@
#include "../lib/debug.h"
#endif
#define BS412_LOOKAHEAD 2048 // samples
typedef struct
{
int mpx_deviation;
@@ -23,9 +21,6 @@ typedef struct
float max;
float gain;
double average;
float lookahead_samples[BS412_LOOKAHEAD + 1];
int lookahead_counter;
} BS412Compressor;
float dbr_to_deviation(float dbr);