Browse Source

opus package update

Signed-off-by: basebuilder_pel7x64builder0 <basebuilder@powerel.org>
master
basebuilder_pel7x64builder0 6 years ago
parent
commit
f674afc26f
  1. 120
      SOURCES/0001-Fix-several-memory-errors-in-the-SILK-resampler.patch
  2. 74
      SOURCES/0001-Fixes-an-assertion-failure-in-SILK.patch
  3. 18259
      SOURCES/rfc6716.txt
  4. 119
      SPECS/opus.spec

120
SOURCES/0001-Fix-several-memory-errors-in-the-SILK-resampler.patch

@ -0,0 +1,120 @@ @@ -0,0 +1,120 @@
From dc58579c2c7e060084554018e9a2e8c25097a255 Mon Sep 17 00:00:00 2001
From: "Timothy B. Terriberry" <tterribe@xiph.org>
Date: Wed, 8 May 2013 10:25:52 -0700
Subject: [PATCH] Fix several memory errors in the SILK resampler.

1) The memcpy's were using sizeof(opus_int32), but the type of the
local buffer was opus_int16.
2) Because the size was wrong, this potentially allowed the source
and destination regions of the memcpy overlap.
I _believe_ that nSamplesIn is at least fs_in_khZ, which is at
least 8.
Since RESAMPLER_ORDER_FIR_12 is only 8, I don't think that's a
problem once you fix the type size.
3) The size of the buffer used RESAMPLER_MAX_BATCH_SIZE_IN, but the
data stored in it was actually _twice_ the input batch size
(nSamplesIn<<1).

Because this never blew up in testing, I suspect that in practice
the batch sizes are reasonable enough that none of these things
was ever a problem, but proving that seems non-obvious.

