From 3577d67264f9700417e1729c16c3623d804d3298 Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Mon, 29 Dec 2025 21:46:41 +0100 Subject: [PATCH] make dbr calculation precise --- .vscode/c_cpp_properties.json | 22 ++++++++++++++++++++++ filter/bs412.c | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 .vscode/c_cpp_properties.json diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..0211f69 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,22 @@ +{ + "configurations": [ + { + "name": "Win32", + "includePath": [ + "${workspaceFolder}/**", + "C:\\lua\\*" + ], + "defines": [ + "_DEBUG", + "UNICODE", + "_UNICODE" + ], + "windowsSdkVersion": "10.0.26100.0", + "compilerPath": "cl.exe", + "cStandard": "c17", + "cppStandard": "c++17", + "intelliSenseMode": "windows-msvc-x64" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/filter/bs412.c b/filter/bs412.c index 5fe378e..9e34ade 100644 --- a/filter/bs412.c +++ b/filter/bs412.c @@ -8,7 +8,7 @@ inline float dbr_to_deviation(float dbr) { inline float deviation_to_dbr(float deviation) { if (deviation < 1e-6f) return -100.0f; - return 10.0f * (log2f(deviation) - LOG2_19000) * 0.30103f; + return 10*log10f(deviation/19000); } void init_bs412(BS412Compressor* mpx, uint32_t mpx_deviation, float target_power, float attack, float release, float max, uint32_t sample_rate) {