shithub: opus

Download patch

ref: b9f443d5218a781856196561b1cd4efde938bafc
parent: 2779df7ff6e7419e2ee0e039a7d72b5c310e707e
author: Gregory Maxwell <[email protected]>
date: Mon Oct 3 21:20:39 EDT 2011

More assert updates, make the initialization in silk_warped_autocorrelation_FLP more explicit to make tools happy, and allow resetting to auto with OPUS_SET_FORCE_CHANNELS.

--- a/silk/NLSF2A.c
+++ b/silk/NLSF2A.c
@@ -77,7 +77,7 @@
     opus_int32 maxabs, absval, idx=0, sc_Q16, invGain_Q30;
 
     silk_assert( LSF_COS_TAB_SZ_FIX == 128 );
-    silk_assert( d==6||d==8||d==10||d==12||d==14||d==16 );
+    silk_assert( d==10||d==16 );
 
     /* convert LSFs to 2*cos(LSF), using piecewise linear curve from table */
     for( k = 0; k < d; k++ ) {
--- a/silk/float/warped_autocorrelation_FLP.c
+++ b/silk/float/warped_autocorrelation_FLP.c
@@ -42,8 +42,8 @@
 {
     opus_int   n, i;
     double tmp1, tmp2;
-    double state[ MAX_SHAPE_LPC_ORDER + 1 ] = { 0 };
-    double C[ MAX_SHAPE_LPC_ORDER + 1 ] = { 0 };
+    double state[ MAX_SHAPE_LPC_ORDER + 1 ] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
+    double C[ MAX_SHAPE_LPC_ORDER + 1 ] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
 
     /* Order must be even */
     silk_assert( ( order & 1 ) == 0 );
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -1107,7 +1107,7 @@
         case OPUS_SET_FORCE_CHANNELS_REQUEST:
         {
             opus_int32 value = va_arg(ap, opus_int32);
-            if(value<1 || value>st->channels)
+            if((value<1 || value>st->channels) && value != OPUS_AUTO)
                 return OPUS_BAD_ARG;
             st->force_channels = value;
         }