Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Math: Cleanup FIR and IIR build type select #8108

Merged
merged 2 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 35 additions & 34 deletions src/include/sof/math/fir_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,41 +21,42 @@
#endif
#endif

/* If next defines are set to 1 the EQ is configured automatically. Setting
* to zero temporarily is useful is for testing needs.
* Setting EQ_FIR_AUTOARCH to 0 allows to manually set the code variant.
/* Define SOFM_FIR_FORCEARCH 0/2/3 in build command line or temporarily in
* this file to override the default auto detection.
*/
#define FIR_AUTOARCH 1

/* Force manually some code variant when EQ_FIR_AUTODSP is set to zero. These
* are useful in code debugging.
*/
#if FIR_AUTOARCH == 0
#define FIR_GENERIC 0
#define FIR_HIFIEP 0
#define FIR_HIFI3 1
#endif

/* Select optimized code variant when xt-xcc compiler is used */
#if FIR_AUTOARCH == 1
#if defined __XCC__
#include <xtensa/config/core-isa.h>
#define FIR_GENERIC 0
#if XCHAL_HAVE_HIFI2EP == 1
#define FIR_HIFIEP 1
#define FIR_HIFI3 0
#elif XCHAL_HAVE_HIFI3 == 1 || XCHAL_HAVE_HIFI4 == 1
#define FIR_HIFI3 1
#define FIR_HIFIEP 0
#ifdef SOFM_FIR_FORCEARCH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where and how to define SOFM_FIR_FORCEARCH and SOF_IIR_DF2T_FORCEARCH? feel this patch make code more complex than before change, not sure whether we can have a more straightforward code clean.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where and how to define SOFM_FIR_FORCEARCH and SOF_IIR_DF2T_FORCEARCH?

The answer is literally in the first line of the patch.

feel this patch make code more complex than before change,

That's a bold statement considering you didn't read the first line.

# if SOFM_FIR_FORCEARCH == 3
# define FIR_GENERIC 0
# define FIR_HIFIEP 0
# define FIR_HIFI3 1
# elif SOFM_FIR_FORCEARCH == 2
# define FIR_GENERIC 0
# define FIR_HIFIEP 1
# define FIR_HIFI3 0
# elif SOFM_FIR_FORCEARCH == 0
# define FIR_GENERIC 1
# define FIR_HIFIEP 0
# define FIR_HIFI3 0
# else
# error "Unsupported SOFM_FIR_FORCEARCH value."
# endif
#else
#error "No HIFIEP or HIFI3 found. Cannot build FIR module."
#endif
#else
/* GCC */
#define FIR_GENERIC 1
#define FIR_HIFIEP 0
#define FIR_HIFI3 0
#endif
#endif
# if defined __XCC__
# include <xtensa/config/core-isa.h>
# define FIR_GENERIC 0
# if XCHAL_HAVE_HIFI2EP == 1
# define FIR_HIFIEP 1
# define FIR_HIFI3 0
# elif XCHAL_HAVE_HIFI3 == 1 || XCHAL_HAVE_HIFI4 == 1
# define FIR_HIFI3 1
# define FIR_HIFIEP 0
# else
# error "No HIFIEP or HIFI3 found. Cannot build FIR module."
# endif
# else
# define FIR_GENERIC 1
# define FIR_HIFI3 0
# endif /* __XCC__ */
#endif /* SOFM_FIR_FORCEARCH */

#endif /* __SOF_AUDIO_EQ_FIR_FIR_CONFIG_H__ */
57 changes: 26 additions & 31 deletions src/include/sof/math/iir_df2t.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,34 @@
#include <stddef.h>
#include <stdint.h>

/* Get platforms configuration */

/* If next defines are set to 1 the EQ is configured automatically. Setting
* to zero temporarily is useful is for testing needs.
* Setting EQ_FIR_AUTOARCH to 0 allows to manually set the code variant.
*/
#define IIR_AUTOARCH 1

/* Force manually some code variant when IIR_AUTOARCH is set to zero. These
* are useful in code debugging.
/* Define SOFM_IIR_DF2T_FORCEARCH 0/3 in build command line or temporarily in
* this file to override the default auto detection.
*/
#if IIR_AUTOARCH == 0
#define IIR_GENERIC 1
#define IIR_HIFI3 0
#endif

/* Select optimized code variant when xt-xcc compiler is used */
#if IIR_AUTOARCH == 1
#if defined __XCC__
#include <xtensa/config/core-isa.h>
#if XCHAL_HAVE_HIFI3 == 1
#define IIR_GENERIC 0
#define IIR_HIFI3 1
#else
#define IIR_GENERIC 1
#define IIR_HIFI3 0
#endif /* XCHAL_HAVE_HIFI3 */
#ifdef SOFM_IIR_DF2T_FORCEARCH
# if SOFM_IIR_DF2T_FORCEARCH == 3
# define IIR_GENERIC 0
# define IIR_HIFI3 1
# elif SOFM_IIR_DF2T_FORCEARCH == 0
# define IIR_GENERIC 1
# define IIR_HIFI3 0
# else
# error "Unsupported SOFM_IIR_DF2T_FORCEARCH value."
# endif
#else
/* GCC */
#define IIR_GENERIC 1
#define IIR_HIFI3 0
#endif /* __XCC__ */
#endif /* IIR_AUTOARCH */
# if defined __XCC__
# include <xtensa/config/core-isa.h>
# if XCHAL_HAVE_HIFI3 == 1 || XCHAL_HAVE_HIFI4 == 1
# define IIR_GENERIC 0
# define IIR_HIFI3 1
# else
# define IIR_GENERIC 1
# define IIR_HIFI3 0
# endif /* XCHAL_HAVE_HIFIn */
# else
# define IIR_GENERIC 1
# define IIR_HIFI3 0
# endif /* __XCC__ */
#endif /* SOFM_IIR_DF2T_FORCEARCH */

#define IIR_DF2T_NUM_DELAYS 2

Expand Down
Loading