From a5fd52ec43f3efe3bea3f3f3a6ee53b71022ad95 Mon Sep 17 00:00:00 2001 From: Ming Jen Tai Date: Tue, 15 Mar 2022 10:22:29 +0800 Subject: [PATCH] [RTNR] Fix buffer size calculation The correct frame length should be calculated by FRAME_LEN = SAMPLING_RATE * PERIODS / 1000000 The macro COMP_PERIOD_FRAMES does the thing. Signed-off-by: Curtis Malainey Signed-off-by: Ming Jen Tai --- tools/topology/topology1/sof/pipe-rtnr-capture-16khz.m4 | 4 ++-- tools/topology/topology1/sof/pipe-rtnr-capture.m4 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/topology/topology1/sof/pipe-rtnr-capture-16khz.m4 b/tools/topology/topology1/sof/pipe-rtnr-capture-16khz.m4 index 74dc9e9a8..6927394cd 100644 --- a/tools/topology/topology1/sof/pipe-rtnr-capture-16khz.m4 +++ b/tools/topology/topology1/sof/pipe-rtnr-capture-16khz.m4 @@ -60,11 +60,11 @@ W_RTNR(0, PIPELINE_FORMAT, 2, DAI_PERIODS, DMIC_PIPELINE_16k_CORE_ID, LIST(` ', # Capture Buffers W_BUFFER(0, COMP_BUFFER_SIZE(4, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, - eval(PCM_MAX_RATE / SCHEDULE_PERIOD)), PLATFORM_PASS_MEM_CAP) + COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), PLATFORM_PASS_MEM_CAP) W_BUFFER(1, COMP_BUFFER_SIZE(4, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, - eval(PCM_MAX_RATE / SCHEDULE_PERIOD)), PLATFORM_PASS_MEM_CAP) + COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), PLATFORM_PASS_MEM_CAP) P_GRAPH(pipe-rtnr-capture-PIPELINE_ID, PIPELINE_ID, LIST(` ', diff --git a/tools/topology/topology1/sof/pipe-rtnr-capture.m4 b/tools/topology/topology1/sof/pipe-rtnr-capture.m4 index 79e616866..9c43f456b 100644 --- a/tools/topology/topology1/sof/pipe-rtnr-capture.m4 +++ b/tools/topology/topology1/sof/pipe-rtnr-capture.m4 @@ -60,11 +60,11 @@ W_RTNR(0, PIPELINE_FORMAT, 2, DAI_PERIODS, SCHEDULE_CORE, LIST(` ', "DEF_RTNR_B # Capture Buffers W_BUFFER(0, COMP_BUFFER_SIZE(4, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, - eval(PCM_MAX_RATE / SCHEDULE_PERIOD)), PLATFORM_PASS_MEM_CAP) + COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), PLATFORM_PASS_MEM_CAP) W_BUFFER(1, COMP_BUFFER_SIZE(4, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, - eval(PCM_MAX_RATE / SCHEDULE_PERIOD)), PLATFORM_PASS_MEM_CAP) + COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), PLATFORM_PASS_MEM_CAP) P_GRAPH(pipe-rtnr-capture-PIPELINE_ID, PIPELINE_ID, LIST(` ',