Patchwork speex: Scale float input when FIXED_POINT is defined

login
register
mail settings
Submitter Fahad Arslan
Date Dec. 20, 2013, 4:06 p.m.
Message ID <1387555576-9567-1-git-send-email-fahad_arslan@mentor.com>
Download mbox | patch
Permalink /patch/63643/
State New
Headers show

Comments

Fahad Arslan - Dec. 20, 2013, 4:06 p.m.
From: Fahad Arslan <Fahad_Arslan@mentor.com>

When Speex is compiled with FIXED_POINT defined, it scales float
input to +/-32768 instead of +/-1. This was being missed at one
point causing the input to the resampler to be zeroed. As a result
there was no audio output.

Signed-off-by: Fahad Arslan <Fahad_Arslan@mentor.com>
---
 .../speex/speex/scaling_fix.patch                  |   12 ++++++++++++
 meta/recipes-multimedia/speex/speex_1.2rc1.bb      |    3 ++-
 2 files changed, 14 insertions(+), 1 deletion(-)
Saul Wold - Dec. 20, 2013, 4:14 p.m.
On 12/20/2013 08:06 AM, Fahad Arslan wrote:
> From: Fahad Arslan <Fahad_Arslan@mentor.com>
>
> When Speex is compiled with FIXED_POINT defined, it scales float
> input to +/-32768 instead of +/-1. This was being missed at one
> point causing the input to the resampler to be zeroed. As a result
> there was no audio output.
>
> Signed-off-by: Fahad Arslan <Fahad_Arslan@mentor.com>
> ---
>   .../speex/speex/scaling_fix.patch                  |   12 ++++++++++++
>   meta/recipes-multimedia/speex/speex_1.2rc1.bb      |    3 ++-
>   2 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/meta/recipes-multimedia/speex/speex/scaling_fix.patch b/meta/recipes-multimedia/speex/speex/scaling_fix.patch
> new file mode 100644
> index 0000000..a6340d7
> --- /dev/null
> +++ b/meta/recipes-multimedia/speex/speex/scaling_fix.patch

The patch needs Upstream-Status: and Signed-off-by: tags please

Sau!

> @@ -0,0 +1,12 @@
> +diff -NaurbB a/libspeex/resample.c b/libspeex/resample.c
> +--- a/libspeex/resample.c	2013-12-20 19:47:49.154454769 +0500
> ++++ b/libspeex/resample.c	2013-12-20 19:48:16.558454331 +0500
> +@@ -915,7 +915,7 @@
> +        if (in) {
> +          for(j=0;j<ichunk;++j)
> + #ifdef FIXED_POINT
> +-           x[j+st->filt_len-1]=WORD2INT(in[j*istride_save]);
> ++           x[j+st->filt_len-1]=WORD2INT(32768.*in[j*istride_save]);
> + #else
> +            x[j+st->filt_len-1]=in[j*istride_save];
> + #endif
> diff --git a/meta/recipes-multimedia/speex/speex_1.2rc1.bb b/meta/recipes-multimedia/speex/speex_1.2rc1.bb
> index faf63b0..0fea51e 100644
> --- a/meta/recipes-multimedia/speex/speex_1.2rc1.bb
> +++ b/meta/recipes-multimedia/speex/speex_1.2rc1.bb
> @@ -9,7 +9,8 @@ DEPENDS = "libogg"
>
>   PR = "r2"
>
> -SRC_URI = "http://downloads.us.xiph.org/releases/speex/speex-1.2rc1.tar.gz"
> +SRC_URI = "http://downloads.us.xiph.org/releases/speex/speex-1.2rc1.tar.gz \
> +           file://scaling_fix.patch"
>
>   SRC_URI[md5sum] = "c4438b22c08e5811ff10e2b06ee9b9ae"
>   SRC_URI[sha256sum] = "342f30dc57bd4a6dad41398365baaa690429660b10d866b7d508e8f1179cb7a6"
>
Fahad Arslan - Dec. 24, 2013, 1:52 p.m.
Patch to Speex upstream has been denied with reason that fixing this will break other 
applications using it. 

I think appropriate place to fix the issue is Pulseaudio code. I've submitted patch 
upstream for that and sending a new patch for that to oe-core as well and this speex 
patch may be dropped. 

Fahad

Patch

diff --git a/meta/recipes-multimedia/speex/speex/scaling_fix.patch b/meta/recipes-multimedia/speex/speex/scaling_fix.patch
new file mode 100644
index 0000000..a6340d7
--- /dev/null
+++ b/meta/recipes-multimedia/speex/speex/scaling_fix.patch
@@ -0,0 +1,12 @@ 
+diff -NaurbB a/libspeex/resample.c b/libspeex/resample.c
+--- a/libspeex/resample.c	2013-12-20 19:47:49.154454769 +0500
++++ b/libspeex/resample.c	2013-12-20 19:48:16.558454331 +0500
+@@ -915,7 +915,7 @@
+        if (in) {
+          for(j=0;j<ichunk;++j)
+ #ifdef FIXED_POINT
+-           x[j+st->filt_len-1]=WORD2INT(in[j*istride_save]);
++           x[j+st->filt_len-1]=WORD2INT(32768.*in[j*istride_save]);
+ #else
+            x[j+st->filt_len-1]=in[j*istride_save];
+ #endif
diff --git a/meta/recipes-multimedia/speex/speex_1.2rc1.bb b/meta/recipes-multimedia/speex/speex_1.2rc1.bb
index faf63b0..0fea51e 100644
--- a/meta/recipes-multimedia/speex/speex_1.2rc1.bb
+++ b/meta/recipes-multimedia/speex/speex_1.2rc1.bb
@@ -9,7 +9,8 @@  DEPENDS = "libogg"
 
 PR = "r2"
 
-SRC_URI = "http://downloads.us.xiph.org/releases/speex/speex-1.2rc1.tar.gz"
+SRC_URI = "http://downloads.us.xiph.org/releases/speex/speex-1.2rc1.tar.gz \
+           file://scaling_fix.patch"
 
 SRC_URI[md5sum] = "c4438b22c08e5811ff10e2b06ee9b9ae"
 SRC_URI[sha256sum] = "342f30dc57bd4a6dad41398365baaa690429660b10d866b7d508e8f1179cb7a6"