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 <alin.jerpelea@sony.com>
This commit is contained in:
parent
148afd9548
commit
9f6a43d0b0
@ -1,82 +0,0 @@
|
||||
From 8d709a69b23efc52030824ae21db889589467d8c Mon Sep 17 00:00:00 2001
|
||||
From: Alin Jerpelea <alin.jerpelea@sony.com>
|
||||
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 <alin.jerpelea@sony.com>
|
||||
---
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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 <audio/libsrc/0001-add-audio-quality-options.patch
|
||||
$(Q) cp -rf libsamplerate/src/samplerate.h $(TOPDIR)$(DELIM)include$(DELIM)nuttx$(DELIM)audio$(DELIM)
|
||||
|
||||
context:: libsamplerate
|
||||
@ -39,6 +38,18 @@ CSRCS += src_zoh.c
|
||||
|
||||
CFLAGS += -DPACKAGE=\"$(PACKAGE)\" -DVERSION=\"$(VERSION)\"
|
||||
|
||||
ifeq ($(CONFIG_SINC_FAST_CONVERTER),y)
|
||||
CFLAGS += -DENABLE_SINC_FAST_CONVERTER
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SINC_MEDIUM_CONVERTER),y)
|
||||
CFLAGS += -DENABLE_SINC_MEDIUM_CONVERTER
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SINC_BEST_CONVERTER),y)
|
||||
CFLAGS += -DENABLE_SINC_BEST_CONVERTER
|
||||
endif
|
||||
|
||||
VPATH += libsamplerate/src
|
||||
SUBDIRS += libsamplerate/src
|
||||
DEPPATH += --dep-path libsamplerate/src
|
||||
@ -49,5 +60,3 @@ distclean::
|
||||
$(call DELFILE, libsamplerate.zip)
|
||||
|
||||
endif
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user