From c3925e7adbe9fb7c6ccc6b7e7d51fe1909cfd174 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Tue, 15 Oct 2024 13:25:23 +0300 Subject: [PATCH] Audio: Copier: Use SOF_DIV_ROUND_UP() instead of ROUND_UP() The ROUND_UP() is provided by Zephyr headers and can't be used in testbench (IPC4) build. The ROUND_UP is defined in util.h as: "#define ROUND_UP(x, align) \ (((unsigned long)(x) + ((unsigned long)(align) - 1)) & \ ~((unsigned long)(align) - 1))" and SOF_DIV_ROUND_UP in common.h as: "#define SOF_DIV_ROUND_UP(val, div) (((val) + (div) - 1) / (div))" The round up and divide by shift in original code can be replaced with the rounding divide macro from SOF. There is no code speed impact from division since it's done in C pre-processor. The MAX_GAIN_COEFFS_CNT is much less than default 32 bit integer range, so these compute the same. Signed-off-by: Seppo Ingalsuo --- src/audio/copier/copier_gain.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/copier/copier_gain.h b/src/audio/copier/copier_gain.h index fd2132765ad8..077a47f468c3 100644 --- a/src/audio/copier/copier_gain.h +++ b/src/audio/copier/copier_gain.h @@ -78,7 +78,7 @@ enum copier_gain_envelope_dir { struct copier_gain_params { #if SOF_USE_HIFI(3, COPIER) || SOF_USE_HIFI(4, COPIER) || SOF_USE_HIFI(5, COPIER) /**< Input gain coefficients in Q10 format */ - ae_int16x4 gain_coeffs[ROUND_UP(MAX_GAIN_COEFFS_CNT, 4) >> 2]; + ae_int16x4 gain_coeffs[SOF_DIV_ROUND_UP(MAX_GAIN_COEFFS_CNT, 4)]; /**< Step for fade-in lower precision */ ae_f16x4 step_f16; /**< Initial gain depending on the number of channels */