shithub: opus

Download patch

ref: 328b8bd7fcfc63240f78a590c7349cf58c9936f0
parent: 234969c9034f8c90148266b2e08999828d8368e2
author: Jean-Marc Valin <[email protected]>
date: Mon Oct 19 15:07:38 EDT 2009

fixed a few trivial bugs: exporting celt_strerror(), changed DB_SCALING to a
shift and removed the chec for DISABLE_STEREO in the mode creation.

--- a/libcelt/arch.h
+++ b/libcelt/arch.h
@@ -96,8 +96,7 @@
 #define PGAIN_SCALING_1 (1.f/32768.f)
 #define PGAIN_SHIFT 15
 
-#define DB_SCALING 256.f
-#define DB_SCALING_1 (1.f/256.f)
+#define DB_SHIFT 8
 
 #define EPSILON 1
 #define VERY_SMALL 0
@@ -150,9 +149,6 @@
 #define ENER_SCALING_1 1.f
 #define PGAIN_SCALING 1.f
 #define PGAIN_SCALING_1 1.f
-
-#define DB_SCALING 1.f
-#define DB_SCALING_1 1.f
 
 #define EPSILON 1e-15f
 #define VERY_SMALL 1e-15f
--- a/libcelt/celt.h
+++ b/libcelt/celt.h
@@ -269,7 +269,7 @@
 
 /*  @} */
 
-const char *celt_strerror(int error);
+EXPORT const char *celt_strerror(int error);
 
 
 #ifdef __cplusplus
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -375,16 +375,6 @@
    
 #endif /* !STATIC_MODES */
 
-#ifdef DISABLE_STEREO
-   if (channels > 1)
-   {
-      celt_warning("Stereo support was disable from this build");
-      if (error)
-         *error = CELT_BAD_ARG;
-      return NULL;
-   }
-#endif
-
    mdct_init(&mode->mdct, 2*mode->mdctSize);
    mode->fft = pitch_state_alloc(MAX_PERIOD);
 
--- a/libcelt/quant_bands.c
+++ b/libcelt/quant_bands.c
@@ -136,7 +136,7 @@
             ec_laplace_encode_start(enc, &qi, prob[2*i], prob[2*i+1]);
             error[i+c*m->nbEBands] = f - SHL16(qi,8);
          }
-         q = qi*DB_SCALING;
+         q = SHL16(qi,DB_SHIFT);
          
          oldEBands[i+c*m->nbEBands] = MULT16_16_Q15(coef,oldEBands[i+c*m->nbEBands])+(mean+prev[c]+q);
          prev[c] = mean+prev[c]+MULT16_16_Q15(Q15ONE-beta,q);
@@ -252,7 +252,7 @@
             qi = -1;
          else
             qi = ec_laplace_decode_start(dec, prob[2*i], prob[2*i+1]);
-         q = qi*DB_SCALING;
+         q = SHL16(qi,DB_SHIFT);
 
          oldEBands[i+c*m->nbEBands] = MULT16_16_Q15(coef,oldEBands[i+c*m->nbEBands])+(mean+prev[c]+q);
          prev[c] = mean+prev[c]+MULT16_16_Q15(Q15ONE-beta,q);