Skip to content

Commit

Permalink
Audio: ASRC: Optimize for HiFi5 impulse response calculations
Browse files Browse the repository at this point in the history
This patch optimizes for HiFi5 the polynomials evaluations to
calculate rate conversion FIR impulse responses. The functions
asrc_calc_impulse_response_n[4-7]() calculate with Horner's
method each coefficient of the FIR with 3th to 5th order
polynomial.

The header files with polynomials coefficients are re-ordered for
for direct 128 bits int32x4 loads. The loop is modified to calculate
four FIR coefficients per loop. Since there is no suitable quad-MAC
instruction found, the previous dual-MAC is used twice.

The saving is 11.6 MCPS, from 38.75 to 27.20 MCPS for 32 bits stereo
44.1 to 48 kHz conversion, push mode.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
  • Loading branch information
singalsu committed Mar 6, 2025
1 parent 35cb65b commit 11055e0
Show file tree
Hide file tree
Showing 2 changed files with 185 additions and 112 deletions.
46 changes: 46 additions & 0 deletions src/audio/asrc/asrc_farrow.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,51 @@ static const struct asrc_filter_params c_filter_params[CR_NUM] = {
* coefficients will be attached to the _Src_farrow struct via the
* initialise_filter function.
*/

#if SOF_USE_MIN_HIFI(5, ASRC)
#include "coef/asrc_farrow_coeff_4x_44100Hz_to_48000Hz.h"
#include "coef/asrc_farrow_coeff_4x_48000Hz_to_48000Hz.h"

#if (CONFIG_ASRC_SUPPORT_CONVERSION_24000_TO_08000)
#include "coef/asrc_farrow_coeff_4x_24000Hz_to_08000Hz.h"
#endif

#if (CONFIG_ASRC_SUPPORT_CONVERSION_24000_TO_16000)
#include "coef/asrc_farrow_coeff_4x_24000Hz_to_16000Hz.h"
#endif

#if (CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_08000)
#include "coef/asrc_farrow_coeff_4x_48000Hz_to_08000Hz.h"
#endif

#if (CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_11025)
#include "coef/asrc_farrow_coeff_4x_48000Hz_to_11025Hz.h"
#endif

#if (CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_12000)
#include "coef/asrc_farrow_coeff_4x_48000Hz_to_12000Hz.h"
#endif

#if (CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_16000)
#include "coef/asrc_farrow_coeff_4x_48000Hz_to_16000Hz.h"
#endif

#if (CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_22050)
#include "coef/asrc_farrow_coeff_4x_48000Hz_to_22050Hz.h"
#endif

#if (CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_24000)
#include "coef/asrc_farrow_coeff_4x_48000Hz_to_24000Hz.h"
#endif

#if (CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_32000)
#include "coef/asrc_farrow_coeff_4x_48000Hz_to_32000Hz.h"
#endif

#if (CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_44100)
#include "coef/asrc_farrow_coeff_4x_48000Hz_to_44100Hz.h"
#endif
#else
#include "coef/asrc_farrow_coeff_44100Hz_to_48000Hz.h"

#include "coef/asrc_farrow_coeff_48000Hz_to_48000Hz.h"
Expand Down Expand Up @@ -188,6 +233,7 @@ static const struct asrc_filter_params c_filter_params[CR_NUM] = {
#if (CONFIG_ASRC_SUPPORT_CONVERSION_48000_TO_44100)
#include "coef/asrc_farrow_coeff_48000Hz_to_44100Hz.h"
#endif
#endif

/*
* FUNCTION DECLARATIONS
Expand Down
Loading

0 comments on commit 11055e0

Please sign in to comment.