0
1
mirror of https://github.com/radio95-rnt/fm95.git synced 2026-02-27 03:23:54 +01:00

some optimalizations

This commit is contained in:
2025-03-09 17:13:46 +01:00
parent eda100d8a1
commit 1cbc8e7903
4 changed files with 31 additions and 31 deletions

View File

@@ -10,15 +10,9 @@ float apply_preemphasis(ResistorCapacitor *filter, float sample) {
return out;
}
float hard_clip(float sample, float threshold) {
if (sample > threshold) {
return threshold; // Clip to the upper threshold
} else if (sample < -threshold) {
return -threshold; // Clip to the lower threshold
} else {
return sample; // No clipping
}
float hard_clip_fast(float sample, float threshold) {
// Branchless clipping
return fmaxf(-threshold, fminf(threshold, sample));
}
float voltage_db_to_voltage(float db) {