This patch just converts the whole thing to use CELT's vararrays.
This fixes the buffer size problems (since we allocate a buffer
with the actual size we use) and gets these large buffers off the
stack on devices using the pseudo-stack.
It also fixes the memcpy problems by changing the sizeof to
opus_int16.
It turns out sFIR, which saved state between calls, was being used
elsewhere as opus_int32, so this converts it to a union to make
this sharing explicit.
---
silk/resampler_private_IIR_FIR.c | 14 +++++++++-----
silk/resampler_private_down_FIR.c | 4 ++--
silk/resampler_structs.h | 5 ++++-
3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/silk/resampler_private_IIR_FIR.c b/silk/resampler_private_IIR_FIR.c
index d9e42ca..2b9602d 100644
--- a/silk/resampler_private_IIR_FIR.c
+++ b/silk/resampler_private_IIR_FIR.c
@@ -31,6 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "SigProc_FIX.h"
#include "resampler_private.h"
+#include "stack_alloc.h"
static inline opus_int16 *silk_resampler_private_IIR_FIR_INTERPOL(
opus_int16 *out,
@@ -71,10 +72,13 @@ void silk_resampler_private_IIR_FIR(
silk_resampler_state_struct *S = (silk_resampler_state_struct *)SS;
opus_int32 nSamplesIn;
opus_int32 max_index_Q16, index_increment_Q16;
- opus_int16 buf[ RESAMPLER_MAX_BATCH_SIZE_IN + RESAMPLER_ORDER_FIR_12 ];
+ VARDECL( opus_int16, buf );
+ SAVE_STACK;
+
+ ALLOC( buf, 2 * S->batchSize + RESAMPLER_ORDER_FIR_12, opus_int16 );
/* Copy buffered samples to start of buffer */
- silk_memcpy( buf, S->sFIR, RESAMPLER_ORDER_FIR_12 * sizeof( opus_int32 ) );
+ silk_memcpy( buf, S->sFIR.i16, RESAMPLER_ORDER_FIR_12 * sizeof( opus_int16 ) );
/* Iterate over blocks of frameSizeIn input samples */
index_increment_Q16 = S->invRatio_Q16;
@@ -91,13 +95,13 @@ void silk_resampler_private_IIR_FIR(
if( inLen > 0 ) {
/* More iterations to do; copy last part of filtered signal to beginning of buffer */
- silk_memcpy( buf, &buf[ nSamplesIn << 1 ], RESAMPLER_ORDER_FIR_12 * sizeof( opus_int32 ) );
+ silk_memcpy( buf, &buf[ nSamplesIn << 1 ], RESAMPLER_ORDER_FIR_12 * sizeof( opus_int16 ) );
} else {
break;
}
}
/* Copy last part of filtered signal to the state for the next call */
- silk_memcpy( S->sFIR, &buf[ nSamplesIn << 1 ], RESAMPLER_ORDER_FIR_12 * sizeof( opus_int32 ) );
+ silk_memcpy( S->sFIR.i16, &buf[ nSamplesIn << 1 ], RESAMPLER_ORDER_FIR_12 * sizeof( opus_int16 ) );
+ RESTORE_STACK;
}
-
diff --git a/silk/resampler_private_down_FIR.c b/silk/resampler_private_down_FIR.c
index 5d24564..8bedb0d 100644
--- a/silk/resampler_private_down_FIR.c
+++ b/silk/resampler_private_down_FIR.c
@@ -155,7 +155,7 @@ void silk_resampler_private_down_FIR(
const opus_int16 *FIR_Coefs;
/* Copy buffered samples to start of buffer */
- silk_memcpy( buf, S->sFIR, S->FIR_Order * sizeof( opus_int32 ) );
+ silk_memcpy( buf, S->sFIR.i32, S->FIR_Order * sizeof( opus_int32 ) );
FIR_Coefs = &S->Coefs[ 2 ];
@@ -185,5 +185,5 @@ void silk_resampler_private_down_FIR(
}
/* Copy last part of filtered signal to the state for the next call */
- silk_memcpy( S->sFIR, &buf[ nSamplesIn ], S->FIR_Order * sizeof( opus_int32 ) );
+ silk_memcpy( S->sFIR.i32, &buf[ nSamplesIn ], S->FIR_Order * sizeof( opus_int32 ) );
}
diff --git a/silk/resampler_structs.h b/silk/resampler_structs.h
index 4c28bd0..d1a0b95 100644
--- a/silk/resampler_structs.h
+++ b/silk/resampler_structs.h
@@ -37,7 +37,10 @@ extern "C" {
typedef struct _silk_resampler_state_struct{
opus_int32 sIIR[ SILK_RESAMPLER_MAX_IIR_ORDER ]; /* this must be the first element of this struct */
- opus_int32 sFIR[ SILK_RESAMPLER_MAX_FIR_ORDER ];
+ union{
+ opus_int32 i32[ SILK_RESAMPLER_MAX_FIR_ORDER ];
+ opus_int16 i16[ SILK_RESAMPLER_MAX_FIR_ORDER ];
+ } sFIR;
opus_int16 delayBuf[ 48 ];
opus_int resampler_function;
opus_int batchSize;
--
1.8.4.2

74
SOURCES/0001-Fixes-an-assertion-failure-in-SILK.patch

@ -0,0 +1,74 @@ @@ -0,0 +1,74 @@
From ac76b1503f759201f03dc6acb7bf00bd39f560d3 Mon Sep 17 00:00:00 2001
From: Jean-Marc Valin <jmvalin@jmvalin.ca>
Date: Thu, 9 May 2013 16:17:13 -0400
Subject: [PATCH] Fixes an assertion failure in SILK

We stop the schur recursion before any reflection coefficient
goes outside of ]-1,1[ and we force reporting a residual energy
of at least 1.
Assertion was:
Fatal (internal) error in ../silk/fixed/noise_shape_analysis_FIX.c, line 290: assertion failed: nrg >= 0
triggered by:
opus_demo voip 16000 1 12500 -bandwidth WB -complexity 10 pl04f087.stp-crash out.pcm
---
silk/fixed/schur64_FIX.c | 11 ++++++++++-
silk/fixed/schur_FIX.c | 10 +++++++++-
2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/silk/fixed/schur64_FIX.c b/silk/fixed/schur64_FIX.c
index 5ff2756..c75f96a 100644
--- a/silk/fixed/schur64_FIX.c
+++ b/silk/fixed/schur64_FIX.c
@@ -56,6 +56,11 @@ opus_int32 silk_schur64( /* O returns residual ene
}
for( k = 0; k < order; k++ ) {
+ /* Check that we won't be getting an unstable rc, otherwise stop here. */
+ if (silk_abs_int32(C[ k + 1 ][ 0 ]) >= C[ 0 ][ 1 ]) {
+ break;
+ }
+
/* Get reflection coefficient: divide two Q30 values and get result in Q31 */
rc_tmp_Q31 = silk_DIV32_varQ( -C[ k + 1 ][ 0 ], C[ 0 ][ 1 ], 31 );
@@ -73,5 +78,9 @@ opus_int32 silk_schur64( /* O returns residual ene
}
}
- return( C[ 0 ][ 1 ] );
+ for(; k < order; k++ ) {
+ rc_Q16[ k ] = 0;
+ }
+
+ return silk_max_32( 1, C[ 0 ][ 1 ] );
}
diff --git a/silk/fixed/schur_FIX.c b/silk/fixed/schur_FIX.c
index 43db501..788ad3f 100644
--- a/silk/fixed/schur_FIX.c
+++ b/silk/fixed/schur_FIX.c
@@ -68,6 +68,10 @@ opus_int32 silk_schur( /* O Returns residual ene
}
for( k = 0; k < order; k++ ) {
+ /* Check that we won't be getting an unstable rc, otherwise stop here. */
+ if (silk_abs_int32(C[ k + 1 ][ 0 ]) >= C[ 0 ][ 1 ]) {
+ break;
+ }
/* Get reflection coefficient */
rc_tmp_Q15 = -silk_DIV32_16( C[ k + 1 ][ 0 ], silk_max_32( silk_RSHIFT( C[ 0 ][ 1 ], 15 ), 1 ) );
@@ -87,6 +91,10 @@ opus_int32 silk_schur( /* O Returns residual ene
}
}
+ for(; k < order; k++ ) {
+ rc_Q15[ k ] = 0;
+ }
+
/* return residual energy */
- return C[ 0 ][ 1 ];
+ return silk_max_32( 1, C[ 0 ][ 1 ] );
}
--
1.8.4.2

18259
SOURCES/rfc6716.txt

File diff suppressed because it is too large Load Diff

119
SPECS/opus.spec

@ -0,0 +1,119 @@ @@ -0,0 +1,119 @@
Name: opus
Version: 1.0.2
Release: 6%{?dist}
Summary: An audio codec for use in low-delay speech and audio communication

Group: System Environment/Libraries
License: BSD
URL: http://www.opus-codec.org/
Source0: http://downloads.xiph.org/releases/%{name}/%{name}-%{version}.tar.gz
# This is the final IETF Working Group RFC
Source1: http://tools.ietf.org/rfc/rfc6716.txt

Patch0: 0001-Fix-several-memory-errors-in-the-SILK-resampler.patch
Patch1: 0001-Fixes-an-assertion-failure-in-SILK.patch

%description
The Opus codec is designed for interactive speech and audio transmission over
the Internet. It is designed by the IETF Codec Working Group and incorporates
technology from Skype's SILK codec and Xiph.Org's CELT codec.

%package devel
Summary: Development package for opus
Group: Development/Libraries
Requires: libogg-devel
Requires: opus = %{version}-%{release}

%description devel
Files for development with opus.

%prep
%setup -q
%patch0 -p1
%patch1 -p1
cp %{SOURCE1} .

%build
%configure --enable-custom-modes

make %{?_smp_mflags}

%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}

# Remove libtool archives and static libs
find %{buildroot} -name '*.la' -exec rm -f {} ';'
find %{buildroot} -name '*.a' -exec rm -f {} ';'

%check
make check

%clean
rm -rf %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc COPYING README rfc6716.txt
%{_libdir}/libopus.so.*

%files devel
%defattr(-,root,root,-)
%{_includedir}/opus
%{_libdir}/libopus.so
%{_libdir}/pkgconfig/opus.pc
%{_datadir}/aclocal/opus.m4

%changelog
* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 1.0.2-6
- Mass rebuild 2014-01-24

* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 1.0.2-5
- Mass rebuild 2013-12-27

* Tue Nov 5 2013 Matthias Clasen <mclasen@redhat.com> - 1.0.2-4
- Apply two crash fixes from upstream
- Resolves: #1017240

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Thu Jan 10 2013 Peter Robinson <pbrobinson@fedoraproject.org> 1.0.2-2
- Enable extra custom modes API

* Thu Dec 6 2012 Peter Robinson <pbrobinson@fedoraproject.org> 1.0.2-1
- Official 1.0.2 release

* Wed Sep 12 2012 Peter Robinson <pbrobinson@fedoraproject.org> - 1.0.1-1
- Official 1.0.1 release now rfc6716 is stable

* Tue Sep 4 2012 Peter Robinson <pbrobinson@fedoraproject.org> - 1.0.1rc3-0.1
- Update to 1.0.1rc3

* Thu Aug 9 2012 Peter Robinson <pbrobinson@fedoraproject.org> - 1.0.0rc1-0.1
- Update to 1.0.0rc1

* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.14-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Sun May 27 2012 Peter Robinson <pbrobinson@fedoraproject.org> - 0.9.14-1
- Update to 0.9.14

* Sat May 12 2012 Peter Robinson <pbrobinson@fedoraproject.org> - 0.9.10-2
- Add make check - fixes RHBZ # 821128

* Fri Apr 27 2012 Peter Robinson <pbrobinson@fedoraproject.org> - 0.9.10-1
- Update to 0.9.10

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Nov 8 2011 Peter Robinson <pbrobinson@fedoraproject.org> 0.9.8-1
- Update to 0.9.8

* Mon Oct 10 2011 Peter Robinson <pbrobinson@fedoraproject.org> 0.9.6-1
- Initial packaging
Loading…
Cancel
Save