From 9f6a43d0b0e5b778abc44997b05f59cc06a88ec7 Mon Sep 17 00:00:00 2001 From: Alin Jerpelea Date: Tue, 24 Nov 2020 17:07:57 +0100 Subject: [PATCH] libs: audio: libsamplerate: drop local patches The needed patches were accepted upstream and now there is no need to carry local patches. Signed-off-by: Alin Jerpelea --- .../0001-add-audio-quality-options.patch | 82 ------------------- libs/libc/audio/libsrc/Kconfig | 44 +++++++--- libs/libc/audio/libsrc/Make.defs | 15 +++- 3 files changed, 44 insertions(+), 97 deletions(-) delete mode 100644 libs/libc/audio/libsrc/0001-add-audio-quality-options.patch diff --git a/libs/libc/audio/libsrc/0001-add-audio-quality-options.patch b/libs/libc/audio/libsrc/0001-add-audio-quality-options.patch deleted file mode 100644 index ec0cee8935..0000000000 --- a/libs/libc/audio/libsrc/0001-add-audio-quality-options.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 8d709a69b23efc52030824ae21db889589467d8c Mon Sep 17 00:00:00 2001 -From: Alin Jerpelea -Date: Mon, 16 Nov 2020 09:44:17 +0100 -Subject: [PATCH] add audio quality options - -Many NuttX boards have limited rerources and will have to use -compile time quality options to reduce resource usage - -Signed-off-by: Alin Jerpelea ---- - src/src_sinc.c | 30 +++++++++++++++++++++++++----- - 1 files changed, 25 insertions(+), 5 deletions(-) - -diff --git a/src/src_sinc.c b/src/src_sinc.c -index 0a22708..b81326e 100644 ---- a/src/src_sinc.c -+++ b/src/src_sinc.c -@@ -40,9 +40,17 @@ typedef int32_t increment_t ; - typedef float coeff_t ; - typedef int _CHECK_SHIFT_BITS[2 * (SHIFT_BITS < sizeof (increment_t) * 8 - 1) - 1]; /* sanity check. */ - --#include "fastest_coeffs.h" --#include "mid_qual_coeffs.h" --#include "high_qual_coeffs.h" -+#if CONFIG_AUDIO_SRC_QUALITY == 2 -+ #include "fastest_coeffs.h" -+#elif CONFIG_AUDIO_SRC_QUALITY == 1 -+ #include "mid_qual_coeffs.h" -+#elif if CONFIG_AUDIO_SRC_QUALITY == 0 -+ #include "high_qual_coeffs.h" -+#else -+ #include "fastest_coeffs.h" -+ #include "mid_qual_coeffs.h" -+ #include "high_qual_coeffs.h" -+#endif - - typedef struct - { int sinc_magic_marker ; -@@ -206,6 +214,19 @@ sinc_filter_new (int converter_type, int channels) - if (priv) - { - priv->sinc_magic_marker = SINC_MAGIC_MARKER ; -+#if CONFIG_AUDIO_SRC_QUALITY == 2 -+ priv->coeffs = fastest_coeffs.coeffs ; -+ priv->coeff_half_len = ARRAY_LEN (fastest_coeffs.coeffs) - 2 ; -+ priv->index_inc = fastest_coeffs.increment ; -+#elif CONFIG_AUDIO_SRC_QUALITY == 1 -+ priv->coeffs = slow_mid_qual_coeffs.coeffs ; -+ priv->coeff_half_len = ARRAY_LEN (slow_mid_qual_coeffs.coeffs) - 2 ; -+ priv->index_inc = slow_mid_qual_coeffs.increment ; -+#elif CONFIG_AUDIO_SRC_QUALITY == 0 -+ priv->coeffs = slow_high_qual_coeffs.coeffs ; -+ priv->coeff_half_len = ARRAY_LEN (slow_high_qual_coeffs.coeffs) - 2 ; -+ priv->index_inc = slow_high_qual_coeffs.increment ; -+#else - switch (converter_type) - { - case SRC_SINC_FASTEST : -@@ -213,19 +234,18 @@ sinc_filter_new (int converter_type, int channels) - priv->coeff_half_len = ARRAY_LEN (fastest_coeffs.coeffs) - 2 ; - priv->index_inc = fastest_coeffs.increment ; - break ; -- - case SRC_SINC_MEDIUM_QUALITY : - priv->coeffs = slow_mid_qual_coeffs.coeffs ; - priv->coeff_half_len = ARRAY_LEN (slow_mid_qual_coeffs.coeffs) - 2 ; - priv->index_inc = slow_mid_qual_coeffs.increment ; - break ; -- - case SRC_SINC_BEST_QUALITY : - priv->coeffs = slow_high_qual_coeffs.coeffs ; - priv->coeff_half_len = ARRAY_LEN (slow_high_qual_coeffs.coeffs) - 2 ; - priv->index_inc = slow_high_qual_coeffs.increment ; - break ; - } -+#endif - - priv->b_len = 3 * (int) lrint ((priv->coeff_half_len + 2.0) / priv->index_inc * SRC_MAX_RATIO + 1) ; - priv->b_len = MAX (priv->b_len, 4096) ; --- -2.17.1 - diff --git a/libs/libc/audio/libsrc/Kconfig b/libs/libc/audio/libsrc/Kconfig index de7d0c1f43..09f4ab4bbe 100644 --- a/libs/libc/audio/libsrc/Kconfig +++ b/libs/libc/audio/libsrc/Kconfig @@ -4,20 +4,40 @@ # config AUDIO_SRC - bool "Audio Samplerate Convertor Library" - default n - ---help--- - Enable build for various SRC functions + bool "Audio Samplerate Convertor Library" + default n + ---help--- + Enable build for various SRC functions if AUDIO_SRC -config AUDIO_SRC_QUALITY - int "Audio Conversion Quality [0/1/2]" - default 2 - ---help--- - Audio Conversion Quality [0/1/2] - 0 Slowest conversion speed with best quality. - 1 Medium conversion speed with medium qulity - 2 Fastest conversion with lowest Quality +choice + prompt "Audio Conversion Quality" + default SINC_FAST_CONVERTER + ---help--- + Audio Conversion Quality options: + Slowest conversion speed with best quality. + Medium conversion speed with medium qulity + Fastest conversion with lowest quality + +config SINC_FAST_CONVERTER + bool "Fastest conversion with lowest quality" + ---help--- + Fastest conversion with lowest quality. + Suitable for most boards due to resource constrains. + +config SINC_MEDIUM_CONVERTER + bool "Medium conversion speed with medium qulity" + ---help--- + Medium conversion speed with medium qulity. + Not suitable for most boards due to resource constrains. + +config SINC_BEST_CONVERTER + bool "Slowest conversion speed with best quality" + ---help--- + Slowest conversion speed with best quality. + Not suitable for most boards due to resource constrains. + +endchoice endif # LIBSRC diff --git a/libs/libc/audio/libsrc/Make.defs b/libs/libc/audio/libsrc/Make.defs index 35ef8ac0b8..a2d2756d53 100644 --- a/libs/libc/audio/libsrc/Make.defs +++ b/libs/libc/audio/libsrc/Make.defs @@ -27,7 +27,6 @@ libsamplerate: $(Q) wget https://codeload.github.com/libsndfile/libsamplerate/zip/master -O libsamplerate.zip $(Q) unzip -o libsamplerate.zip $(Q) mv libsamplerate-master libsamplerate - $(Q) patch -Np1 -d libsamplerate