From 50bafec582fc6bb5b196e3c2752242ea98fa0fbd Mon Sep 17 00:00:00 2001 From: Martijn van Beurden Date: Wed, 1 May 2024 08:49:50 +0200 Subject: [PATCH] Fix bug in CHECK_ORDER_IS_VALID macro in functions with intrinsics --- src/libFLAC/fixed_intrin_avx2.c | 2 +- src/libFLAC/fixed_intrin_sse42.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libFLAC/fixed_intrin_avx2.c b/src/libFLAC/fixed_intrin_avx2.c index 85fc4a6d04..8522aef5ef 100644 --- a/src/libFLAC/fixed_intrin_avx2.c +++ b/src/libFLAC/fixed_intrin_avx2.c @@ -178,7 +178,7 @@ if(shadow_error_##macro_order <= INT32_MAX) { \ order = macro_order; \ smallest_error = total_error_##macro_order ; \ } \ - residual_bits_per_sample[ macro_order ] = (float)((total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double)data_len) / M_LN2 : 0.0); \ + residual_bits_per_sample[ macro_order ] = (float)((total_error_##macro_order > 0) ? log(M_LN2 * (double)total_error_##macro_order / (double)data_len) / M_LN2 : 0.0); \ } \ else \ residual_bits_per_sample[ macro_order ] = 34.0f; diff --git a/src/libFLAC/fixed_intrin_sse42.c b/src/libFLAC/fixed_intrin_sse42.c index 0556eaaddb..4fddf91f46 100644 --- a/src/libFLAC/fixed_intrin_sse42.c +++ b/src/libFLAC/fixed_intrin_sse42.c @@ -59,7 +59,7 @@ if(shadow_error_##macro_order <= INT32_MAX) { \ order = macro_order; \ smallest_error = total_error_##macro_order ; \ } \ - residual_bits_per_sample[ macro_order ] = (float)((total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double)data_len) / M_LN2 : 0.0); \ + residual_bits_per_sample[ macro_order ] = (float)((total_error_##macro_order > 0) ? log(M_LN2 * (double)total_error_##macro_order / (double)data_len) / M_LN2 : 0.0); \ } \ else \ residual_bits_per_sample[ macro_order ] = 34.0f;