Reformatting changes with an update to the MSVC project files
authorKoen Vos <koen.vos@skype.net>
Fri, 28 Oct 2011 23:44:26 +0000 (19:44 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Fri, 28 Oct 2011 23:44:26 +0000 (19:44 -0400)
151 files changed:
silk/A2NLSF.c
silk/API.h
silk/CNG.c
silk/HP_variable_cutoff.c
silk/Inlines.h
silk/LPC_analysis_filter.c
silk/LPC_inv_pred_gain.c
silk/LP_variable_cutoff.c
silk/MacroDebug.h
silk/NLSF2A.c
silk/NLSF_VQ.c
silk/NLSF_VQ_weights_laroia.c
silk/NLSF_decode.c
silk/NLSF_del_dec_quant.c
silk/NLSF_encode.c
silk/NLSF_stabilize.c
silk/NLSF_unpack.c
silk/NSQ.c
silk/NSQ_del_dec.c
silk/PLC.c
silk/PLC.h
silk/SigProc_FIX.h
silk/VAD.c
silk/VQ_WMat_EC.c
silk/ana_filt_bank_1.c
silk/biquad_alt.c
silk/bwexpander.c
silk/bwexpander_32.c
silk/check_control_input.c
silk/code_signs.c
silk/control.h
silk/control_SNR.c
silk/control_audio_bandwidth.c
silk/control_codec.c
silk/create_init_destroy.c
silk/debug.c
silk/debug.h
silk/dec_API.c
silk/decode_core.c
silk/decode_frame.c
silk/decode_indices.c
silk/decode_parameters.c
silk/decode_pitch.c
silk/decode_pulses.c
silk/decoder_set_fs.c
silk/define.h
silk/enc_API.c
silk/encode_indices.c
silk/encode_pulses.c
silk/fixed/LTP_analysis_filter_FIX.c
silk/fixed/LTP_scale_ctrl_FIX.c
silk/fixed/apply_sine_window_FIX.c
silk/fixed/autocorr_FIX.c
silk/fixed/burg_modified_FIX.c
silk/fixed/corrMatrix_FIX.c
silk/fixed/encode_frame_FIX.c
silk/fixed/find_LPC_FIX.c
silk/fixed/find_LTP_FIX.c
silk/fixed/find_pitch_lags_FIX.c
silk/fixed/find_pred_coefs_FIX.c
silk/fixed/k2a_FIX.c
silk/fixed/k2a_Q16_FIX.c
silk/fixed/main_FIX.h
silk/fixed/noise_shape_analysis_FIX.c
silk/fixed/pitch_analysis_core_FIX.c
silk/fixed/prefilter_FIX.c
silk/fixed/process_gains_FIX.c
silk/fixed/regularize_correlations_FIX.c
silk/fixed/residual_energy16_FIX.c
silk/fixed/residual_energy_FIX.c
silk/fixed/schur64_FIX.c
silk/fixed/schur_FIX.c
silk/fixed/silk_fixed.vcxproj
silk/fixed/silk_fixed.vcxproj.filters
silk/fixed/solve_LS_FIX.c
silk/fixed/structs_FIX.h
silk/fixed/vector_ops_FIX.c
silk/fixed/warped_autocorrelation_FIX.c
silk/float/LPC_analysis_filter_FLP.c
silk/float/LPC_inv_pred_gain_FLP.c
silk/float/LTP_analysis_filter_FLP.c
silk/float/LTP_scale_ctrl_FLP.c
silk/float/SigProc_FLP.h
silk/float/apply_sine_window_FLP.c
silk/float/autocorrelation_FLP.c
silk/float/burg_modified_FLP.c
silk/float/bwexpander_FLP.c
silk/float/corrMatrix_FLP.c
silk/float/encode_frame_FLP.c
silk/float/energy_FLP.c
silk/float/find_LPC_FLP.c
silk/float/find_LTP_FLP.c
silk/float/find_pitch_lags_FLP.c
silk/float/find_pred_coefs_FLP.c
silk/float/inner_product_FLP.c
silk/float/k2a_FLP.c
silk/float/levinsondurbin_FLP.c
silk/float/main_FLP.h
silk/float/noise_shape_analysis_FLP.c
silk/float/pitch_analysis_core_FLP.c
silk/float/prefilter_FLP.c
silk/float/process_gains_FLP.c
silk/float/regularize_correlations_FLP.c
silk/float/residual_energy_FLP.c
silk/float/scale_copy_vector_FLP.c
silk/float/scale_vector_FLP.c
silk/float/schur_FLP.c
silk/float/silk_float.vcxproj
silk/float/silk_float.vcxproj.filters
silk/float/solve_LS_FLP.c
silk/float/sort_FLP.c
silk/float/structs_FLP.h
silk/float/warped_autocorrelation_FLP.c
silk/float/wrappers_FLP.c
silk/gain_quant.c
silk/init_encoder.c
silk/inner_prod_aligned.c
silk/interpolate.c
silk/lin2log.c
silk/log2lin.c
silk/main.h
silk/pitch_est_defines.h
silk/process_NLSFs.c
silk/quant_LTP_gains.c
silk/resampler.c
silk/resampler_down2.c
silk/resampler_down2_3.c
silk/resampler_private.h
silk/resampler_private_AR2.c
silk/resampler_private_IIR_FIR.c
silk/resampler_private_down_FIR.c
silk/resampler_private_up2_HQ.c
silk/resampler_rom.c
silk/resampler_rom.h
silk/resampler_structs.h
silk/shell_coder.c
silk/sigm_Q15.c
silk/silk_common.vcxproj
silk/silk_common.vcxproj.filters
silk/sort.c
silk/stereo_LR_to_MS.c
silk/stereo_MS_to_LR.c
silk/stereo_decode_pred.c
silk/stereo_encode_pred.c
silk/stereo_find_predictor.c
silk/stereo_quant_pred.c
silk/structs.h
silk/sum_sqr_shift.c
silk/tables.h
src/opus.vcxproj
src/opus.vcxproj.filters

index 2881e8d..a739ef3 100644 (file)
@@ -43,14 +43,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define QPoly                        16
 #define MAX_ITERATIONS_A2NLSF_FIX    30
 
-/* Flag for using 2x as many cosine sampling points, reduces the risk of missing a root */
-#define OVERSAMPLE_COSINE_TABLE       0
-
 /* Helper function for A2NLSF(..)                    */
 /* Transforms polynomials from cos(n*f) to cos(f)^n  */
 static inline void silk_A2NLSF_trans_poly(
-    opus_int32        *p,    /* I/O    Polynomial                                */
-    const opus_int    dd     /* I      Polynomial order (= filter order / 2 )    */
+    opus_int32          *p,                     /* I/O    Polynomial                                */
+    const opus_int      dd                      /* I      Polynomial order (= filter order / 2 )    */
 )
 {
     opus_int k, n;
@@ -62,21 +59,21 @@ static inline void silk_A2NLSF_trans_poly(
         p[ k - 2 ] -= silk_LSHIFT( p[ k ], 1 );
     }
 }
-/* Helper function for A2NLSF(..)                    */
-/* Polynomial evaluation                             */
-static inline opus_int32 silk_A2NLSF_eval_poly(    /* return the polynomial evaluation, in QPoly */
-    opus_int32        *p,    /* I    Polynomial, QPoly        */
-    const opus_int32   x,    /* I    Evaluation point, Q12    */
-    const opus_int    dd     /* I    Order                    */
+/* Helper function for A2NLSF(..) */
+/* Polynomial evaluation          */
+static inline opus_int32 silk_A2NLSF_eval_poly( /* return the polynomial evaluation, in QPoly   */
+    opus_int32          *p,                     /* I    Polynomial, QPoly                       */
+    const opus_int32    x,                      /* I    Evaluation point, Q12                   */
+    const opus_int      dd                      /* I    Order                                   */
 )
 {
     opus_int   n;
     opus_int32 x_Q16, y32;
 
-    y32 = p[ dd ];                                    /* QPoly */
+    y32 = p[ dd ];                                  /* QPoly */
     x_Q16 = silk_LSHIFT( x, 4 );
     for( n = dd - 1; n >= 0; n-- ) {
-        y32 = silk_SMLAWW( p[ n ], y32, x_Q16 );       /* QPoly */
+        y32 = silk_SMLAWW( p[ n ], y32, x_Q16 );    /* QPoly */
     }
     return y32;
 }
@@ -119,12 +116,12 @@ static inline void silk_A2NLSF_init(
     silk_A2NLSF_trans_poly( Q, dd );
 }
 
-/* Compute Normalized Line Spectral Frequencies (NLSFs) from whitening filter coefficients        */
-/* If not all roots are found, the a_Q16 coefficients are bandwidth expanded until convergence.    */
+/* Compute Normalized Line Spectral Frequencies (NLSFs) from whitening filter coefficients      */
+/* If not all roots are found, the a_Q16 coefficients are bandwidth expanded until convergence. */
 void silk_A2NLSF(
-    opus_int16        *NLSF,                 /* O    Normalized Line Spectral Frequencies, Q15 (0 - (2^15-1)), [d]    */
-    opus_int32        *a_Q16,                /* I/O  Monic whitening filter coefficients in Q16 [d]                   */
-    const opus_int    d                      /* I    Filter order (must be even)                                      */
+    opus_int16                  *NLSF,              /* O    Normalized Line Spectral Frequencies in Q15 (0..2^15-1) [d] */
+    opus_int32                  *a_Q16,             /* I/O  Monic whitening filter coefficients in Q16 [d]              */
+    const opus_int              d                   /* I    Filter order (must be even)                                 */
 )
 {
     opus_int      i, k, m, dd, root_ix, ffrac;
@@ -145,7 +142,7 @@ void silk_A2NLSF(
     silk_A2NLSF_init( a_Q16, P, Q, dd );
 
     /* Find roots, alternating between P and Q */
-    p = P;    /* Pointer to polynomial */
+    p = P;                          /* Pointer to polynomial */
 
     xlo = silk_LSFCosTab_FIX_Q12[ 0 ]; /* Q12*/
     ylo = silk_A2NLSF_eval_poly( p, xlo, dd );
@@ -164,13 +161,7 @@ void silk_A2NLSF(
     thr = 0;
     while( 1 ) {
         /* Evaluate polynomial */
-#if OVERSAMPLE_COSINE_TABLE
-        xhi = silk_LSFCosTab_FIX_Q12[   k       >> 1 ] +
-          ( ( silk_LSFCosTab_FIX_Q12[ ( k + 1 ) >> 1 ] -
-              silk_LSFCosTab_FIX_Q12[   k       >> 1 ] ) >> 1 );    /* Q12 */
-#else
         xhi = silk_LSFCosTab_FIX_Q12[ k ]; /* Q12 */
-#endif
         yhi = silk_A2NLSF_eval_poly( p, xhi, dd );
 
         /* Detect zero crossing */
@@ -183,11 +174,7 @@ void silk_A2NLSF(
                 thr = 0;
             }
             /* Binary division */
-#if OVERSAMPLE_COSINE_TABLE
-            ffrac = -128;
-#else
             ffrac = -256;
-#endif
             for( m = 0; m < BIN_DIV_STEPS_A2NLSF_FIX; m++ ) {
                 /* Evaluate polynomial */
                 xmid = silk_RSHIFT_ROUND( xlo + xhi, 1 );
@@ -202,11 +189,7 @@ void silk_A2NLSF(
                     /* Increase frequency */
                     xlo = xmid;
                     ylo = ymid;
-#if OVERSAMPLE_COSINE_TABLE
-                    ffrac = silk_ADD_RSHIFT( ffrac,  64, m );
-#else
                     ffrac = silk_ADD_RSHIFT( ffrac, 128, m );
-#endif
                 }
             }
 
@@ -222,11 +205,7 @@ void silk_A2NLSF(
                 /* No risk of dividing by zero because abs(ylo - yhi) >= abs(ylo) >= 65536 */
                 ffrac += silk_DIV32( ylo, silk_RSHIFT( ylo - yhi, 8 - BIN_DIV_STEPS_A2NLSF_FIX ) );
             }
-#if OVERSAMPLE_COSINE_TABLE
-            NLSF[ root_ix ] = (opus_int16)silk_min_32( silk_LSHIFT( (opus_int32)k, 7 ) + ffrac, silk_int16_MAX );
-#else
             NLSF[ root_ix ] = (opus_int16)silk_min_32( silk_LSHIFT( (opus_int32)k, 8 ) + ffrac, silk_int16_MAX );
-#endif
 
             silk_assert( NLSF[ root_ix ] >= 0 );
 
@@ -239,13 +218,7 @@ void silk_A2NLSF(
             p = PQ[ root_ix & 1 ];
 
             /* Evaluate polynomial */
-#if OVERSAMPLE_COSINE_TABLE
-            xlo = silk_LSFCosTab_FIX_Q12[ ( k - 1 ) >> 1 ] +
-              ( ( silk_LSFCosTab_FIX_Q12[   k       >> 1 ] -
-                  silk_LSFCosTab_FIX_Q12[ ( k - 1 ) >> 1 ] ) >> 1 ); /* Q12*/
-#else
             xlo = silk_LSFCosTab_FIX_Q12[ k - 1 ]; /* Q12*/
-#endif
             ylo = silk_LSHIFT( 1 - ( root_ix & 2 ), 12 );
         } else {
             /* Increment loop counter */
@@ -254,11 +227,7 @@ void silk_A2NLSF(
             ylo = yhi;
             thr = 0;
 
-#if OVERSAMPLE_COSINE_TABLE
-            if( k > 2 * LSF_COS_TAB_SZ_FIX ) {
-#else
             if( k > LSF_COS_TAB_SZ_FIX ) {
-#endif
                 i++;
                 if( i > MAX_ITERATIONS_A2NLSF_FIX ) {
                     /* Set NLSFs to white spectrum and exit */
index a96bd54..1bb39ad 100644 (file)
@@ -43,9 +43,9 @@ extern "C"
 
 /* Struct for TOC (Table of Contents) */
 typedef struct {
-    opus_int     VADFlag;                                /* Voice activity for packet                            */
-    opus_int     VADFlags[ SILK_MAX_FRAMES_PER_PACKET ]; /* Voice activity for each frame in packet              */
-    opus_int     inbandFECFlag;                          /* Flag indicating if packet contains in-band FEC       */
+    opus_int    VADFlag;                                /* Voice activity for packet                            */
+    opus_int    VADFlags[ SILK_MAX_FRAMES_PER_PACKET ]; /* Voice activity for each frame in packet              */
+    opus_int    inbandFECFlag;                          /* Flag indicating if packet contains in-band FEC       */
 } silk_TOC_struct;
 
 /****************************************/
@@ -55,24 +55,24 @@ typedef struct {
 /***********************************************/
 /* Get size in bytes of the Silk encoder state */
 /***********************************************/
-opus_int silk_Get_Encoder_Size(                          /* O:   Returns error code                              */
-    opus_int                           *encSizeBytes   /* O:   Number of bytes in SILK encoder state           */
+opus_int silk_Get_Encoder_Size(                         /* O    Returns error code                              */
+    opus_int                        *encSizeBytes       /* O    Number of bytes in SILK encoder state           */
 );
 
 /*************************/
 /* Init or reset encoder */
 /*************************/
-opus_int silk_InitEncoder(                               /* O:   Returns error code                              */
-    void                                *encState,      /* I/O: State                                           */
-    silk_EncControlStruct               *encStatus      /* O:   Encoder Status                                  */
+opus_int silk_InitEncoder(                              /* O    Returns error code                              */
+    void                            *encState,          /* I/O  State                                           */
+    silk_EncControlStruct           *encStatus          /* O    Encoder Status                                  */
 );
 
 /***************************************/
 /* Read control structure from encoder */
 /***************************************/
-opus_int silk_QueryEncoder(                              /* O:   Returns error code                              */
-    const void                          *encState,      /* I:   State                                           */
-    silk_EncControlStruct               *encStatus      /* O:   Encoder Status                                  */
+opus_int silk_QueryEncoder(                             /* O    Returns error code                              */
+    const void                      *encState,          /* I    State                                           */
+    silk_EncControlStruct           *encStatus          /* O    Encoder Status                                  */
 );
 
 /**************************/
@@ -80,14 +80,14 @@ opus_int silk_QueryEncoder(                              /* O:   Returns error c
 /**************************/
 /* Note: if prefillFlag is set, the input must contain 10 ms of audio, irrespective of what                     */
 /* encControl->payloadSize_ms is set to                                                                         */
-opus_int silk_Encode(                                    /* O:   Returns error code                              */
-    void                                *encState,      /* I/O: State                                           */
-    silk_EncControlStruct               *encControl,    /* I:   Control status                                  */
-    const opus_int16                     *samplesIn,     /* I:   Speech sample input vector                      */
-    opus_int                             nSamplesIn,     /* I:   Number of samples in input vector               */
-    ec_enc                              *psRangeEnc,    /* I/O  Compressor data structure                       */
-    opus_int                             *nBytesOut,     /* I/O: Number of bytes in payload (input: Max bytes)   */
-    const opus_int                       prefillFlag     /* I:   Flag to indicate prefilling buffers no coding   */
+opus_int silk_Encode(                                   /* O    Returns error code                              */
+    void                            *encState,          /* I/O  State                                           */
+    silk_EncControlStruct           *encControl,        /* I    Control status                                  */
+    const opus_int16                *samplesIn,         /* I    Speech sample input vector                      */
+    opus_int                        nSamplesIn,         /* I    Number of samples in input vector               */
+    ec_enc                          *psRangeEnc,        /* I/O  Compressor data structure                       */
+    opus_int                        *nBytesOut,         /* I/O  Number of bytes in payload (input: Max bytes)   */
+    const opus_int                  prefillFlag         /* I    Flag to indicate prefilling buffers no coding   */
 );
 
 /****************************************/
@@ -97,38 +97,38 @@ opus_int silk_Encode(                                    /* O:   Returns error c
 /***********************************************/
 /* Get size in bytes of the Silk decoder state */
 /***********************************************/
-opus_int silk_Get_Decoder_Size(                          /* O:   Returns error code                              */
-    opus_int                             *decSizeBytes   /* O:   Number of bytes in SILK decoder state           */
+opus_int silk_Get_Decoder_Size(                         /* O    Returns error code                              */
+    opus_int                        *decSizeBytes       /* O    Number of bytes in SILK decoder state           */
 );
 
 /*************************/
 /* Init or Reset decoder */
 /*************************/
-opus_int silk_InitDecoder(                               /* O:   Returns error code                              */
-    void                                *decState       /* I/O: State                                           */
+opus_int silk_InitDecoder(                              /* O    Returns error code                              */
+    void                            *decState           /* I/O  State                                           */
 );
 
 /******************/
 /* Decode a frame */
 /******************/
-opus_int silk_Decode(                                    /* O:   Returns error code                              */
-    void*                               decState,       /* I/O: State                                           */
-    silk_DecControlStruct*              decControl,     /* I/O: Control Structure                               */
-    opus_int                             lostFlag,       /* I:   0: no loss, 1 loss, 2 decode fec                */
-    opus_int                             newPacketFlag,  /* I:   Indicates first decoder call for this packet    */
-    ec_dec                              *psRangeDec,    /* I/O  Compressor data structure                       */
-    opus_int16                           *samplesOut,    /* O:   Decoded output speech vector                    */
-    opus_int32                           *nSamplesOut    /* O:   Number of samples decoded                       */
+opus_int silk_Decode(                                   /* O    Returns error code                              */
+    void*                           decState,           /* I/O  State                                           */
+    silk_DecControlStruct*          decControl,         /* I/O  Control Structure                               */
+    opus_int                        lostFlag,           /* I    0: no loss, 1 loss, 2 decode fec                */
+    opus_int                        newPacketFlag,      /* I    Indicates first decoder call for this packet    */
+    ec_dec                          *psRangeDec,        /* I/O  Compressor data structure                       */
+    opus_int16                      *samplesOut,        /* O    Decoded output speech vector                    */
+    opus_int32                      *nSamplesOut        /* O    Number of samples decoded                       */
 );
 
 /**************************************/
 /* Get table of contents for a packet */
 /**************************************/
 opus_int silk_get_TOC(
-    const opus_uint8                     *payload,           /* I    Payload data                                */
-    const opus_int                       nBytesIn,           /* I:   Number of input bytes                       */
-    const opus_int                       nFramesPerPayload,  /* I:   Number of SILK frames per payload           */
-    silk_TOC_struct                     *Silk_TOC           /* O:   Type of content                             */
+    const opus_uint8                *payload,           /* I    Payload data                                */
+    const opus_int                  nBytesIn,           /* I    Number of input bytes                       */
+    const opus_int                  nFramesPerPayload,  /* I    Number of SILK frames per payload           */
+    silk_TOC_struct                 *Silk_TOC           /* O    Type of content                             */
 );
 
 #ifdef __cplusplus
index 0b43b86..d67e872 100644 (file)
@@ -60,7 +60,7 @@ static inline void silk_CNG_exc(
 }
 
 void silk_CNG_Reset(
-    silk_decoder_state      *psDec              /* I/O  Decoder state                               */
+    silk_decoder_state          *psDec                          /* I/O  Decoder state                               */
 )
 {
     opus_int i, NLSF_step_Q15, NLSF_acc_Q15;
@@ -77,10 +77,10 @@ void silk_CNG_Reset(
 
 /* Updates CNG estimate, and applies the CNG when packet was lost   */
 void silk_CNG(
-    silk_decoder_state          *psDec,             /* I/O  Decoder state                               */
-    silk_decoder_control        *psDecCtrl,         /* I/O  Decoder control                             */
-    opus_int16                   frame[],           /* I/O  Signal data                                 */
-    opus_int                     length              /* I    Length of residual                          */
+    silk_decoder_state          *psDec,                         /* I/O  Decoder state                               */
+    silk_decoder_control        *psDecCtrl,                     /* I/O  Decoder control                             */
+    opus_int16                  frame[],                        /* I/O  Signal                                      */
+    opus_int                    length                          /* I    Length of residual                          */
 )
 {
     opus_int   i, j, subfr;
index c66f47b..6eec9c1 100644 (file)
@@ -37,7 +37,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /* High-pass filter with cutoff frequency adaptation based on pitch lag statistics */
 void silk_HP_variable_cutoff(
-    silk_encoder_state_Fxx          state_Fxx[]        /* I/O  Encoder states                          */
+    silk_encoder_state_Fxx          state_Fxx[]                         /* I/O  Encoder states                              */
 )
 {
    opus_int   quality_Q15;
index 765e770..26b3b5a 100644 (file)
@@ -38,7 +38,7 @@ extern "C"
 #endif
 
 /* count leading zeros of opus_int64 */
-static inline opus_int32 silk_CLZ64(opus_int64 in)
+static inline opus_int32 silk_CLZ64( opus_int64 in )
 {
     opus_int32 in_upper;
 
@@ -53,9 +53,11 @@ static inline opus_int32 silk_CLZ64(opus_int64 in)
 }
 
 /* get number of leading zeros and fractional part (the bits right after the leading one */
-static inline void silk_CLZ_FRAC(opus_int32 in,            /* I: input */
-                                    opus_int32 *lz,           /* O: number of leading zeros */
-                                    opus_int32 *frac_Q7)      /* O: the 7 bits right after the leading one */
+static inline void silk_CLZ_FRAC(
+    opus_int32 in,            /* I  input                               */
+    opus_int32 *lz,           /* O  number of leading zeros             */
+    opus_int32 *frac_Q7       /* O  the 7 bits right after the leading one */
+)
 {
     opus_int32 lzeros = silk_CLZ32(in);
 
@@ -66,7 +68,7 @@ static inline void silk_CLZ_FRAC(opus_int32 in,            /* I: input */
 /* Approximation of square root                                          */
 /* Accuracy: < +/- 10%  for output values > 15                           */
 /*           < +/- 2.5% for output values > 120                          */
-static inline opus_int32 silk_SQRT_APPROX(opus_int32 x)
+static inline opus_int32 silk_SQRT_APPROX( opus_int32 x )
 {
     opus_int32 y, lz, frac_Q7;
 
@@ -92,10 +94,10 @@ static inline opus_int32 silk_SQRT_APPROX(opus_int32 x)
 }
 
 /* Divide two int32 values and return result as int32 in a given Q-domain */
-static inline opus_int32 silk_DIV32_varQ(    /* O    returns a good approximation of "(a32 << Qres) / b32" */
-    const opus_int32     a32,            /* I    numerator (Q0)                  */
-    const opus_int32     b32,            /* I    denominator (Q0)                */
-    const opus_int       Qres            /* I    Q-domain of result (>= 0)       */
+static inline opus_int32 silk_DIV32_varQ(   /* O    returns a good approximation of "(a32 << Qres) / b32" */
+    const opus_int32     a32,               /* I    numerator (Q0)                  */
+    const opus_int32     b32,               /* I    denominator (Q0)                */
+    const opus_int       Qres               /* I    Q-domain of result (>= 0)       */
 )
 {
     opus_int   a_headrm, b_headrm, lshift;
@@ -106,22 +108,22 @@ static inline opus_int32 silk_DIV32_varQ(    /* O    returns a good approximatio
 
     /* Compute number of bits head room and normalize inputs */
     a_headrm = silk_CLZ32( silk_abs(a32) ) - 1;
-    a32_nrm = silk_LSHIFT(a32, a_headrm);                                    /* Q: a_headrm                    */
+    a32_nrm = silk_LSHIFT(a32, a_headrm);                                       /* Q: a_headrm                  */
     b_headrm = silk_CLZ32( silk_abs(b32) ) - 1;
-    b32_nrm = silk_LSHIFT(b32, b_headrm);                                    /* Q: b_headrm                    */
+    b32_nrm = silk_LSHIFT(b32, b_headrm);                                       /* Q: b_headrm                  */
 
     /* Inverse of b32, with 14 bits of precision */
-    b32_inv = silk_DIV32_16( silk_int32_MAX >> 2, silk_RSHIFT(b32_nrm, 16) );  /* Q: 29 + 16 - b_headrm        */
+    b32_inv = silk_DIV32_16( silk_int32_MAX >> 2, silk_RSHIFT(b32_nrm, 16) );   /* Q: 29 + 16 - b_headrm        */
 
     /* First approximation */
-    result = silk_SMULWB(a32_nrm, b32_inv);                                  /* Q: 29 + a_headrm - b_headrm    */
+    result = silk_SMULWB(a32_nrm, b32_inv);                                     /* Q: 29 + a_headrm - b_headrm  */
 
     /* Compute residual by subtracting product of denominator and first approximation */
     /* It's OK to overflow because the final value of a32_nrm should always be small */
-    a32_nrm = silk_SUB32_ovflw(a32_nrm, silk_LSHIFT_ovflw( silk_SMMUL(b32_nrm, result), 3 ));  /* Q: a_headrm                    */
+    a32_nrm = silk_SUB32_ovflw(a32_nrm, silk_LSHIFT_ovflw( silk_SMMUL(b32_nrm, result), 3 ));  /* Q: a_headrm   */
 
     /* Refinement */
-    result = silk_SMLAWB(result, a32_nrm, b32_inv);                          /* Q: 29 + a_headrm - b_headrm    */
+    result = silk_SMLAWB(result, a32_nrm, b32_inv);                             /* Q: 29 + a_headrm - b_headrm  */
 
     /* Convert to Qres domain */
     lshift = 29 + a_headrm - b_headrm - Qres;
@@ -138,9 +140,9 @@ static inline opus_int32 silk_DIV32_varQ(    /* O    returns a good approximatio
 }
 
 /* Invert int32 value and return result as int32 in a given Q-domain */
-static inline opus_int32 silk_INVERSE32_varQ(    /* O    returns a good approximation of "(1 << Qres) / b32" */
-    const opus_int32     b32,                /* I    denominator (Q0)                */
-    const opus_int       Qres                /* I    Q-domain of result (> 0)        */
+static inline opus_int32 silk_INVERSE32_varQ(   /* O    returns a good approximation of "(1 << Qres) / b32" */
+    const opus_int32     b32,                   /* I    denominator (Q0)                */
+    const opus_int       Qres                   /* I    Q-domain of result (> 0)        */
 )
 {
     opus_int   b_headrm, lshift;
@@ -151,19 +153,19 @@ static inline opus_int32 silk_INVERSE32_varQ(    /* O    returns a good approxim
 
     /* Compute number of bits head room and normalize input */
     b_headrm = silk_CLZ32( silk_abs(b32) ) - 1;
-    b32_nrm = silk_LSHIFT(b32, b_headrm);                                    /* Q: b_headrm                */
+    b32_nrm = silk_LSHIFT(b32, b_headrm);                                       /* Q: b_headrm                */
 
     /* Inverse of b32, with 14 bits of precision */
-    b32_inv = silk_DIV32_16( silk_int32_MAX >> 2, silk_RSHIFT(b32_nrm, 16) );  /* Q: 29 + 16 - b_headrm    */
+    b32_inv = silk_DIV32_16( silk_int32_MAX >> 2, silk_RSHIFT(b32_nrm, 16) );   /* Q: 29 + 16 - b_headrm    */
 
     /* First approximation */
-    result = silk_LSHIFT(b32_inv, 16);                                       /* Q: 61 - b_headrm            */
+    result = silk_LSHIFT(b32_inv, 16);                                          /* Q: 61 - b_headrm            */
 
     /* Compute residual by subtracting product of denominator and first approximation from one */
-    err_Q32 = silk_LSHIFT( (1<<29) - silk_SMULWB(b32_nrm, b32_inv), 3 );         /* Q32                        */
+    err_Q32 = silk_LSHIFT( (1<<29) - silk_SMULWB(b32_nrm, b32_inv), 3 );        /* Q32                        */
 
     /* Refinement */
-    result = silk_SMLAWW(result, err_Q32, b32_inv);                          /* Q: 61 - b_headrm            */
+    result = silk_SMLAWW(result, err_Q32, b32_inv);                             /* Q: 61 - b_headrm            */
 
     /* Convert to Qres domain */
     lshift = 61 - b_headrm - Qres;
index 5fc4349..bf5c284 100644 (file)
@@ -39,11 +39,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /*******************************************/
 
 void silk_LPC_analysis_filter(
-    opus_int16            *out,           /* O:   Output signal                               */
-    const opus_int16      *in,            /* I:   Input signal                                */
-    const opus_int16      *B,             /* I:   MA prediction coefficients, Q12 [order]     */
-    const opus_int32      len,            /* I:   Signal length                               */
-    const opus_int32      d               /* I:   Filter order                                */
+    opus_int16                  *out,               /* O    Output signal                                               */
+    const opus_int16            *in,                /* I    Input signal                                                */
+    const opus_int16            *B,                 /* I    MA prediction coefficients, Q12 [order]                     */
+    const opus_int32            len,                /* I    Signal length                                               */
+    const opus_int32            d                   /* I    Filter order                                                */
 )
 {
     opus_int         ix, j;
@@ -54,10 +54,10 @@ void silk_LPC_analysis_filter(
     silk_assert( (d & 1) == 0 );
     silk_assert( d <= len );
 
-    for ( ix = d; ix < len; ix++) {
+    for( ix = d; ix < len; ix++ ) {
         in_ptr = &in[ ix - 1 ];
 
-        out32_Q12 = silk_SMULBB(            in_ptr[  0 ], B[ 0 ] );
+        out32_Q12 = silk_SMULBB( in_ptr[  0 ], B[ 0 ] );
         /* Allowing wrap around so that two wraps can cancel each other. The rare
            cases where the result wraps around can only be triggered by invalid streams*/
         out32_Q12 = silk_SMLABB_ovflw( out32_Q12, in_ptr[ -1 ], B[ 1 ] );
index 3a2ff66..fb989ac 100644 (file)
@@ -31,18 +31,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include "SigProc_FIX.h"
 
-#define QA          24
-#define A_LIMIT     SILK_FIX_CONST( 0.99975, QA )
+#define QA                          24
+#define A_LIMIT                     SILK_FIX_CONST( 0.99975, QA )
 
-#define MUL32_FRAC_Q(a32, b32, Q) ((opus_int32)(silk_RSHIFT_ROUND64(silk_SMULL(a32, b32), Q)))
+#define MUL32_FRAC_Q(a32, b32, Q)   ((opus_int32)(silk_RSHIFT_ROUND64(silk_SMULL(a32, b32), Q)))
 
 /* Compute inverse of LPC prediction gain, and                          */
 /* test if LPC coefficients are stable (all poles within unit circle)   */
-static opus_int LPC_inverse_pred_gain_QA(        /* O:   Returns 1 if unstable, otherwise 0          */
-    opus_int32           *invGain_Q30,           /* O:   Inverse prediction gain, Q30 energy domain  */
-    opus_int32           A_QA[ 2 ][ SILK_MAX_ORDER_LPC ],
-                                                /* I:   Prediction coefficients                     */
-    const opus_int       order                   /* I:   Prediction order                            */
+static opus_int LPC_inverse_pred_gain_QA(                   /* O   Returns 1 if unstable, otherwise 0          */
+    opus_int32           *invGain_Q30,                      /* O   Inverse prediction gain, Q30 energy domain  */
+    opus_int32           A_QA[ 2 ][ SILK_MAX_ORDER_LPC ],   /* I   Prediction coefficients                     */
+    const opus_int       order                              /* I   Prediction order                            */
 )
 {
     opus_int   k, n, mult2Q;
@@ -108,10 +107,10 @@ static opus_int LPC_inverse_pred_gain_QA(        /* O:   Returns 1 if unstable,
 }
 
 /* For input in Q12 domain */
-opus_int silk_LPC_inverse_pred_gain(             /* O:   Returns 1 if unstable, otherwise 0          */
-    opus_int32           *invGain_Q30,           /* O:   Inverse prediction gain, Q30 energy domain  */
-    const opus_int16     *A_Q12,                 /* I:   Prediction coefficients, Q12 [order]        */
-    const opus_int       order                   /* I:   Prediction order                            */
+opus_int silk_LPC_inverse_pred_gain(                /* O   Returns 1 if unstable, otherwise 0                           */
+    opus_int32                  *invGain_Q30,       /* O   Inverse prediction gain, Q30 energy domain                   */
+    const opus_int16            *A_Q12,             /* I   Prediction coefficients, Q12 [order]                         */
+    const opus_int              order               /* I   Prediction order                                             */
 )
 {
     opus_int   k;
@@ -127,17 +126,17 @@ opus_int silk_LPC_inverse_pred_gain(             /* O:   Returns 1 if unstable,
         Anew_QA[ k ] = silk_LSHIFT( (opus_int32)A_Q12[ k ], QA - 12 );
     }
     /* If the DC is unstable, we don't even need to do the full calculations */
-    if ( DC_resp >= 4096 ) {
+    if( DC_resp >= 4096 ) {
        return 1;
     }
     return LPC_inverse_pred_gain_QA( invGain_Q30, Atmp_QA, order );
 }
 
 /* For input in Q24 domain */
-opus_int silk_LPC_inverse_pred_gain_Q24(         /* O:   Returns 1 if unstable, otherwise 0          */
-    opus_int32           *invGain_Q30,           /* O:   Inverse prediction gain, Q30 energy domain  */
-    const opus_int32     *A_Q24,                 /* I:   Prediction coefficients, Q24 [order]        */
-    const opus_int       order                   /* I:   Prediction order                            */
+opus_int silk_LPC_inverse_pred_gain_Q24(            /* O    Returns 1 if unstable, otherwise 0                          */
+    opus_int32                  *invGain_Q30,       /* O    Inverse prediction gain, Q30 energy domain                  */
+    const opus_int32            *A_Q24,             /* I    Prediction coefficients, Q24 [order]                        */
+    const opus_int              order               /* I    Prediction order                                            */
 )
 {
     opus_int   k;
index 2ed062c..44f541e 100644 (file)
@@ -30,12 +30,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #endif
 
 /*
-
     Elliptic/Cauer filters designed with 0.1 dB passband ripple,
-        80 dB minimum stopband attenuation, and
-        [0.95 : 0.15 : 0.35] normalized cut off frequencies.
-
+    80 dB minimum stopband attenuation, and
+    [0.95 : 0.15 : 0.35] normalized cut off frequencies.
 */
+
 #include "main.h"
 
 /* Helper function, interpolates the filter taps */
@@ -99,9 +98,9 @@ static inline void silk_LP_interpolate_filter_taps(
 /* Start by setting psEncC->mode <> 0;                      */
 /* Deactivate by setting psEncC->mode = 0;                  */
 void silk_LP_variable_cutoff(
-    silk_LP_state           *psLP,              /* I/O  LP filter state                             */
-    opus_int16                   *frame,         /* I/O  Low-pass filtered output                   */
-    const opus_int               frame_length        /* I    Frame length                                */
+    silk_LP_state               *psLP,                          /* I/O  LP filter state                             */
+    opus_int16                  *frame,                         /* I/O  Low-pass filtered output signal             */
+    const opus_int              frame_length                    /* I    Frame length                                */
 )
 {
     opus_int32   B_Q28[ TRANSITION_NB ], A_Q28[ TRANSITION_NA ], fac_Q16 = 0;
index 89f7f31..e407b80 100644 (file)
@@ -33,7 +33,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #if 0 && defined (_DEBUG) && !defined (silk_MACRO_COUNT)
 
-#undef    silk_ADD16
+#undef silk_ADD16
 static inline opus_int16 silk_ADD16(opus_int16 a, opus_int16 b){
     opus_int16 ret;
 
@@ -42,7 +42,7 @@ static inline opus_int16 silk_ADD16(opus_int16 a, opus_int16 b){
     return ret;
 }
 
-#undef    silk_ADD32
+#undef silk_ADD32
 static inline opus_int32 silk_ADD32(opus_int32 a, opus_int32 b){
     opus_int32 ret;
 
@@ -51,7 +51,7 @@ static inline opus_int32 silk_ADD32(opus_int32 a, opus_int32 b){
     return ret;
 }
 
-#undef    silk_ADD64
+#undef silk_ADD64
 static inline opus_int64 silk_ADD64(opus_int64 a, opus_int64 b){
     opus_int64 ret;
 
@@ -60,7 +60,7 @@ static inline opus_int64 silk_ADD64(opus_int64 a, opus_int64 b){
     return ret;
 }
 
-#undef    silk_SUB16
+#undef silk_SUB16
 static inline opus_int16 silk_SUB16(opus_int16 a, opus_int16 b){
     opus_int16 ret;
 
@@ -69,7 +69,7 @@ static inline opus_int16 silk_SUB16(opus_int16 a, opus_int16 b){
     return ret;
 }
 
-#undef    silk_SUB32
+#undef silk_SUB32
 static inline opus_int32 silk_SUB32(opus_int32 a, opus_int32 b){
     opus_int32 ret;
 
@@ -78,7 +78,7 @@ static inline opus_int32 silk_SUB32(opus_int32 a, opus_int32 b){
     return ret;
 }
 
-#undef    silk_SUB64
+#undef silk_SUB64
 static inline opus_int64 silk_SUB64(opus_int64 a, opus_int64 b){
     opus_int64 ret;
 
@@ -175,6 +175,7 @@ static inline opus_uint32 silk_MUL_uint(opus_uint32 a32, opus_uint32 b32){
     silk_assert((opus_uint64)ret == (opus_uint64)a32 * (opus_uint64)b32);        /* Check output overflow */
     return ret;
 }
+
 #undef silk_MLA
 static inline opus_int32 silk_MLA(opus_int32 a32, opus_int32 b32, opus_int32 c32){
     opus_int32 ret;
@@ -191,14 +192,15 @@ static inline opus_int32 silk_MLA_uint(opus_uint32 a32, opus_uint32 b32, opus_ui
     return ret;
 }
 
-#undef    silk_SMULWB
+#undef silk_SMULWB
 static inline opus_int32 silk_SMULWB(opus_int32 a32, opus_int32 b32){
     opus_int32 ret;
     ret = (a32 >> 16) * (opus_int32)((opus_int16)b32) + (((a32 & 0x0000FFFF) * (opus_int32)((opus_int16)b32)) >> 16);
     silk_assert((opus_int64)ret == ((opus_int64)a32 * (opus_int16)b32) >> 16);
     return ret;
 }
-#undef    silk_SMLAWB
+
+#undef silk_SMLAWB
 static inline opus_int32 silk_SMLAWB(opus_int32 a32, opus_int32 b32, opus_int32 c32){
     opus_int32 ret;
     ret = silk_ADD32( a32, silk_SMULWB( b32, c32 ) );
@@ -213,6 +215,7 @@ static inline opus_int32 silk_SMULWT(opus_int32 a32, opus_int32 b32){
     silk_assert((opus_int64)ret == ((opus_int64)a32 * (b32 >> 16)) >> 16);
     return ret;
 }
+
 #undef silk_SMLAWT
 static inline opus_int32 silk_SMLAWT(opus_int32 a32, opus_int32 b32, opus_int32 c32){
     opus_int32 ret;
@@ -234,7 +237,7 @@ static inline opus_int64 silk_SMULL(opus_int64 a64, opus_int64 b64){
 }
 
 /* no checking needed for silk_SMULBB */
-#undef    silk_SMLABB
+#undef silk_SMLABB
 static inline opus_int32 silk_SMLABB(opus_int32 a32, opus_int32 b32, opus_int32 c32){
     opus_int32 ret;
     ret = a32 + (opus_int32)((opus_int16)b32) * (opus_int32)((opus_int16)c32);
@@ -243,7 +246,7 @@ static inline opus_int32 silk_SMLABB(opus_int32 a32, opus_int32 b32, opus_int32
 }
 
 /* no checking needed for silk_SMULBT */
-#undef    silk_SMLABT
+#undef silk_SMLABT
 static inline opus_int32 silk_SMLABT(opus_int32 a32, opus_int32 b32, opus_int32 c32){
     opus_int32 ret;
     ret = a32 + ((opus_int32)((opus_int16)b32)) * (c32 >> 16);
@@ -252,7 +255,7 @@ static inline opus_int32 silk_SMLABT(opus_int32 a32, opus_int32 b32, opus_int32
 }
 
 /* no checking needed for silk_SMULTT */
-#undef    silk_SMLATT
+#undef silk_SMLATT
 static inline opus_int32 silk_SMLATT(opus_int32 a32, opus_int32 b32, opus_int32 c32){
     opus_int32 ret;
     ret = a32 + (b32 >> 16) * (c32 >> 16);
@@ -260,7 +263,7 @@ static inline opus_int32 silk_SMLATT(opus_int32 a32, opus_int32 b32, opus_int32
     return ret;
 }
 
-#undef    silk_SMULWW
+#undef silk_SMULWW
 static inline opus_int32 silk_SMULWW(opus_int32 a32, opus_int32 b32){
     opus_int32 ret, tmp1, tmp2;
     opus_int64 ret64;
@@ -281,7 +284,7 @@ static inline opus_int32 silk_SMULWW(opus_int32 a32, opus_int32 b32){
     return ret;
 }
 
-#undef    silk_SMLAWW
+#undef silk_SMLAWW
 static inline opus_int32 silk_SMLAWW(opus_int32 a32, opus_int32 b32, opus_int32 c32){
     opus_int32 ret, tmp;
 
@@ -292,9 +295,9 @@ static inline opus_int32 silk_SMLAWW(opus_int32 a32, opus_int32 b32, opus_int32
 }
 
 /* Multiply-accumulate macros that allow overflow in the addition (ie, no asserts in debug mode) */
-#undef    silk_MLA_ovflw
+#undef  silk_MLA_ovflw
 #define silk_MLA_ovflw(a32, b32, c32)    ((a32) + ((b32) * (c32)))
-#undef    silk_SMLABB_ovflw
+#undef  silk_SMLABB_ovflw
 #define silk_SMLABB_ovflw(a32, b32, c32)    ((a32) + ((opus_int32)((opus_int16)(b32))) * (opus_int32)((opus_int16)(c32)))
 
 /* no checking needed for silk_SMULL
@@ -325,7 +328,8 @@ static inline opus_int32 silk_DIV32_16(opus_int32 a32, opus_int32 b32){
    no checking needed for silk_ADD_POS_SAT16
    no checking needed for silk_ADD_POS_SAT32
    no checking needed for silk_ADD_POS_SAT64 */
-#undef    silk_LSHIFT8
+
+#undef silk_LSHIFT8
 static inline opus_int8 silk_LSHIFT8(opus_int8 a, opus_int32 shift){
     opus_int8 ret;
     ret = a << shift;
@@ -334,7 +338,8 @@ static inline opus_int8 silk_LSHIFT8(opus_int8 a, opus_int32 shift){
     silk_assert((opus_int64)ret == ((opus_int64)a) << shift);
     return ret;
 }
-#undef    silk_LSHIFT16
+
+#undef silk_LSHIFT16
 static inline opus_int16 silk_LSHIFT16(opus_int16 a, opus_int32 shift){
     opus_int16 ret;
     ret = a << shift;
@@ -343,7 +348,8 @@ static inline opus_int16 silk_LSHIFT16(opus_int16 a, opus_int32 shift){
     silk_assert((opus_int64)ret == ((opus_int64)a) << shift);
     return ret;
 }
-#undef    silk_LSHIFT32
+
+#undef silk_LSHIFT32
 static inline opus_int32 silk_LSHIFT32(opus_int32 a, opus_int32 shift){
     opus_int32 ret;
     ret = a << shift;
@@ -352,20 +358,21 @@ static inline opus_int32 silk_LSHIFT32(opus_int32 a, opus_int32 shift){
     silk_assert((opus_int64)ret == ((opus_int64)a) << shift);
     return ret;
 }
-#undef    silk_LSHIFT64
+
+#undef silk_LSHIFT64
 static inline opus_int64 silk_LSHIFT64(opus_int64 a, opus_int shift){
     silk_assert(shift >= 0);
     silk_assert(shift < 64);
     return a << shift;
 }
 
-#undef    silk_LSHIFT_ovflw
+#undef silk_LSHIFT_ovflw
 static inline opus_int32 silk_LSHIFT_ovflw(opus_int32 a, opus_int32 shift){
     silk_assert(shift >= 0);            /* no check for overflow */
     return a << shift;
 }
 
-#undef    silk_LSHIFT_uint
+#undef silk_LSHIFT_uint
 static inline opus_uint32 silk_LSHIFT_uint(opus_uint32 a, opus_int32 shift){
     opus_uint32 ret;
     ret = a << shift;
@@ -374,39 +381,42 @@ static inline opus_uint32 silk_LSHIFT_uint(opus_uint32 a, opus_int32 shift){
     return ret;
 }
 
-#undef    silk_RSHIFT8
+#undef silk_RSHIFT8
 static inline opus_int8 silk_RSHIFT8(opus_int8 a, opus_int32 shift){
     silk_assert(shift >=  0);
     silk_assert(shift < 8);
     return a >> shift;
 }
-#undef    silk_RSHIFT16
+
+#undef silk_RSHIFT16
 static inline opus_int16 silk_RSHIFT16(opus_int16 a, opus_int32 shift){
     silk_assert(shift >=  0);
     silk_assert(shift < 16);
     return a >> shift;
 }
-#undef    silk_RSHIFT32
+
+#undef silk_RSHIFT32
 static inline opus_int32 silk_RSHIFT32(opus_int32 a, opus_int32 shift){
     silk_assert(shift >=  0);
     silk_assert(shift < 32);
     return a >> shift;
 }
-#undef    silk_RSHIFT64
+
+#undef silk_RSHIFT64
 static inline opus_int64 silk_RSHIFT64(opus_int64 a, opus_int64 shift){
     silk_assert(shift >=  0);
     silk_assert(shift <= 63);
     return a >> shift;
 }
 
-#undef    silk_RSHIFT_uint
+#undef silk_RSHIFT_uint
 static inline opus_uint32 silk_RSHIFT_uint(opus_uint32 a, opus_int32 shift){
     silk_assert(shift >=  0);
     silk_assert(shift <= 32);
     return a >> shift;
 }
 
-#undef    silk_ADD_LSHIFT
+#undef silk_ADD_LSHIFT
 static inline opus_int32 silk_ADD_LSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){
     opus_int32 ret;
     silk_assert(shift >= 0);
@@ -415,7 +425,8 @@ static inline opus_int32 silk_ADD_LSHIFT(opus_int32 a, opus_int32 b, opus_int32
     silk_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) << shift));
     return ret;                /* shift >= 0 */
 }
-#undef    silk_ADD_LSHIFT32
+
+#undef silk_ADD_LSHIFT32
 static inline opus_int32 silk_ADD_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
     opus_int32 ret;
     silk_assert(shift >= 0);
@@ -424,7 +435,8 @@ static inline opus_int32 silk_ADD_LSHIFT32(opus_int32 a, opus_int32 b, opus_int3
     silk_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) << shift));
     return ret;                /* shift >= 0 */
 }
-#undef    silk_ADD_LSHIFT_uint
+
+#undef silk_ADD_LSHIFT_uint
 static inline opus_uint32 silk_ADD_LSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){
     opus_uint32 ret;
     silk_assert(shift >= 0);
@@ -433,7 +445,8 @@ static inline opus_uint32 silk_ADD_LSHIFT_uint(opus_uint32 a, opus_uint32 b, opu
     silk_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) << shift));
     return ret;                /* shift >= 0 */
 }
-#undef    silk_ADD_RSHIFT
+
+#undef silk_ADD_RSHIFT
 static inline opus_int32 silk_ADD_RSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){
     opus_int32 ret;
     silk_assert(shift >= 0);
@@ -442,7 +455,8 @@ static inline opus_int32 silk_ADD_RSHIFT(opus_int32 a, opus_int32 b, opus_int32
     silk_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) >> shift));
     return ret;                /* shift  > 0 */
 }
-#undef    silk_ADD_RSHIFT32
+
+#undef silk_ADD_RSHIFT32
 static inline opus_int32 silk_ADD_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
     opus_int32 ret;
     silk_assert(shift >= 0);
@@ -451,7 +465,8 @@ static inline opus_int32 silk_ADD_RSHIFT32(opus_int32 a, opus_int32 b, opus_int3
     silk_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) >> shift));
     return ret;                /* shift  > 0 */
 }
-#undef    silk_ADD_RSHIFT_uint
+
+#undef silk_ADD_RSHIFT_uint
 static inline opus_uint32 silk_ADD_RSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){
     opus_uint32 ret;
     silk_assert(shift >= 0);
@@ -460,7 +475,8 @@ static inline opus_uint32 silk_ADD_RSHIFT_uint(opus_uint32 a, opus_uint32 b, opu
     silk_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) >> shift));
     return ret;                /* shift  > 0 */
 }
-#undef    silk_SUB_LSHIFT32
+
+#undef silk_SUB_LSHIFT32
 static inline opus_int32 silk_SUB_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
     opus_int32 ret;
     silk_assert(shift >= 0);
@@ -469,7 +485,8 @@ static inline opus_int32 silk_SUB_LSHIFT32(opus_int32 a, opus_int32 b, opus_int3
     silk_assert((opus_int64)ret == (opus_int64)a - (((opus_int64)b) << shift));
     return ret;                /* shift >= 0 */
 }
-#undef    silk_SUB_RSHIFT32
+
+#undef silk_SUB_RSHIFT32
 static inline opus_int32 silk_SUB_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){
     opus_int32 ret;
     silk_assert(shift >= 0);
@@ -479,7 +496,7 @@ static inline opus_int32 silk_SUB_RSHIFT32(opus_int32 a, opus_int32 b, opus_int3
     return ret;                /* shift  > 0 */
 }
 
-#undef    silk_RSHIFT_ROUND
+#undef silk_RSHIFT_ROUND
 static inline opus_int32 silk_RSHIFT_ROUND(opus_int32 a, opus_int32 shift){
     opus_int32 ret;
     silk_assert(shift > 0);        /* the marco definition can't handle a shift of zero */
@@ -489,7 +506,7 @@ static inline opus_int32 silk_RSHIFT_ROUND(opus_int32 a, opus_int32 shift){
     return ret;
 }
 
-#undef    silk_RSHIFT_ROUND64
+#undef silk_RSHIFT_ROUND64
 static inline opus_int64 silk_RSHIFT_ROUND64(opus_int64 a, opus_int32 shift){
     opus_int64 ret;
     silk_assert(shift > 0);        /* the marco definition can't handle a shift of zero */
@@ -499,25 +516,25 @@ static inline opus_int64 silk_RSHIFT_ROUND64(opus_int64 a, opus_int32 shift){
 }
 
 /* silk_abs is used on floats also, so doesn't work... */
-/*#undef    silk_abs
+/*#undef silk_abs
 static inline opus_int32 silk_abs(opus_int32 a){
     silk_assert(a != 0x80000000);
     return (((a) >  0)  ? (a) : -(a));            // Be careful, silk_abs returns wrong when input equals to silk_intXX_MIN
 }*/
 
-#undef    silk_abs_int64
+#undef silk_abs_int64
 static inline opus_int64 silk_abs_int64(opus_int64 a){
     silk_assert(a != 0x8000000000000000);
     return (((a) >  0)  ? (a) : -(a));            /* Be careful, silk_abs returns wrong when input equals to silk_intXX_MIN */
 }
 
-#undef    silk_abs_int32
+#undef silk_abs_int32
 static inline opus_int32 silk_abs_int32(opus_int32 a){
     silk_assert(a != 0x80000000);
     return abs(a);
 }
 
-#undef    silk_CHECK_FIT8
+#undef silk_CHECK_FIT8
 static inline opus_int8 silk_CHECK_FIT8( opus_int64 a ){
     opus_int8 ret;
     ret = (opus_int8)a;
@@ -525,7 +542,7 @@ static inline opus_int8 silk_CHECK_FIT8( opus_int64 a ){
     return( ret );
 }
 
-#undef    silk_CHECK_FIT16
+#undef silk_CHECK_FIT16
 static inline opus_int16 silk_CHECK_FIT16( opus_int64 a ){
     opus_int16 ret;
     ret = (opus_int16)a;
@@ -533,7 +550,7 @@ static inline opus_int16 silk_CHECK_FIT16( opus_int64 a ){
     return( ret );
 }
 
-#undef    silk_CHECK_FIT32
+#undef silk_CHECK_FIT32
 static inline opus_int32 silk_CHECK_FIT32( opus_int64 a ){
     opus_int32 ret;
     ret = (opus_int32)a;
index d43b61d..abb73ed 100644 (file)
@@ -64,9 +64,9 @@ static inline void silk_NLSF2A_find_poly(
 
 /* compute whitening filter coefficients from normalized line spectral frequencies */
 void silk_NLSF2A(
-    opus_int16        *a_Q12,            /* O    monic whitening filter coefficients in Q12,  [ d ]  */
-    const opus_int16  *NLSF,             /* I    normalized line spectral frequencies in Q15, [ d ]  */
-    const opus_int    d                  /* I    filter order (should be even)                       */
+    opus_int16                  *a_Q12,             /* O    monic whitening filter coefficients in Q12,  [ d ]          */
+    const opus_int16            *NLSF,              /* I    normalized line spectral frequencies in Q15, [ d ]          */
+    const opus_int              d                   /* I    filter order (should be even)                               */
 )
 {
     /* This ordering was found to maximize quality. It improves numerical accuracy of
index a9d781a..e547542 100644 (file)
@@ -33,11 +33,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /* Compute quantization errors for an LPC_order element input vector for a VQ codebook */
 void silk_NLSF_VQ(
-    opus_int32                   err_Q26[],              /* O    Quantization errors [K]                     */
-    const opus_int16             in_Q15[],               /* I    Input vectors to be quantized [LPC_order]   */
-    const opus_uint8             pCB_Q8[],               /* I    Codebook vectors [K*LPC_order]              */
-    const opus_int               K,                      /* I    Number of codebook vectors                  */
-    const opus_int               LPC_order               /* I    Number of LPCs                              */
+    opus_int32                  err_Q26[],                      /* O    Quantization errors [K]                     */
+    const opus_int16            in_Q15[],                       /* I    Input vectors to be quantized [LPC_order]   */
+    const opus_uint8            pCB_Q8[],                       /* I    Codebook vectors [K*LPC_order]              */
+    const opus_int              K,                              /* I    Number of codebook vectors                  */
+    const opus_int              LPC_order                       /* I    Number of LPCs                              */
 )
 {
     opus_int        i, m;
index 887d347..8e8be43 100644 (file)
@@ -40,9 +40,9 @@ Signal Processing, pp. 641-644, 1991.
 
 /* Laroia low complexity NLSF weights */
 void silk_NLSF_VQ_weights_laroia(
-    opus_int16           *pNLSFW_Q_OUT,      /* O: Pointer to input vector weights           [D x 1]     */
-    const opus_int16     *pNLSF_Q15,         /* I: Pointer to input vector                   [D x 1]     */
-    const opus_int       D                   /* I: Input vector dimension (even)                         */
+    opus_int16                  *pNLSFW_Q_OUT,      /* O     Pointer to input vector weights [D]                        */
+    const opus_int16            *pNLSF_Q15,         /* I     Pointer to input vector         [D]                        */
+    const opus_int              D                   /* I     Input vector dimension (even)                              */
 )
 {
     opus_int   k;
index 43f4f9f..b1b83ae 100644 (file)
@@ -61,9 +61,9 @@ static inline void silk_NLSF_residual_dequant(               /* O    Returns RD
 /* NLSF vector decoder */
 /***********************/
 void silk_NLSF_decode(
-          opus_int16             *pNLSF_Q15,             /* O    Quantized NLSF vector [ LPC_ORDER ]     */
-          opus_int8              *NLSFIndices,           /* I    Codebook path vector [ LPC_ORDER + 1 ]  */
-    const silk_NLSF_CB_struct   *psNLSF_CB              /* I    Codebook object                         */
+          opus_int16            *pNLSF_Q15,                     /* O    Quantized NLSF vector [ LPC_ORDER ]         */
+          opus_int8             *NLSFIndices,                   /* I    Codebook path vector [ LPC_ORDER + 1 ]      */
+    const silk_NLSF_CB_struct   *psNLSF_CB                      /* I    Codebook object                             */
 )
 {
     opus_int         i;
index 926ad7f..d2eef3c 100644 (file)
@@ -32,17 +32,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "main.h"
 
 /* Delayed-decision quantizer for NLSF residuals */
-opus_int32 silk_NLSF_del_dec_quant(                      /* O    Returns RD value in Q25                     */
-    opus_int8                    indices[],              /* O    Quantization indices [ order ]              */
-    const opus_int16             x_Q10[],                /* I    Input [ order ]                             */
-    const opus_int16             w_Q5[],                 /* I    Weights [ order ]                           */
-    const opus_uint8             pred_coef_Q8[],         /* I    Backward predictor coefs [ order ]          */
-    const opus_int16             ec_ix[],                /* I    Indices to entropy coding tables [ order ]  */
-    const opus_uint8             ec_rates_Q5[],          /* I    Rates []                                    */
-    const opus_int               quant_step_size_Q16,    /* I    Quantization step size                      */
-    const opus_int16             inv_quant_step_size_Q6, /* I    Inverse quantization step size              */
-    const opus_int32             mu_Q20,                 /* I    R/D tradeoff                                */
-    const opus_int16             order                   /* I    Number of input values                      */
+opus_int32 silk_NLSF_del_dec_quant(                             /* O    Returns RD value in Q25                     */
+    opus_int8                   indices[],                      /* O    Quantization indices [ order ]              */
+    const opus_int16            x_Q10[],                        /* I    Input [ order ]                             */
+    const opus_int16            w_Q5[],                         /* I    Weights [ order ]                           */
+    const opus_uint8            pred_coef_Q8[],                 /* I    Backward predictor coefs [ order ]          */
+    const opus_int16            ec_ix[],                        /* I    Indices to entropy coding tables [ order ]  */
+    const opus_uint8            ec_rates_Q5[],                  /* I    Rates []                                    */
+    const opus_int              quant_step_size_Q16,            /* I    Quantization step size                      */
+    const opus_int16            inv_quant_step_size_Q6,         /* I    Inverse quantization step size              */
+    const opus_int32            mu_Q20,                         /* I    R/D tradeoff                                */
+    const opus_int16            order                           /* I    Number of input values                      */
 )
 {
     opus_int         i, j, nStates, ind_tmp, ind_min_max, ind_max_min, in_Q10, res_Q10;
@@ -182,7 +182,7 @@ opus_int32 silk_NLSF_del_dec_quant(                      /* O    Returns RD valu
                 ind[ j ][ i ] += silk_RSHIFT( ind_sort[ j ], NLSF_QUANT_DEL_DEC_STATES_LOG2 );
             }
         } else {  /* i == 0 */
-          break;
+            break;
         }
     }
 
index fbff0a0..cc84160 100644 (file)
@@ -31,19 +31,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include "main.h"
 
-#define STORE_LSF_DATA_FOR_TRAINING          0
-
 /***********************/
 /* NLSF vector encoder */
 /***********************/
-opus_int32 silk_NLSF_encode(                                 /* O    Returns RD value in Q25                 */
-          opus_int8                  *NLSFIndices,           /* I    Codebook path vector [ LPC_ORDER + 1 ]  */
-          opus_int16                 *pNLSF_Q15,             /* I/O  Quantized NLSF vector [ LPC_ORDER ]     */
-    const silk_NLSF_CB_struct       *psNLSF_CB,             /* I    Codebook object                         */
-    const opus_int16                 *pW_QW,                 /* I    NLSF weight vector [ LPC_ORDER ]        */
-    const opus_int                   NLSF_mu_Q20,            /* I    Rate weight for the RD optimization     */
-    const opus_int                   nSurvivors,             /* I    Max survivors after first stage         */
-    const opus_int                   signalType              /* I    Signal type: 0/1/2                      */
+opus_int32 silk_NLSF_encode(                                    /* O    Returns RD value in Q25                     */
+          opus_int8             *NLSFIndices,                   /* I    Codebook path vector [ LPC_ORDER + 1 ]      */
+          opus_int16            *pNLSF_Q15,                     /* I/O  Quantized NLSF vector [ LPC_ORDER ]         */
+    const silk_NLSF_CB_struct   *psNLSF_CB,                     /* I    Codebook object                             */
+    const opus_int16            *pW_QW,                         /* I    NLSF weight vector [ LPC_ORDER ]            */
+    const opus_int              NLSF_mu_Q20,                    /* I    Rate weight for the RD optimization         */
+    const opus_int              nSurvivors,                     /* I    Max survivors after first stage             */
+    const opus_int              signalType                      /* I    Signal type: 0/1/2                          */
 )
 {
     opus_int         i, s, ind1, bestIndex, prob_Q8, bits_q7;
@@ -61,15 +59,6 @@ opus_int32 silk_NLSF_encode(                                 /* O    Returns RD
     opus_int16       ec_ix[        MAX_LPC_ORDER ];
     const opus_uint8 *pCB_element, *iCDF_ptr;
 
-#if STORE_LSF_DATA_FOR_TRAINING
-    opus_int16       pNLSF_Q15_orig[MAX_LPC_ORDER ];
-    DEBUG_STORE_DATA( NLSF.dat,    pNLSF_Q15,    psNLSF_CB->order * sizeof( opus_int16 ) );
-    DEBUG_STORE_DATA( WNLSF.dat,   pW_Q5,        psNLSF_CB->order * sizeof( opus_int16 ) );
-    DEBUG_STORE_DATA( NLSF_mu.dat, &NLSF_mu_Q20,                    sizeof( opus_int   ) );
-    DEBUG_STORE_DATA( sigType.dat, &signalType,                     sizeof( opus_int   ) );
-    silk_memcpy(pNLSF_Q15_orig, pNLSF_Q15, sizeof( pNLSF_Q15_orig ));
-#endif
-
     silk_assert( nSurvivors <= NLSF_VQ_MAX_SURVIVORS );
     silk_assert( signalType >= 0 && signalType <= 2 );
     silk_assert( NLSF_mu_Q20 <= 32767 && NLSF_mu_Q20 >= 0 );
@@ -135,53 +124,5 @@ opus_int32 silk_NLSF_encode(                                 /* O    Returns RD
     /* Decode */
     silk_NLSF_decode( pNLSF_Q15, NLSFIndices, psNLSF_CB );
 
-#if STORE_LSF_DATA_FOR_TRAINING
-    {
-        /* code for training the codebooks */
-        opus_int32 RD_dec_Q22, Dist_Q22_dec, Rate_Q7, diff_Q15;
-        ind1 = NLSFIndices[ 0 ];
-        silk_NLSF_unpack( ec_ix, pred_Q8, psNLSF_CB, ind1 );
-
-        pCB_element = &psNLSF_CB->CB1_NLSF_Q8[ ind1 * psNLSF_CB->order ];
-        for( i = 0; i < psNLSF_CB->order; i++ ) {
-            NLSF_tmp_Q15[ i ] = silk_LSHIFT16( ( opus_int16 )pCB_element[ i ], 7 );
-        }
-        silk_NLSF_VQ_weights_laroia( W_tmp_QW, NLSF_tmp_Q15, psNLSF_CB->order );
-        for( i = 0; i < psNLSF_CB->order; i++ ) {
-            W_tmp_Q9 = silk_SQRT_APPROX( silk_LSHIFT( ( opus_int32 )W_tmp_QW[ i ], 18 - NLSF_W_Q ) );
-            res_Q15[ i ] = pNLSF_Q15_orig[ i ] - NLSF_tmp_Q15[ i ];
-            res_Q10[ i ] = (opus_int16)silk_RSHIFT( silk_SMULBB( res_Q15[ i ], W_tmp_Q9 ), 14 );
-            DEBUG_STORE_DATA( NLSF_res_q10.dat, &res_Q10[ i ], sizeof( opus_int16 ) );
-            res_Q15[ i ] = pNLSF_Q15[ i ] - NLSF_tmp_Q15[ i ];
-            res_Q10[ i ] = (opus_int16)silk_RSHIFT( silk_SMULBB( res_Q15[ i ], W_tmp_Q9 ), 14 );
-            DEBUG_STORE_DATA( NLSF_resq_q10.dat, &res_Q10[ i ], sizeof( opus_int16 ) );
-        }
-
-        Dist_Q22_dec = 0;
-        for( i = 0; i < psNLSF_CB->order; i++ ) {
-            diff_Q15 = pNLSF_Q15_orig[ i ] - pNLSF_Q15[ i ];
-            Dist_Q22_dec += ( ( (diff_Q15 >> 5) * (diff_Q15 >> 5) ) * pW_Q5[ i ] ) >> 3;
-        }
-        iCDF_ptr = &psNLSF_CB->CB1_iCDF[ ( signalType >> 1 ) * psNLSF_CB->nVectors ];
-        if( ind1 == 0 ) {
-            prob_Q8 = 256 - iCDF_ptr[ ind1 ];
-        } else {
-            prob_Q8 = iCDF_ptr[ ind1 - 1 ] - iCDF_ptr[ ind1 ];
-        }
-        Rate_Q7 = ( 8 << 7 ) - silk_lin2log( prob_Q8 );
-        for( i = 0; i < psNLSF_CB->order; i++ ) {
-            Rate_Q7 += ((int)psNLSF_CB->ec_Rates_Q5[ ec_ix[ i ] + silk_LIMIT( NLSFIndices[ i + 1 ] + NLSF_QUANT_MAX_AMPLITUDE, 0, 2 * NLSF_QUANT_MAX_AMPLITUDE ) ] ) << 2;
-            if( silk_abs( NLSFIndices[ i + 1 ] ) >= NLSF_QUANT_MAX_AMPLITUDE ) {
-                Rate_Q7 += 128 << ( silk_abs( NLSFIndices[ i + 1 ] ) - NLSF_QUANT_MAX_AMPLITUDE );
-            }
-        }
-        RD_dec_Q22 = Dist_Q22_dec + Rate_Q7 * NLSF_mu_Q20 >> 5;
-        DEBUG_STORE_DATA( dec_dist_q22.dat, &Dist_Q22_dec, sizeof( opus_int32 ) );
-        DEBUG_STORE_DATA( dec_rate_q7.dat, &Rate_Q7, sizeof( opus_int32 ) );
-        DEBUG_STORE_DATA( dec_rd_q22.dat, &RD_dec_Q22, sizeof( opus_int32 ) );
-    }
-    DEBUG_STORE_DATA( NLSF_ind.dat, NLSFIndices, (psNLSF_CB->order+1) * sizeof( opus_int8 ) );
-#endif
-
     return RD_Q25[ 0 ];
 }
index 1c7d60b..d818ff0 100644 (file)
@@ -45,9 +45,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /* NLSF stabilizer, for a single input data vector */
 void silk_NLSF_stabilize(
-          opus_int16  *NLSF_Q15,            /* I/O:  Unstable/stabilized normalized LSF vector in Q15 [L]                    */
-    const opus_int16  *NDeltaMin_Q15,       /* I:    Normalized delta min vector in Q15, NDeltaMin_Q15[L] must be >= 1 [L+1] */
-    const opus_int     L                    /* I:    Number of NLSF parameters in the input vector                           */
+          opus_int16            *NLSF_Q15,          /* I/O   Unstable/stabilized normalized LSF vector in Q15 [L]       */
+    const opus_int16            *NDeltaMin_Q15,     /* I     Min distance vector, NDeltaMin_Q15[L] must be >= 1 [L+1]   */
+    const opus_int              L                   /* I     Number of NLSF parameters in the input vector              */
 )
 {
     opus_int   i, I=0, k, loops;
@@ -82,7 +82,7 @@ void silk_NLSF_stabilize(
         /***************************************************/
         /* Now check if the smallest distance non-negative */
         /***************************************************/
-        if (min_diff_Q15 >= 0) {
+        if( min_diff_Q15 >= 0 ) {
             return;
         }
 
index 3f4d292..46b2940 100644 (file)
@@ -33,10 +33,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /* Unpack predictor values and indices for entropy coding tables */
 void silk_NLSF_unpack(
-          opus_int16             ec_ix[],                /* O    Indices to entropy tales [ LPC_ORDER ]  */
-          opus_uint8             pred_Q8[],              /* O    LSF predictor [ LPC_ORDER ]             */
-    const silk_NLSF_CB_struct   *psNLSF_CB,             /* I    Codebook object                         */
-    const opus_int               CB1_index               /* I    Index of vector in first LSF codebook   */
+          opus_int16            ec_ix[],                        /* O    Indices to entropy tales [ LPC_ORDER ]      */
+          opus_uint8            pred_Q8[],                      /* O    LSF predictor [ LPC_ORDER ]                 */
+    const silk_NLSF_CB_struct   *psNLSF_CB,                     /* I    Codebook object                             */
+    const opus_int              CB1_index                       /* I    Index of vector in first LSF codebook       */
 )
 {
     opus_int   i;
index 6bd39eb..031b581 100644 (file)
@@ -32,57 +32,57 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "main.h"
 
 static inline void silk_nsq_scale_states(
-    const silk_encoder_state *psEncC,       /* I    Encoder State                   */
-    silk_nsq_state      *NSQ,               /* I/O  NSQ state                       */
-    const opus_int16     x[],                /* I    input in Q0                     */
-    opus_int32           x_sc_Q10[],         /* O    input scaled with 1/Gain        */
-    const opus_int16     sLTP[],             /* I    re-whitened LTP state in Q0     */
-    opus_int32           sLTP_Q16[],         /* O    LTP state matching scaled input */
-    opus_int             subfr,              /* I    subframe number                 */
-    const opus_int       LTP_scale_Q14,      /* I                                    */
-    const opus_int32     Gains_Q16[ MAX_NB_SUBFR ], /* I                             */
-    const opus_int       pitchL[ MAX_NB_SUBFR ],     /* I    Pitch lag                           */
-    const opus_int       signal_type                 /* I    Signal type                         */
+    const silk_encoder_state *psEncC,           /* I    Encoder State                   */
+    silk_nsq_state      *NSQ,                   /* I/O  NSQ state                       */
+    const opus_int16    x[],                    /* I    input in Q0                     */
+    opus_int32          x_sc_Q10[],             /* O    input scaled with 1/Gain        */
+    const opus_int16    sLTP[],                 /* I    re-whitened LTP state in Q0     */
+    opus_int32          sLTP_Q16[],             /* O    LTP state matching scaled input */
+    opus_int            subfr,                  /* I    subframe number                 */
+    const opus_int      LTP_scale_Q14,          /* I                                    */
+    const opus_int32    Gains_Q16[ MAX_NB_SUBFR ], /* I                                 */
+    const opus_int      pitchL[ MAX_NB_SUBFR ], /* I    Pitch lag                       */
+    const opus_int      signal_type             /* I    Signal type                     */
 );
 
 static inline void silk_noise_shape_quantizer(
-    silk_nsq_state      *NSQ,               /* I/O  NSQ state                       */
-    opus_int             signalType,         /* I    Signal type                     */
-    const opus_int32     x_sc_Q10[],         /* I                                    */
-    opus_int8            pulses[],           /* O                                    */
-    opus_int16           xq[],               /* O                                    */
-    opus_int32           sLTP_Q16[],         /* I/O  LTP state                       */
-    const opus_int16     a_Q12[],            /* I    Short term prediction coefs     */
-    const opus_int16     b_Q14[],            /* I    Long term prediction coefs      */
-    const opus_int16     AR_shp_Q13[],       /* I    Noise shaping AR coefs          */
-    opus_int             lag,                /* I    Pitch lag                       */
-    opus_int32           HarmShapeFIRPacked_Q14, /* I                                */
-    opus_int             Tilt_Q14,           /* I    Spectral tilt                   */
-    opus_int32           LF_shp_Q14,         /* I                                    */
-    opus_int32           Gain_Q16,           /* I                                    */
-    opus_int             Lambda_Q10,         /* I                                    */
-    opus_int             offset_Q10,         /* I                                    */
-    opus_int             length,             /* I    Input length                    */
-    opus_int             shapingLPCOrder,    /* I    Noise shaping AR filter order   */
-    opus_int             predictLPCOrder     /* I    Prediction filter order         */
+    silk_nsq_state      *NSQ,                   /* I/O  NSQ state                       */
+    opus_int            signalType,             /* I    Signal type                     */
+    const opus_int32    x_sc_Q10[],             /* I                                    */
+    opus_int8           pulses[],               /* O                                    */
+    opus_int16          xq[],                   /* O                                    */
+    opus_int32          sLTP_Q16[],             /* I/O  LTP state                       */
+    const opus_int16    a_Q12[],                /* I    Short term prediction coefs     */
+    const opus_int16    b_Q14[],                /* I    Long term prediction coefs      */
+    const opus_int16    AR_shp_Q13[],           /* I    Noise shaping AR coefs          */
+    opus_int            lag,                    /* I    Pitch lag                       */
+    opus_int32          HarmShapeFIRPacked_Q14, /* I                                    */
+    opus_int            Tilt_Q14,               /* I    Spectral tilt                   */
+    opus_int32          LF_shp_Q14,             /* I                                    */
+    opus_int32          Gain_Q16,               /* I                                    */
+    opus_int            Lambda_Q10,             /* I                                    */
+    opus_int            offset_Q10,             /* I                                    */
+    opus_int            length,                 /* I    Input length                    */
+    opus_int            shapingLPCOrder,        /* I    Noise shaping AR filter order   */
+    opus_int            predictLPCOrder         /* I    Prediction filter order         */
 );
 
 void silk_NSQ(
-    const silk_encoder_state        *psEncC,                                    /* I/O  Encoder State                       */
-    silk_nsq_state                  *NSQ,                                       /* I/O  NSQ state                           */
-    SideInfoIndices                 *psIndices,                                 /* I/O  Quantization Indices                */
-    const opus_int16                 x[],                                        /* I    prefiltered input signal            */
-    opus_int8                        pulses[],                                   /* O    quantized qulse signal              */
-    const opus_int16                 PredCoef_Q12[ 2 * MAX_LPC_ORDER ],          /* I    Short term prediction coefficients  */
-    const opus_int16                 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ],    /* I    Long term prediction coefficients   */
-    const opus_int16                 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I                                     */
-    const opus_int                   HarmShapeGain_Q14[ MAX_NB_SUBFR ],          /* I                                        */
-    const opus_int                   Tilt_Q14[ MAX_NB_SUBFR ],                   /* I    Spectral tilt                       */
-    const opus_int32                 LF_shp_Q14[ MAX_NB_SUBFR ],                 /* I                                        */
-    const opus_int32                 Gains_Q16[ MAX_NB_SUBFR ],                  /* I                                        */
-    const opus_int                   pitchL[ MAX_NB_SUBFR ],                     /* I                                        */
-    const opus_int                   Lambda_Q10,                                 /* I                                        */
-    const opus_int                   LTP_scale_Q14                               /* I    LTP state scaling                   */
+    const silk_encoder_state    *psEncC,                                    /* I/O  Encoder State                   */
+    silk_nsq_state              *NSQ,                                       /* I/O  NSQ state                       */
+    SideInfoIndices             *psIndices,                                 /* I/O  Quantization Indices            */
+    const opus_int16            x[],                                        /* I    Prefiltered input signal        */
+    opus_int8                   pulses[],                                   /* O    Quantized pulse signal          */
+    const opus_int16            PredCoef_Q12[ 2 * MAX_LPC_ORDER ],          /* I    Short term prediction coefs     */
+    const opus_int16            LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ],    /* I    Long term prediction coefs      */
+    const opus_int16            AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs             */
+    const opus_int              HarmShapeGain_Q14[ MAX_NB_SUBFR ],          /* I    Long term shaping coefs         */
+    const opus_int              Tilt_Q14[ MAX_NB_SUBFR ],                   /* I    Spectral tilt                   */
+    const opus_int32            LF_shp_Q14[ MAX_NB_SUBFR ],                 /* I    Low frequency shaping coefs     */
+    const opus_int32            Gains_Q16[ MAX_NB_SUBFR ],                  /* I    Quantization step sizes         */
+    const opus_int              pitchL[ MAX_NB_SUBFR ],                     /* I    Pitch lags                      */
+    const opus_int              Lambda_Q10,                                 /* I    Rate/distortion tradeoff        */
+    const opus_int              LTP_scale_Q14                               /* I    LTP state scaling               */
 )
 {
     opus_int     k, lag, start_idx, LSF_interpolation_flag;
@@ -159,36 +159,31 @@ void silk_NSQ(
     /* Save quantized speech and noise shaping signals */
     silk_memmove( NSQ->xq,           &NSQ->xq[           psEncC->frame_length ], psEncC->ltp_mem_length * sizeof( opus_int16 ) );
     silk_memmove( NSQ->sLTP_shp_Q10, &NSQ->sLTP_shp_Q10[ psEncC->frame_length ], psEncC->ltp_mem_length * sizeof( opus_int32 ) );
-
-#ifdef SAVE_ALL_INTERNAL_DATA
-    DEBUG_STORE_DATA( xq.dat,       &pxq[ -psEncC->frame_length ],       psEncC->frame_length * sizeof( opus_int16 ) );
-    DEBUG_STORE_DATA( q.dat,        &pulses[ -psEncC->frame_length ],    psEncC->frame_length * sizeof( opus_int8 ) );
-#endif
 }
 
 /***********************************/
 /* silk_noise_shape_quantizer  */
 /***********************************/
 static inline void silk_noise_shape_quantizer(
-    silk_nsq_state  *NSQ,               /* I/O  NSQ state                       */
-    opus_int             signalType,         /* I    Signal type                     */
-    const opus_int32     x_sc_Q10[],         /* I                                    */
-    opus_int8            pulses[],           /* O                                    */
-    opus_int16           xq[],               /* O                                    */
-    opus_int32           sLTP_Q16[],         /* I/O  LTP state                       */
-    const opus_int16     a_Q12[],            /* I    Short term prediction coefs     */
-    const opus_int16     b_Q14[],            /* I    Long term prediction coefs      */
-    const opus_int16     AR_shp_Q13[],       /* I    Noise shaping AR coefs          */
-    opus_int             lag,                /* I    Pitch lag                       */
-    opus_int32           HarmShapeFIRPacked_Q14, /* I                                */
-    opus_int             Tilt_Q14,           /* I    Spectral tilt                   */
-    opus_int32           LF_shp_Q14,         /* I                                    */
-    opus_int32           Gain_Q16,           /* I                                    */
-    opus_int             Lambda_Q10,         /* I                                    */
-    opus_int             offset_Q10,         /* I                                    */
-    opus_int             length,             /* I    Input length                    */
-    opus_int             shapingLPCOrder,    /* I    Noise shaping AR filter order   */
-    opus_int             predictLPCOrder     /* I    Prediction filter order         */
+    silk_nsq_state      *NSQ,                   /* I/O  NSQ state                       */
+    opus_int            signalType,             /* I    Signal type                     */
+    const opus_int32    x_sc_Q10[],             /* I                                    */
+    opus_int8           pulses[],               /* O                                    */
+    opus_int16          xq[],                   /* O                                    */
+    opus_int32          sLTP_Q16[],             /* I/O  LTP state                       */
+    const opus_int16    a_Q12[],                /* I    Short term prediction coefs     */
+    const opus_int16    b_Q14[],                /* I    Long term prediction coefs      */
+    const opus_int16    AR_shp_Q13[],           /* I    Noise shaping AR coefs          */
+    opus_int            lag,                    /* I    Pitch lag                       */
+    opus_int32          HarmShapeFIRPacked_Q14, /* I                                    */
+    opus_int            Tilt_Q14,               /* I    Spectral tilt                   */
+    opus_int32          LF_shp_Q14,             /* I                                    */
+    opus_int32          Gain_Q16,               /* I                                    */
+    opus_int            Lambda_Q10,             /* I                                    */
+    opus_int            offset_Q10,             /* I                                    */
+    opus_int            length,                 /* I    Input length                    */
+    opus_int            shapingLPCOrder,        /* I    Noise shaping AR filter order   */
+    opus_int            predictLPCOrder         /* I    Prediction filter order         */
 )
 {
     opus_int     i, j;
@@ -361,17 +356,17 @@ static inline void silk_noise_shape_quantizer(
 }
 
 static inline void silk_nsq_scale_states(
-    const silk_encoder_state *psEncC,       /* I    Encoder State                   */
-    silk_nsq_state      *NSQ,               /* I/O  NSQ state                       */
-    const opus_int16     x[],                /* I    input in Q0                     */
-    opus_int32           x_sc_Q10[],         /* O    input scaled with 1/Gain        */
-    const opus_int16     sLTP[],             /* I    re-whitened LTP state in Q0     */
-    opus_int32           sLTP_Q16[],         /* O    LTP state matching scaled input */
-    opus_int             subfr,              /* I    subframe number                 */
-    const opus_int       LTP_scale_Q14,      /* I                                    */
-    const opus_int32     Gains_Q16[ MAX_NB_SUBFR ], /* I                             */
-    const opus_int       pitchL[ MAX_NB_SUBFR ],     /* I    Pitch lag                           */
-    const opus_int       signal_type                 /* I    Signal type                         */
+    const silk_encoder_state *psEncC,           /* I    Encoder State                   */
+    silk_nsq_state      *NSQ,                   /* I/O  NSQ state                       */
+    const opus_int16    x[],                    /* I    input in Q0                     */
+    opus_int32          x_sc_Q10[],             /* O    input scaled with 1/Gain        */
+    const opus_int16    sLTP[],                 /* I    re-whitened LTP state in Q0     */
+    opus_int32          sLTP_Q16[],             /* O    LTP state matching scaled input */
+    opus_int            subfr,                  /* I    subframe number                 */
+    const opus_int      LTP_scale_Q14,          /* I                                    */
+    const opus_int32    Gains_Q16[ MAX_NB_SUBFR ], /* I                                 */
+    const opus_int      pitchL[ MAX_NB_SUBFR ], /* I    Pitch lag                       */
+    const opus_int      signal_type             /* I    Signal type                     */
 )
 {
     opus_int   i, lag;
index b84f944..4917ddb 100644 (file)
@@ -58,17 +58,17 @@ static inline void silk_nsq_del_dec_scale_states(
     const silk_encoder_state *psEncC,               /* I    Encoder State                       */
     silk_nsq_state      *NSQ,                       /* I/O  NSQ state                           */
     NSQ_del_dec_struct  psDelDec[],                 /* I/O  Delayed decision states             */
-    const opus_int16     x[],                        /* I    Input in Q0                         */
-    opus_int32           x_sc_Q10[],                 /* O    Input scaled with 1/Gain in Q10     */
-    const opus_int16     sLTP[],                     /* I    Re-whitened LTP state in Q0         */
-    opus_int32           sLTP_Q16[],                 /* O    LTP state matching scaled input     */
-    opus_int             subfr,                      /* I    Subframe number                     */
-    opus_int             nStatesDelayedDecision,     /* I    Number of del dec states            */
-    const opus_int       LTP_scale_Q14,              /* I    LTP state scaling                   */
-    const opus_int32     Gains_Q16[ MAX_NB_SUBFR ],  /* I                                        */
-    const opus_int       pitchL[ MAX_NB_SUBFR ],     /* I    Pitch lag                           */
-    const opus_int       signal_type,                /* I    Signal type                         */
-    const opus_int       decisionDelay               /* I    Decision delay                      */
+    const opus_int16    x[],                        /* I    Input in Q0                         */
+    opus_int32          x_sc_Q10[],                 /* O    Input scaled with 1/Gain in Q10     */
+    const opus_int16    sLTP[],                     /* I    Re-whitened LTP state in Q0         */
+    opus_int32          sLTP_Q16[],                 /* O    LTP state matching scaled input     */
+    opus_int            subfr,                      /* I    Subframe number                     */
+    opus_int            nStatesDelayedDecision,     /* I    Number of del dec states            */
+    const opus_int      LTP_scale_Q14,              /* I    LTP state scaling                   */
+    const opus_int32    Gains_Q16[ MAX_NB_SUBFR ],  /* I                                        */
+    const opus_int      pitchL[ MAX_NB_SUBFR ],     /* I    Pitch lag                           */
+    const opus_int      signal_type,                /* I    Signal type                         */
+    const opus_int      decisionDelay               /* I    Decision delay                      */
 );
 
 /******************************************/
@@ -77,48 +77,48 @@ static inline void silk_nsq_del_dec_scale_states(
 static inline void silk_noise_shape_quantizer_del_dec(
     silk_nsq_state      *NSQ,                   /* I/O  NSQ state                           */
     NSQ_del_dec_struct  psDelDec[],             /* I/O  Delayed decision states             */
-    opus_int             signalType,             /* I    Signal type                         */
-    const opus_int32     x_Q10[],                /* I                                        */
-    opus_int8            pulses[],               /* O                                        */
-    opus_int16           xq[],                   /* O                                        */
-    opus_int32           sLTP_Q16[],             /* I/O  LTP filter state                    */
-    opus_int32           delayedGain_Q16[],      /* I/O  Gain delay buffer                   */
-    const opus_int16     a_Q12[],                /* I    Short term prediction coefs         */
-    const opus_int16     b_Q14[],                /* I    Long term prediction coefs          */
-    const opus_int16     AR_shp_Q13[],           /* I    Noise shaping coefs                 */
-    opus_int             lag,                    /* I    Pitch lag                           */
-    opus_int32           HarmShapeFIRPacked_Q14, /* I                                        */
-    opus_int             Tilt_Q14,               /* I    Spectral tilt                       */
-    opus_int32           LF_shp_Q14,             /* I                                        */
-    opus_int32           Gain_Q16,               /* I                                        */
-    opus_int             Lambda_Q10,             /* I                                        */
-    opus_int             offset_Q10,             /* I                                        */
-    opus_int             length,                 /* I    Input length                        */
-    opus_int             subfr,                  /* I    Subframe number                     */
-    opus_int             shapingLPCOrder,        /* I    Shaping LPC filter order            */
-    opus_int             predictLPCOrder,        /* I    Prediction filter order             */
-    opus_int             warping_Q16,            /* I                                        */
-    opus_int             nStatesDelayedDecision, /* I    Number of states in decision tree   */
-    opus_int             *smpl_buf_idx,          /* I    Index to newest samples in buffers  */
-    opus_int             decisionDelay           /* I                                        */
+    opus_int            signalType,             /* I    Signal type                         */
+    const opus_int32    x_Q10[],                /* I                                        */
+    opus_int8           pulses[],               /* O                                        */
+    opus_int16          xq[],                   /* O                                        */
+    opus_int32          sLTP_Q16[],             /* I/O  LTP filter state                    */
+    opus_int32          delayedGain_Q16[],      /* I/O  Gain delay buffer                   */
+    const opus_int16    a_Q12[],                /* I    Short term prediction coefs         */
+    const opus_int16    b_Q14[],                /* I    Long term prediction coefs          */
+    const opus_int16    AR_shp_Q13[],           /* I    Noise shaping coefs                 */
+    opus_int            lag,                    /* I    Pitch lag                           */
+    opus_int32          HarmShapeFIRPacked_Q14, /* I                                        */
+    opus_int            Tilt_Q14,               /* I    Spectral tilt                       */
+    opus_int32          LF_shp_Q14,             /* I                                        */
+    opus_int32          Gain_Q16,               /* I                                        */
+    opus_int            Lambda_Q10,             /* I                                        */
+    opus_int            offset_Q10,             /* I                                        */
+    opus_int            length,                 /* I    Input length                        */
+    opus_int            subfr,                  /* I    Subframe number                     */
+    opus_int            shapingLPCOrder,        /* I    Shaping LPC filter order            */
+    opus_int            predictLPCOrder,        /* I    Prediction filter order             */
+    opus_int            warping_Q16,            /* I                                        */
+    opus_int            nStatesDelayedDecision, /* I    Number of states in decision tree   */
+    opus_int            *smpl_buf_idx,          /* I    Index to newest samples in buffers  */
+    opus_int            decisionDelay           /* I                                        */
 );
 
 void silk_NSQ_del_dec(
-    const silk_encoder_state        *psEncC,                                    /* I/O  Encoder State                       */
-    silk_nsq_state                  *NSQ,                                       /* I/O  NSQ state                           */
-    SideInfoIndices                 *psIndices,                                 /* I/O  Quantization Indices                */
-    const opus_int16                 x[],                                        /* I    Prefiltered input signal            */
-    opus_int8                        pulses[],                                   /* O    Quantized pulse signal              */
-    const opus_int16                 PredCoef_Q12[ 2 * MAX_LPC_ORDER ],          /* I    Prediction coefs                    */
-    const opus_int16                 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ],    /* I    LT prediction coefs                 */
-    const opus_int16                 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I                                     */
-    const opus_int                   HarmShapeGain_Q14[ MAX_NB_SUBFR ],          /* I                                        */
-    const opus_int                   Tilt_Q14[ MAX_NB_SUBFR ],                   /* I    Spectral tilt                       */
-    const opus_int32                 LF_shp_Q14[ MAX_NB_SUBFR ],                 /* I                                        */
-    const opus_int32                 Gains_Q16[ MAX_NB_SUBFR ],                  /* I                                        */
-    const opus_int                   pitchL[ MAX_NB_SUBFR ],                     /* I                                        */
-    const opus_int                   Lambda_Q10,                                 /* I                                        */
-    const opus_int                   LTP_scale_Q14                               /* I    LTP state scaling                   */
+    const silk_encoder_state    *psEncC,                                    /* I/O  Encoder State                   */
+    silk_nsq_state              *NSQ,                                       /* I/O  NSQ state                       */
+    SideInfoIndices             *psIndices,                                 /* I/O  Quantization Indices            */
+    const opus_int16            x[],                                        /* I    Prefiltered input signal        */
+    opus_int8                   pulses[],                                   /* O    Quantized pulse signal          */
+    const opus_int16            PredCoef_Q12[ 2 * MAX_LPC_ORDER ],          /* I    Short term prediction coefs     */
+    const opus_int16            LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ],    /* I    Long term prediction coefs      */
+    const opus_int16            AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs             */
+    const opus_int              HarmShapeGain_Q14[ MAX_NB_SUBFR ],          /* I    Long term shaping coefs         */
+    const opus_int              Tilt_Q14[ MAX_NB_SUBFR ],                   /* I    Spectral tilt                   */
+    const opus_int32            LF_shp_Q14[ MAX_NB_SUBFR ],                 /* I    Low frequency shaping coefs     */
+    const opus_int32            Gains_Q16[ MAX_NB_SUBFR ],                  /* I    Quantization step sizes         */
+    const opus_int              pitchL[ MAX_NB_SUBFR ],                     /* I    Pitch lags                      */
+    const opus_int              Lambda_Q10,                                 /* I    Rate/distortion tradeoff        */
+    const opus_int              LTP_scale_Q14                               /* I    LTP state scaling               */
 )
 {
     opus_int     i, k, lag, start_idx, LSF_interpolation_flag, Winner_ind, subfr;
@@ -285,43 +285,38 @@ void silk_NSQ_del_dec(
     /* Save quantized speech and noise shaping signals */
     silk_memmove( NSQ->xq,           &NSQ->xq[           psEncC->frame_length ], psEncC->ltp_mem_length * sizeof( opus_int16 ) );
     silk_memmove( NSQ->sLTP_shp_Q10, &NSQ->sLTP_shp_Q10[ psEncC->frame_length ], psEncC->ltp_mem_length * sizeof( opus_int32 ) );
-
-#ifdef SAVE_ALL_INTERNAL_DATA
-    DEBUG_STORE_DATA( xq.dat,       &pxq[ -psEncC->frame_length ],       psEncC->frame_length * sizeof( opus_int16 ) );
-    DEBUG_STORE_DATA( q.dat,        &pulses[ -psEncC->frame_length ],    psEncC->frame_length * sizeof( opus_int8 ) );
-#endif
 }
 
 /******************************************/
 /* Noise shape quantizer for one subframe */
 /******************************************/
 static inline void silk_noise_shape_quantizer_del_dec(
-    silk_nsq_state  *NSQ,                   /* I/O  NSQ state                           */
+    silk_nsq_state      *NSQ,                   /* I/O  NSQ state                           */
     NSQ_del_dec_struct  psDelDec[],             /* I/O  Delayed decision states             */
-    opus_int             signalType,             /* I    Signal type                         */
-    const opus_int32     x_Q10[],                /* I                                        */
-    opus_int8            pulses[],               /* O                                        */
-    opus_int16           xq[],                   /* O                                        */
-    opus_int32           sLTP_Q16[],             /* I/O  LTP filter state                    */
-    opus_int32           delayedGain_Q16[],      /* I/O  Gain delay buffer                   */
-    const opus_int16     a_Q12[],                /* I    Short term prediction coefs         */
-    const opus_int16     b_Q14[],                /* I    Long term prediction coefs          */
-    const opus_int16     AR_shp_Q13[],           /* I    Noise shaping coefs                 */
-    opus_int             lag,                    /* I    Pitch lag                           */
-    opus_int32           HarmShapeFIRPacked_Q14, /* I                                        */
-    opus_int             Tilt_Q14,               /* I    Spectral tilt                       */
-    opus_int32           LF_shp_Q14,             /* I                                        */
-    opus_int32           Gain_Q16,               /* I                                        */
-    opus_int             Lambda_Q10,             /* I                                        */
-    opus_int             offset_Q10,             /* I                                        */
-    opus_int             length,                 /* I    Input length                        */
-    opus_int             subfr,                  /* I    Subframe number                     */
-    opus_int             shapingLPCOrder,        /* I    Shaping LPC filter order            */
-    opus_int             predictLPCOrder,        /* I    Prediction filter order             */
-    opus_int             warping_Q16,            /* I                                        */
-    opus_int             nStatesDelayedDecision, /* I    Number of states in decision tree   */
-    opus_int             *smpl_buf_idx,          /* I    Index to newest samples in buffers  */
-    opus_int             decisionDelay           /* I                                        */
+    opus_int            signalType,             /* I    Signal type                         */
+    const opus_int32    x_Q10[],                /* I                                        */
+    opus_int8           pulses[],               /* O                                        */
+    opus_int16          xq[],                   /* O                                        */
+    opus_int32          sLTP_Q16[],             /* I/O  LTP filter state                    */
+    opus_int32          delayedGain_Q16[],      /* I/O  Gain delay buffer                   */
+    const opus_int16    a_Q12[],                /* I    Short term prediction coefs         */
+    const opus_int16    b_Q14[],                /* I    Long term prediction coefs          */
+    const opus_int16    AR_shp_Q13[],           /* I    Noise shaping coefs                 */
+    opus_int            lag,                    /* I    Pitch lag                           */
+    opus_int32          HarmShapeFIRPacked_Q14, /* I                                        */
+    opus_int            Tilt_Q14,               /* I    Spectral tilt                       */
+    opus_int32          LF_shp_Q14,             /* I                                        */
+    opus_int32          Gain_Q16,               /* I                                        */
+    opus_int            Lambda_Q10,             /* I                                        */
+    opus_int            offset_Q10,             /* I                                        */
+    opus_int            length,                 /* I    Input length                        */
+    opus_int            subfr,                  /* I    Subframe number                     */
+    opus_int            shapingLPCOrder,        /* I    Shaping LPC filter order            */
+    opus_int            predictLPCOrder,        /* I    Prediction filter order             */
+    opus_int            warping_Q16,            /* I                                        */
+    opus_int            nStatesDelayedDecision, /* I    Number of states in decision tree   */
+    opus_int            *smpl_buf_idx,          /* I    Index to newest samples in buffers  */
+    opus_int            decisionDelay           /* I                                        */
 )
 {
     opus_int     i, j, k, Winner_ind, RDmin_ind, RDmax_ind, last_smple_idx;
@@ -605,17 +600,17 @@ static inline void silk_nsq_del_dec_scale_states(
     const silk_encoder_state *psEncC,               /* I    Encoder State                       */
     silk_nsq_state      *NSQ,                       /* I/O  NSQ state                           */
     NSQ_del_dec_struct  psDelDec[],                 /* I/O  Delayed decision states             */
-    const opus_int16     x[],                        /* I    Input in Q0                         */
-    opus_int32           x_sc_Q10[],                 /* O    Input scaled with 1/Gain in Q10     */
-    const opus_int16     sLTP[],                     /* I    Re-whitened LTP state in Q0         */
-    opus_int32           sLTP_Q16[],                 /* O    LTP state matching scaled input     */
-    opus_int             subfr,                      /* I    Subframe number                     */
-    opus_int             nStatesDelayedDecision,     /* I    Number of del dec states            */
-    const opus_int       LTP_scale_Q14,              /* I    LTP state scaling                   */
-    const opus_int32     Gains_Q16[ MAX_NB_SUBFR ],  /* I                                        */
-    const opus_int       pitchL[ MAX_NB_SUBFR ],     /* I    Pitch lag                           */
-    const opus_int       signal_type,                /* I    Signal type                         */
-    const opus_int       decisionDelay               /* I    Decision delay                      */
+    const opus_int16    x[],                        /* I    Input in Q0                         */
+    opus_int32          x_sc_Q10[],                 /* O    Input scaled with 1/Gain in Q10     */
+    const opus_int16    sLTP[],                     /* I    Re-whitened LTP state in Q0         */
+    opus_int32          sLTP_Q16[],                 /* O    LTP state matching scaled input     */
+    opus_int            subfr,                      /* I    Subframe number                     */
+    opus_int            nStatesDelayedDecision,     /* I    Number of del dec states            */
+    const opus_int      LTP_scale_Q14,              /* I    LTP state scaling                   */
+    const opus_int32    Gains_Q16[ MAX_NB_SUBFR ],  /* I                                        */
+    const opus_int      pitchL[ MAX_NB_SUBFR ],     /* I    Pitch lag                           */
+    const opus_int      signal_type,                /* I    Signal type                         */
+    const opus_int      decisionDelay               /* I    Decision delay                      */
 )
 {
     opus_int            i, k, lag;
index 7624a91..e2ad20a 100644 (file)
@@ -38,29 +38,29 @@ static const opus_int16 PLC_RAND_ATTENUATE_V_Q15[NB_ATT]  = { 31130, 26214 }; /*
 static const opus_int16 PLC_RAND_ATTENUATE_UV_Q15[NB_ATT] = { 32440, 29491 }; /* 0.99, 0.9 */
 
 static inline void silk_PLC_update(
-    silk_decoder_state      *psDec,             /* I/O Decoder state        */
-    silk_decoder_control    *psDecCtrl          /* I/O Decoder control      */
+    silk_decoder_state                  *psDec,             /* I/O Decoder state        */
+    silk_decoder_control                *psDecCtrl          /* I/O Decoder control      */
 );
 
 static inline void silk_PLC_conceal(
-    silk_decoder_state      *psDec,             /* I/O Decoder state        */
-    silk_decoder_control    *psDecCtrl,         /* I/O Decoder control      */
-    opus_int16                signal[]          /* O LPC residual signal    */
+    silk_decoder_state                  *psDec,             /* I/O Decoder state        */
+    silk_decoder_control                *psDecCtrl,         /* I/O Decoder control      */
+    opus_int16                          signal[]            /* O LPC residual signal    */
 );
 
 
 void silk_PLC_Reset(
-    silk_decoder_state      *psDec              /* I/O Decoder state        */
+    silk_decoder_state                  *psDec              /* I/O Decoder state        */
 )
 {
     psDec->sPLC.pitchL_Q8 = silk_RSHIFT( psDec->frame_length, 1 );
 }
 
 void silk_PLC(
-    silk_decoder_state          *psDec,             /* I Decoder state          */
-    silk_decoder_control        *psDecCtrl,         /* I Decoder control        */
-    opus_int16                   frame[],            /* O Concealed signal       */
-    opus_int                     lost                /* I Loss flag              */
+    silk_decoder_state                  *psDec,             /* I/O Decoder state        */
+    silk_decoder_control                *psDecCtrl,         /* I/O Decoder control      */
+    opus_int16                          frame[],            /* I/O  signal              */
+    opus_int                            lost                /* I Loss flag              */
 )
 {
     /* PLC control function */
@@ -88,8 +88,8 @@ void silk_PLC(
 /* Update state of PLC                            */
 /**************************************************/
 static inline void silk_PLC_update(
-    silk_decoder_state          *psDec,             /* (I/O) Decoder state          */
-    silk_decoder_control        *psDecCtrl          /* (I/O) Decoder control        */
+    silk_decoder_state                  *psDec,             /* I/O Decoder state        */
+    silk_decoder_control                *psDecCtrl          /* I/O Decoder control      */
 )
 {
     opus_int32 LTP_Gain_Q14, temp_LTP_Gain_Q14;
@@ -104,7 +104,7 @@ static inline void silk_PLC_update(
     if( psDec->indices.signalType == TYPE_VOICED ) {
         /* Find the parameters for the last subframe which contains a pitch pulse */
         for( j = 0; j * psDec->subfr_length < psDecCtrl->pitchL[ psDec->nb_subfr - 1 ]; j++ ) {
-            if( j == psDec->nb_subfr ){
+            if( j == psDec->nb_subfr ) {
                 break;
             }
             temp_LTP_Gain_Q14 = 0;
@@ -160,9 +160,9 @@ static inline void silk_PLC_update(
 }
 
 static inline void silk_PLC_conceal(
-    silk_decoder_state          *psDec,             /* I/O Decoder state */
-    silk_decoder_control        *psDecCtrl,         /* I/O Decoder control */
-    opus_int16                   frame[]            /* O concealed signal */
+    silk_decoder_state                  *psDec,             /* I/O Decoder state        */
+    silk_decoder_control                *psDecCtrl,         /* I/O Decoder control      */
+    opus_int16                          frame[]             /* O LPC residual signal    */
 )
 {
     opus_int   i, j, k;
@@ -344,9 +344,9 @@ static inline void silk_PLC_conceal(
 
 /* Glues concealed frames with new good recieved frames             */
 void silk_PLC_glue_frames(
-    silk_decoder_state          *psDec,             /* I/O decoder state    */
-    opus_int16                   frame[],            /* I/O signal           */
-    opus_int                     length              /* I length of residual */
+    silk_decoder_state                  *psDec,             /* I/O decoder state        */
+    opus_int16                          frame[],            /* I/O signal               */
+    opus_int                            length              /* I length of signal       */
 )
 {
     opus_int   i, energy_shift;
index 4d985a6..c1f1e7e 100644 (file)
@@ -31,32 +31,32 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "main.h"
 
 #define BWE_COEF                        0.99
-#define V_PITCH_GAIN_START_MIN_Q14      11469           /* 0.7 in Q14                       */
-#define V_PITCH_GAIN_START_MAX_Q14      15565           /* 0.95 in Q14                      */
+#define V_PITCH_GAIN_START_MIN_Q14      11469               /* 0.7 in Q14               */
+#define V_PITCH_GAIN_START_MAX_Q14      15565               /* 0.95 in Q14              */
 #define MAX_PITCH_LAG_MS                18
 #define SA_THRES_Q8                     50
 #define USE_SINGLE_TAP                  1
 #define RAND_BUF_SIZE                   128
-#define RAND_BUF_MASK                   (RAND_BUF_SIZE - 1)
-#define LOG2_INV_LPC_GAIN_HIGH_THRES    3               /* 2^3 = 8 dB LPC gain              */
-#define LOG2_INV_LPC_GAIN_LOW_THRES     8               /* 2^8 = 24 dB LPC gain             */
-#define PITCH_DRIFT_FAC_Q16             655             /* 0.01 in Q16                      */
+#define RAND_BUF_MASK                   ( RAND_BUF_SIZE - 1 )
+#define LOG2_INV_LPC_GAIN_HIGH_THRES    3                   /* 2^3 = 8 dB LPC gain      */
+#define LOG2_INV_LPC_GAIN_LOW_THRES     8                   /* 2^8 = 24 dB LPC gain     */
+#define PITCH_DRIFT_FAC_Q16             655                 /* 0.01 in Q16              */
 
 void silk_PLC_Reset(
-    silk_decoder_state      *psDec              /* I/O Decoder state        */
+    silk_decoder_state                  *psDec              /* I/O Decoder state        */
 );
 
 void silk_PLC(
-    silk_decoder_state      *psDec,             /* I/O Decoder state        */
-    silk_decoder_control    *psDecCtrl,         /* I/O Decoder control      */
-    opus_int16                   signal[],           /* I/O  signal              */
-    opus_int                     lost                /* I Loss flag              */
+    silk_decoder_state                  *psDec,             /* I/O Decoder state        */
+    silk_decoder_control                *psDecCtrl,         /* I/O Decoder control      */
+    opus_int16                          frame[],            /* I/O  signal              */
+    opus_int                            lost                /* I Loss flag              */
 );
 
 void silk_PLC_glue_frames(
-    silk_decoder_state      *psDec,             /* I/O decoder state        */
-    opus_int16                   signal[],           /* I/O signal               */
-    opus_int                     length              /* I length of signal       */
+    silk_decoder_state                  *psDec,             /* I/O decoder state        */
+    opus_int16                          frame[],            /* I/O signal               */
+    opus_int                            length              /* I length of signal       */
 );
 
 #endif
index d24eac6..a80ac97 100644 (file)
@@ -35,10 +35,10 @@ extern "C"
 
 /*#define silk_MACRO_COUNT */          /* Used to enable WMOPS counting */
 
-#define SILK_MAX_ORDER_LPC            16                        /* max order of the LPC analysis in schur() and k2a()    */
+#define SILK_MAX_ORDER_LPC            16            /* max order of the LPC analysis in schur() and k2a() */
 
-#include <stdlib.h>                                             /* for abs() */
-#include <string.h>                                             /* for memset(), memcpy(), memmove() */
+#include <stdlib.h>                                 /* for abs() */
+#include <string.h>                                 /* for memset(), memcpy(), memmove() */
 #include "typedef.h"
 #include "resampler_structs.h"
 #include "macros.h"
@@ -52,39 +52,39 @@ extern "C"
  * Initialize/reset the resampler state for a given pair of input/output sampling rates
 */
 opus_int silk_resampler_init(
-    silk_resampler_state_struct            *S,         /* I/O: Resampler state             */
-    opus_int32                            Fs_Hz_in,    /* I:    Input sampling rate (Hz)    */
-    opus_int32                            Fs_Hz_out    /* I:    Output sampling rate (Hz)    */
+    silk_resampler_state_struct *S,                 /* I/O   Resampler state                                            */
+    opus_int32                  Fs_Hz_in,           /* I     Input sampling rate (Hz)                                   */
+    opus_int32                  Fs_Hz_out           /* I     Output sampling rate (Hz)                                  */
 );
 
 /*!
  * Resampler: convert from one sampling rate to another
  */
 opus_int silk_resampler(
-    silk_resampler_state_struct            *S,         /* I/O: Resampler state             */
-    opus_int16                            out[],        /* O:    Output signal                 */
-    const opus_int16                        in[],        /* I:    Input signal                */
-    opus_int32                            inLen        /* I:    Number of input samples        */
+    silk_resampler_state_struct *S,                 /* I/O   Resampler state                                            */
+    opus_int16                  out[],              /* O     Output signal                                              */
+    const opus_int16            in[],               /* I     Input signal                                               */
+    opus_int32                  inLen               /* I     Number of input samples                                    */
 );
 
 /*!
 * Downsample 2x, mediocre quality
 */
 void silk_resampler_down2(
-    opus_int32                           *S,         /* I/O: State vector [ 2 ]                  */
-    opus_int16                           *out,       /* O:   Output signal [ len ]               */
-    const opus_int16                     *in,        /* I:   Input signal [ floor(len/2) ]       */
-    opus_int32                           inLen       /* I:   Number of input samples             */
+    opus_int32                  *S,                 /* I/O  State vector [ 2 ]                                          */
+    opus_int16                  *out,               /* O    Output signal [ len ]                                       */
+    const opus_int16            *in,                /* I    Input signal [ floor(len/2) ]                               */
+    opus_int32                  inLen               /* I    Number of input samples                                     */
 );
 
 /*!
  * Downsample by a factor 2/3, low quality
 */
 void silk_resampler_down2_3(
-    opus_int32                           *S,         /* I/O: State vector [ 6 ]                  */
-    opus_int16                           *out,       /* O:   Output signal [ floor(2*inLen/3) ]  */
-    const opus_int16                     *in,        /* I:   Input signal [ inLen ]              */
-    opus_int32                           inLen       /* I:   Number of input samples             */
+    opus_int32                  *S,                 /* I/O  State vector [ 6 ]                                          */
+    opus_int16                  *out,               /* O    Output signal [ floor(2*inLen/3) ]                          */
+    const opus_int16            *in,                /* I    Input signal [ inLen ]                                      */
+    opus_int32                  inLen               /* I    Number of input samples                                     */
 );
 
 /*!
@@ -93,268 +93,269 @@ void silk_resampler_down2_3(
  * can handle (slowly) varying coefficients
  */
 void silk_biquad_alt(
-    const opus_int16     *in,           /* I:    input signal                 */
-    const opus_int32     *B_Q28,        /* I:    MA coefficients [3]          */
-    const opus_int32     *A_Q28,        /* I:    AR coefficients [2]          */
-    opus_int32           *S,            /* I/O:  State vector [2]             */
-    opus_int16           *out,          /* O:    output signal                */
-    const opus_int32     len,           /* I:    signal length (must be even) */
-    opus_int             stride          /* I:    Operate on interleaved signal if > 1 */
+    const opus_int16            *in,                /* I     input signal                                               */
+    const opus_int32            *B_Q28,             /* I     MA coefficients [3]                                        */
+    const opus_int32            *A_Q28,             /* I     AR coefficients [2]                                        */
+    opus_int32                  *S,                 /* I/O   State vector [2]                                           */
+    opus_int16                  *out,               /* O     output signal                                              */
+    const opus_int32            len,                /* I     signal length (must be even)                               */
+    opus_int                    stride              /* I     Operate on interleaved signal if > 1                       */
 );
 
 /* Variable order MA prediction error filter. */
 void silk_LPC_analysis_filter(
-    opus_int16            *out,         /* O:   Output signal                               */
-    const opus_int16      *in,          /* I:   Input signal                                */
-    const opus_int16      *B,           /* I:   MA prediction coefficients, Q12 [order]     */
-    const opus_int32      len,          /* I:   Signal length                               */
-    const opus_int32      Order         /* I:   Filter order                                */
+    opus_int16                  *out,               /* O    Output signal                                               */
+    const opus_int16            *in,                /* I    Input signal                                                */
+    const opus_int16            *B,                 /* I    MA prediction coefficients, Q12 [order]                     */
+    const opus_int32            len,                /* I    Signal length                                               */
+    const opus_int32            d                   /* I    Filter order                                                */
 );
 
 /* Chirp (bandwidth expand) LP AR filter */
 void silk_bwexpander(
-    opus_int16            *ar,          /* I/O  AR filter to be expanded (without leading 1)    */
-    const opus_int        d,            /* I    Length of ar                                    */
-    opus_int32            chirp_Q16     /* I    Chirp factor (typically in the range 0 to 1)    */
+    opus_int16                  *ar,                /* I/O  AR filter to be expanded (without leading 1)                */
+    const opus_int              d,                  /* I    Length of ar                                                */
+    opus_int32                  chirp_Q16           /* I    Chirp factor (typically in the range 0 to 1)                */
 );
 
 /* Chirp (bandwidth expand) LP AR filter */
 void silk_bwexpander_32(
-    opus_int32            *ar,          /* I/O  AR filter to be expanded (without leading 1)    */
-    const opus_int        d,            /* I    Length of ar                                    */
-    opus_int32            chirp_Q16     /* I    Chirp factor in Q16                             */
+    opus_int32                  *ar,                /* I/O  AR filter to be expanded (without leading 1)                */
+    const opus_int              d,                  /* I    Length of ar                                                */
+    opus_int32                  chirp_Q16           /* I    Chirp factor in Q16                                         */
 );
 
 /* Compute inverse of LPC prediction gain, and                           */
 /* test if LPC coefficients are stable (all poles within unit circle)    */
-opus_int silk_LPC_inverse_pred_gain(     /* O:  Returns 1 if unstable, otherwise 0          */
-    opus_int32            *invGain_Q30,  /* O:  Inverse prediction gain, Q30 energy domain  */
-    const opus_int16      *A_Q12,        /* I:  Prediction coefficients, Q12 [order]        */
-    const opus_int        order          /* I:  Prediction order                            */
+opus_int silk_LPC_inverse_pred_gain(                /* O   Returns 1 if unstable, otherwise 0                           */
+    opus_int32                  *invGain_Q30,       /* O   Inverse prediction gain, Q30 energy domain                   */
+    const opus_int16            *A_Q12,             /* I   Prediction coefficients, Q12 [order]                         */
+    const opus_int              order               /* I   Prediction order                                             */
 );
 
-opus_int silk_LPC_inverse_pred_gain_Q24( /* O:   Returns 1 if unstable, otherwise 0      */
-    opus_int32           *invGain_Q30,   /* O:   Inverse prediction gain, Q30 energy domain  */
-    const opus_int32     *A_Q24,         /* I:   Prediction coefficients, Q24 [order]        */
-    const opus_int       order           /* I:   Prediction order                            */
+opus_int silk_LPC_inverse_pred_gain_Q24(            /* O    Returns 1 if unstable, otherwise 0                          */
+    opus_int32                  *invGain_Q30,       /* O    Inverse prediction gain, Q30 energy domain                  */
+    const opus_int32            *A_Q24,             /* I    Prediction coefficients, Q24 [order]                        */
+    const opus_int              order               /* I    Prediction order                                            */
 );
 
-/* split signal in two decimated bands using first-order allpass filters */
+/* Split signal in two decimated bands using first-order allpass filters */
 void silk_ana_filt_bank_1(
-    const opus_int16      *in,           /* I:   Input signal [N]        */
-    opus_int32            *S,            /* I/O: State vector [2]        */
-    opus_int16            *outL,         /* O:   Low band [N/2]          */
-    opus_int16            *outH,         /* O:   High band [N/2]         */
-    const opus_int32      N              /* I:   Number of input samples */
+    const opus_int16            *in,                /* I    Input signal [N]                                            */ 
+    opus_int32                  *S,                 /* I/O  State vector [2]                                            */
+    opus_int16                  *outL,              /* O    Low band [N/2]                                              */
+    opus_int16                  *outH,              /* O    High band [N/2]                                             */
+    const opus_int32            N                   /* I    Number of input samples                                     */
 );
 
 /********************************************************************/
 /*                        SCALAR FUNCTIONS                          */
 /********************************************************************/
 
-/* approximation of 128 * log2() (exact inverse of approx 2^() below) */
-/* convert input to a log scale    */
-opus_int32 silk_lin2log(const opus_int32 inLin);        /* I: input in linear scale        */
+/* Approximation of 128 * log2() (exact inverse of approx 2^() below) */
+/* Convert input to a log scale    */
+opus_int32 silk_lin2log( 
+    const opus_int32            inLin               /* I  input in linear scale                                         */
+);
 
 /* Approximation of a sigmoid function */
-opus_int silk_sigm_Q15(opus_int in_Q5);
+opus_int silk_sigm_Q15( 
+    opus_int                    in_Q5               /* I                                                                */
+);
 
-/* approximation of 2^() (exact inverse of approx log2() above) */
-/* convert input to a linear scale    */
-opus_int32 silk_log2lin(const opus_int32 inLog_Q7);    /* I: input on log scale */
+/* Approximation of 2^() (exact inverse of approx log2() above) */
+/* Convert input to a linear scale */
+opus_int32 silk_log2lin( 
+    const opus_int32            inLog_Q7            /* I  input on log scale                                            */
+);
 
 /* Function that returns the maximum absolut value of the input vector */
-opus_int16 silk_int16_array_maxabs(      /* O   Maximum absolute value, max: 2^15-1   */
-    const opus_int16     *vec,           /* I   Input vector  [len]                   */
-    const opus_int32     len             /* I   Length of input vector                */
+opus_int16 silk_int16_array_maxabs(                 /* O   Maximum absolute value, max: 2^15-1                          */
+    const opus_int16            *vec,               /* I   Input vector  [len]                                          */
+    const opus_int32            len                 /* I   Length of input vector                                       */
 );
 
 /* Compute number of bits to right shift the sum of squares of a vector    */
 /* of int16s to make it fit in an int32                                    */
 void silk_sum_sqr_shift(
-    opus_int32           *energy,        /* O   Energy of x, after shifting to the right            */
-    opus_int             *shift,         /* O   Number of bits right shift applied to energy        */
-    const opus_int16     *x,             /* I   Input vector                                        */
-    opus_int             len             /* I   Length of input vector                              */
+    opus_int32                  *energy,            /* O   Energy of x, after shifting to the right                     */
+    opus_int                    *shift,             /* O   Number of bits right shift applied to energy                 */
+    const opus_int16            *x,                 /* I   Input vector                                                 */
+    opus_int                    len                 /* I   Length of input vector                                       */
 );
 
 /* Calculates the reflection coefficients from the correlation sequence    */
 /* Faster than schur64(), but much less accurate.                          */
 /* uses SMLAWB(), requiring armv5E and higher.                             */
-opus_int32 silk_schur(                   /* O:    Returns residual energy                   */
-    opus_int16           *rc_Q15,        /* O:    reflection coefficients [order] Q15       */
-    const opus_int32     *c,             /* I:    correlations [order+1]                    */
-    const opus_int32     order           /* I:    prediction order                          */
+opus_int32 silk_schur(                              /* O    Returns residual energy                                     */
+    opus_int16                  *rc_Q15,            /* O    reflection coefficients [order] Q15                         */
+    const opus_int32            *c,                 /* I    correlations [order+1]                                      */
+    const opus_int32            order               /* I    prediction order                                            */
 );
 
 /* Calculates the reflection coefficients from the correlation sequence    */
 /* Slower than schur(), but more accurate.                                 */
 /* Uses SMULL(), available on armv4                                        */
-opus_int32 silk_schur64(                 /* O:  returns residual energy                     */
-    opus_int32           rc_Q16[],       /* O:  Reflection coefficients [order] Q16         */
-    const opus_int32     c[],            /* I:  Correlations [order+1]                      */
-    opus_int32           order           /* I:  Prediction order                            */
+opus_int32 silk_schur64(                            /* O    returns residual energy                                     */
+    opus_int32                  rc_Q16[],           /* O    Reflection coefficients [order] Q16                         */
+    const opus_int32            c[],                /* I    Correlations [order+1]                                      */
+    opus_int32                  order               /* I    Prediction order                                            */
 );
 
 /* Step up function, converts reflection coefficients to prediction coefficients */
 void silk_k2a(
-    opus_int32           *A_Q24,         /* O:  Prediction coefficients [order] Q24         */
-    const opus_int16     *rc_Q15,        /* I:  Reflection coefficients [order] Q15         */
-    const opus_int32     order           /* I:  Prediction order                            */
+    opus_int32                  *A_Q24,             /* O    Prediction coefficients [order] Q24                         */
+    const opus_int16            *rc_Q15,            /* I    Reflection coefficients [order] Q15                         */
+    const opus_int32            order               /* I    Prediction order                                            */
 );
 
 /* Step up function, converts reflection coefficients to prediction coefficients */
 void silk_k2a_Q16(
-    opus_int32           *A_Q24,         /* O:  Prediction coefficients [order] Q24         */
-    const opus_int32     *rc_Q16,        /* I:  Reflection coefficients [order] Q16         */
-    const opus_int32     order           /* I:  Prediction order                            */
+    opus_int32                  *A_Q24,             /* O    Prediction coefficients [order] Q24                         */
+    const opus_int32            *rc_Q16,            /* I    Reflection coefficients [order] Q16                         */
+    const opus_int32            order               /* I    Prediction order                                            */
 );
 
-/* Apply sine window to signal vector.                                      */
-/* Window types:                                                            */
-/*    1 -> sine window from 0 to pi/2                                       */
-/*    2 -> sine window from pi/2 to pi                                      */
-/* every other sample of window is linearly interpolated, for speed         */
+/* Apply sine window to signal vector.                              */
+/* Window types:                                                    */
+/*    1 -> sine window from 0 to pi/2                               */
+/*    2 -> sine window from pi/2 to pi                              */
+/* every other sample of window is linearly interpolated, for speed */
 void silk_apply_sine_window(
-    opus_int16           px_win[],       /* O  Pointer to windowed signal                  */
-    const opus_int16     px[],           /* I  Pointer to input signal                     */
-    const opus_int       win_type,       /* I  Selects a window type                       */
-    const opus_int       length          /* I  Window length, multiple of 4                */
+    opus_int16                  px_win[],           /* O    Pointer to windowed signal                                  */
+    const opus_int16            px[],               /* I    Pointer to input signal                                     */
+    const opus_int              win_type,           /* I    Selects a window type                                       */
+    const opus_int              length              /* I    Window length, multiple of 4                                */
 );
 
 /* Compute autocorrelation */
 void silk_autocorr(
-    opus_int32           *results,       /* O  Result (length correlationCount)            */
-    opus_int             *scale,         /* O  Scaling of the correlation vector           */
-    const opus_int16     *inputData,     /* I  Input data to correlate                     */
-    const opus_int       inputDataSize,  /* I  Length of input                             */
-    const opus_int       correlationCount /* I  Number of correlation taps to compute      */
+    opus_int32                  *results,           /* O    Result (length correlationCount)                            */
+    opus_int                    *scale,             /* O    Scaling of the correlation vector                           */
+    const opus_int16            *inputData,         /* I    Input data to correlate                                     */
+    const opus_int              inputDataSize,      /* I    Length of input                                             */
+    const opus_int              correlationCount    /* I    Number of correlation taps to compute                       */
 );
 
-/* Pitch estimator */
-#define SILK_PE_MIN_COMPLEX        0
-#define SILK_PE_MID_COMPLEX        1
-#define SILK_PE_MAX_COMPLEX        2
-
 void silk_decode_pitch(
-    opus_int16       lagIndex,                        /* I                             */
-    opus_int8        contourIndex,                    /* O                             */
-    opus_int         pitch_lags[],                    /* O 4 pitch values              */
-    const opus_int   Fs_kHz,                          /* I sampling frequency (kHz)    */
-    const opus_int   nb_subfr                         /* I number of sub frames        */
-);
-
-opus_int silk_pitch_analysis_core(        /* O    Voicing estimate: 0 voiced, 1 unvoiced                     */
-    const opus_int16  *signal,            /* I    Signal of length PE_FRAME_LENGTH_MS*Fs_kHz                 */
-    opus_int          *pitch_out,         /* O    4 pitch lag values                                         */
-    opus_int16        *lagIndex,          /* O    Lag Index                                                  */
-    opus_int8         *contourIndex,      /* O    Pitch contour Index                                        */
-    opus_int          *LTPCorr_Q15,       /* I/O  Normalized correlation; input: value from previous frame   */
-    opus_int          prevLag,            /* I    Last lag of previous frame; set to zero is unvoiced        */
-    const opus_int32  search_thres1_Q16,  /* I    First stage threshold for lag candidates 0 - 1             */
-    const opus_int    search_thres2_Q15,  /* I    Final threshold for lag candidates 0 - 1                   */
-    const opus_int    Fs_kHz,             /* I    Sample frequency (kHz)                                     */
-    const opus_int    complexity,         /* I    Complexity setting, 0-2, where 2 is highest                */
-    const opus_int    nb_subfr            /* I    number of 5 ms subframes                                   */
+    opus_int16                  lagIndex,           /* I                                                                */
+    opus_int8                   contourIndex,       /* O                                                                */
+    opus_int                    pitch_lags[],       /* O    4 pitch values                                              */
+    const opus_int              Fs_kHz,             /* I    sampling frequency (kHz)                                    */
+    const opus_int              nb_subfr            /* I    number of sub frames                                        */
+);
+
+opus_int silk_pitch_analysis_core(                  /* O    Voicing estimate: 0 voiced, 1 unvoiced                      */
+    const opus_int16            *frame,             /* I    Signal of length PE_FRAME_LENGTH_MS*Fs_kHz                  */
+    opus_int                    *pitch_out,         /* O    4 pitch lag values                                          */
+    opus_int16                  *lagIndex,          /* O    Lag Index                                                   */
+    opus_int8                   *contourIndex,      /* O    Pitch contour Index                                         */
+    opus_int                    *LTPCorr_Q15,       /* I/O  Normalized correlation; input: value from previous frame    */
+    opus_int                    prevLag,            /* I    Last lag of previous frame; set to zero is unvoiced         */
+    const opus_int32            search_thres1_Q16,  /* I    First stage threshold for lag candidates 0 - 1              */
+    const opus_int              search_thres2_Q15,  /* I    Final threshold for lag candidates 0 - 1                    */
+    const opus_int              Fs_kHz,             /* I    Sample frequency (kHz)                                      */
+    const opus_int              complexity,         /* I    Complexity setting, 0-2, where 2 is highest                 */
+    const opus_int              nb_subfr            /* I    number of 5 ms subframes                                    */
 );
 
 /* Compute Normalized Line Spectral Frequencies (NLSFs) from whitening filter coefficients      */
 /* If not all roots are found, the a_Q16 coefficients are bandwidth expanded until convergence. */
 void silk_A2NLSF(
-    opus_int16          *NLSF,            /* O    Normalized Line Spectral Frequencies, Q15 (0 - (2^15-1)), [d] */
-    opus_int32          *a_Q16,           /* I/O  Monic whitening filter coefficients in Q16 [d]                */
-    const opus_int      d                 /* I    Filter order (must be even)                                   */
+    opus_int16                  *NLSF,              /* O    Normalized Line Spectral Frequencies in Q15 (0..2^15-1) [d] */
+    opus_int32                  *a_Q16,             /* I/O  Monic whitening filter coefficients in Q16 [d]              */
+    const opus_int              d                   /* I    Filter order (must be even)                                 */
 );
 
 /* compute whitening filter coefficients from normalized line spectral frequencies */
 void silk_NLSF2A(
-    opus_int16        *a_Q12,            /* O    monic whitening filter coefficients in Q12,  [ d ]  */
-    const opus_int16  *NLSF,             /* I    normalized line spectral frequencies in Q15, [ d ]  */
-    const opus_int    d                  /* I    filter order (should be even)                       */
+    opus_int16                  *a_Q12,             /* O    monic whitening filter coefficients in Q12,  [ d ]          */
+    const opus_int16            *NLSF,              /* I    normalized line spectral frequencies in Q15, [ d ]          */
+    const opus_int              d                   /* I    filter order (should be even)                               */
 );
 
 void silk_insertion_sort_increasing(
-    opus_int32            *a,            /* I/O   Unsorted / Sorted vector                */
-    opus_int              *idx,          /* O:    Index vector for the sorted elements    */
-    const opus_int        L,             /* I:    Vector length                           */
-    const opus_int        K              /* I:    Number of correctly sorted positions    */
+    opus_int32                  *a,                 /* I/O   Unsorted / Sorted vector                                   */
+    opus_int                    *idx,               /* O     Index vector for the sorted elements                       */
+    const opus_int              L,                  /* I     Vector length                                              */
+    const opus_int              K                   /* I     Number of correctly sorted positions                       */
 );
 
 void silk_insertion_sort_decreasing_int16(
-    opus_int16            *a,            /* I/O:  Unsorted / Sorted vector                */
-    opus_int              *idx,          /* O:    Index vector for the sorted elements    */
-    const opus_int        L,             /* I:    Vector length                           */
-    const opus_int        K              /* I:    Number of correctly sorted positions    */
+    opus_int16                  *a,                 /* I/O   Unsorted / Sorted vector                                   */
+    opus_int                    *idx,               /* O     Index vector for the sorted elements                       */
+    const opus_int              L,                  /* I     Vector length                                              */
+    const opus_int              K                   /* I     Number of correctly sorted positions                       */
 );
 
 void silk_insertion_sort_increasing_all_values_int16(
-     opus_int16           *a,            /* I/O:  Unsorted / Sorted vector                */
-     const opus_int       L              /* I:    Vector length                           */
+     opus_int16                 *a,                 /* I/O   Unsorted / Sorted vector                                   */
+     const opus_int             L                   /* I     Vector length                                              */
 );
 
 /* NLSF stabilizer, for a single input data vector */
 void silk_NLSF_stabilize(
-          opus_int16      *NLSF_Q15,      /* I/O:  Unstable/stabilized normalized LSF vector in Q15 [L]                    */
-    const opus_int16      *NDeltaMin_Q15, /* I:    Normalized delta min vector in Q15, NDeltaMin_Q15[L] must be >= 1 [L+1] */
-    const opus_int        L               /* I:    Number of NLSF parameters in the input vector                           */
+          opus_int16            *NLSF_Q15,          /* I/O   Unstable/stabilized normalized LSF vector in Q15 [L]       */
+    const opus_int16            *NDeltaMin_Q15,     /* I     Min distance vector, NDeltaMin_Q15[L] must be >= 1 [L+1]   */
+    const opus_int              L                   /* I     Number of NLSF parameters in the input vector              */
 );
 
 /* Laroia low complexity NLSF weights */
 void silk_NLSF_VQ_weights_laroia(
-    opus_int16            *pNLSFW_Q_OUT,  /* O:    Pointer to input vector weights            [D x 1]       */
-    const opus_int16      *pNLSF_Q15,     /* I:    Pointer to input vector                    [D x 1]       */
-    const opus_int        D               /* I:    Input vector dimension (even)                            */
+    opus_int16                  *pNLSFW_Q_OUT,      /* O     Pointer to input vector weights [D]                        */
+    const opus_int16            *pNLSF_Q15,         /* I     Pointer to input vector         [D]                        */
+    const opus_int              D                   /* I     Input vector dimension (even)                              */
 );
 
 /* Compute reflection coefficients from input signal */
 void silk_burg_modified(
-    opus_int32            *res_nrg,           /* O   residual energy                                                 */
-    opus_int              *res_nrgQ,          /* O   residual energy Q value                                         */
-    opus_int32            A_Q16[],            /* O   prediction coefficients (length order)                          */
-    const opus_int16      x[],                /* I   input signal, length: nb_subfr * ( D + subfr_length )           */
-    const opus_int        subfr_length,       /* I   input signal subframe length (including D preceeding samples)   */
-    const opus_int        nb_subfr,           /* I   number of subframes stacked in x                                */
-    const opus_int32      WhiteNoiseFrac_Q32, /* I   fraction added to zero-lag autocorrelation                      */
-    const opus_int        D                   /* I   order                                                           */
+    opus_int32                  *res_nrg,           /* O    Residual energy                                             */
+    opus_int                    *res_nrg_Q,         /* O    Residual energy Q value                                     */
+    opus_int32                  A_Q16[],            /* O    Prediction coefficients (length order)                      */
+    const opus_int16            x[],                /* I    Input signal, length: nb_subfr * ( D + subfr_length )       */
+    const opus_int              subfr_length,       /* I    Input signal subframe length (incl. D preceeding samples)   */
+    const opus_int              nb_subfr,           /* I    Number of subframes stacked in x                            */
+    const opus_int32            WhiteNoiseFrac_Q32, /* I    Fraction added to zero-lag autocorrelation                  */
+    const opus_int              D                   /* I    Order                                                       */
 );
 
 /* Copy and multiply a vector by a constant */
 void silk_scale_copy_vector16(
-    opus_int16            *data_out,
-    const opus_int16      *data_in,
-    opus_int32            gain_Q16,           /* I:   gain in Q16   */
-    const opus_int        dataSize            /* I:   length        */
+    opus_int16                  *data_out,
+    const opus_int16            *data_in,
+    opus_int32                  gain_Q16,           /* I    Gain in Q16                                                 */
+    const opus_int              dataSize            /* I    Length                                                      */
 );
 
 /* Some for the LTP related function requires Q26 to work.*/
 void silk_scale_vector32_Q26_lshift_18(
-    opus_int32            *data1,             /* I/O: Q0/Q18        */
-    opus_int32            gain_Q26,           /* I:   Q26           */
-    opus_int              dataSize            /* I:   length        */
+    opus_int32                  *data1,             /* I/O  Q0/Q18                                                      */
+    opus_int32                  gain_Q26,           /* I    Q26                                                         */
+    opus_int                    dataSize            /* I    length                                                      */
 );
 
 /********************************************************************/
-/*                        INLINE ARM MATH                             */
+/*                        INLINE ARM MATH                           */
 /********************************************************************/
 
-/*    return sum(inVec1[i]*inVec2[i])    */
+/*    return sum( inVec1[i] * inVec2[i] ) */
 opus_int32 silk_inner_prod_aligned(
-    const opus_int16 *const  inVec1,     /*    I input vector 1    */
-    const opus_int16 *const  inVec2,     /*    I input vector 2    */
-    const opus_int           len         /*    I vector lengths    */
+    const opus_int16 *const     inVec1,             /*    I input vector 1                                              */
+    const opus_int16 *const     inVec2,             /*    I input vector 2                                              */
+    const opus_int              len                 /*    I vector lengths                                              */
 );
 
 opus_int32 silk_inner_prod_aligned_scale(
-    const opus_int16 *const  inVec1,     /*    I input vector 1          */
-    const opus_int16 *const  inVec2,     /*    I input vector 2          */
-    const opus_int           scale,      /*    I number of bits to shift */
-    const opus_int           len         /*    I vector lengths          */
+    const opus_int16 *const     inVec1,             /*    I input vector 1                                              */
+    const opus_int16 *const     inVec2,             /*    I input vector 2                                              */
+    const opus_int              scale,              /*    I number of bits to shift                                     */
+    const opus_int              len                 /*    I vector lengths                                              */
 );
 
 opus_int64 silk_inner_prod16_aligned_64(
-    const opus_int16         *inVec1,    /*    I input vector 1    */
-    const opus_int16         *inVec2,    /*    I input vector 2    */
-    const opus_int           len         /*    I vector lengths    */
+    const opus_int16            *inVec1,            /*    I input vector 1                                              */
+    const opus_int16            *inVec2,            /*    I input vector 2                                              */
+    const opus_int              len                 /*    I vector lengths                                              */
 );
 
 /********************************************************************/
@@ -370,12 +371,13 @@ static inline opus_int32 silk_ROR32( opus_int32 a32, opus_int rot )
     opus_uint32 x = (opus_uint32) a32;
     opus_uint32 r = (opus_uint32) rot;
     opus_uint32 m = (opus_uint32) -rot;
-    if (rot==0)
-       return a32;
-    else if(rot < 0)
+    if( rot == 0 ) {
+        return a32;
+    } else if( rot < 0 ) {
         return (opus_int32) ((x << m) | (x >> (32 - m)));
-    else
+    } else {
         return (opus_int32) ((x << (32 - r)) | (x >> r));
+    }
 }
 
 /* Allocate opus_int16 alligned to 4-byte memory address */
@@ -386,10 +388,11 @@ static inline opus_int32 silk_ROR32( opus_int32 a32, opus_int rot )
 #endif
 
 /* Useful Macros that can be adjusted to other platforms */
-#define silk_memcpy(a, b, c)                memcpy((a), (b), (c))    /* Dest, Src, ByteCount */
-#define silk_memset(a, b, c)                memset((a), (b), (c))    /* Dest, value, ByteCount */
-#define silk_memmove(a, b, c)               memmove((a), (b), (c))   /* Dest, Src, ByteCount */
-/* fixed point macros */
+#define silk_memcpy(a, b, c)                memcpy((a), (b), (c))    /* Dest, Src, ByteCount    */
+#define silk_memset(a, b, c)                memset((a), (b), (c))    /* Dest, value, ByteCount  */
+#define silk_memmove(a, b, c)               memmove((a), (b), (c))   /* Dest, Src, ByteCount    */
+
+/* Fixed point macros */
 
 /* (a32 * b32) output have to be 32bit int */
 #define silk_MUL(a32, b32)                  ((a32) * (b32))
@@ -421,14 +424,9 @@ static inline opus_int32 silk_ROR32( opus_int32 a32, opus_int rot )
    (just standard two's complement implementation-specific behaviour) */
 #define silk_SUB32_ovflw(a, b)              ((opus_int32)((opus_uint32)(a) - (opus_uint32)(b)))
 
-/* a32 + (opus_int32)((opus_int16)(b32)) * (opus_int32)((opus_int16)(c32)) output have to be 32bit int */
-#define silk_SMLABB_ovflw(a32, b32, c32)       (silk_ADD32_ovflw((a32) , ((opus_int32)((opus_int16)(b32))) * (opus_int32)((opus_int16)(c32))))
-
-/* Multiply-accumulate macros that allow overflow in the addition (ie, no asserts in debug mode)*/
+/* Multiply-accumulate macros that allow overflow in the addition (ie, no asserts in debug mode) */
 #define silk_MLA_ovflw(a32, b32, c32)       silk_ADD32_ovflw((a32), (opus_uint32)(b32) * (opus_uint32)(c32))
-#ifndef silk_SMLABB_ovflw
-#    define silk_SMLABB_ovflw(a32, b32, c32)    silk_ADD32_ovflw((a32), (opus_int32)((opus_int16)(b32)) * (opus_int32)((opus_int16)(c32)))
-#endif
+#define silk_SMLABB_ovflw(a32, b32, c32)    (silk_ADD32_ovflw((a32) , ((opus_int32)((opus_int16)(b32))) * (opus_int32)((opus_int16)(c32))))
 
 #define silk_DIV32_16(a32, b16)             ((opus_int32)((a32) / (b16)))
 #define silk_DIV32(a32, b32)                ((opus_int32)((a32) / (b32)))
@@ -442,12 +440,12 @@ static inline opus_int32 silk_ROR32( opus_int32 a32, opus_int rot )
 #define silk_SUB32(a, b)                    ((a) - (b))
 #define silk_SUB64(a, b)                    ((a) - (b))
 
-#define silk_SAT8(a)                        ((a) > silk_int8_MAX ? silk_int8_MAX  : \
-                                           ((a) < silk_int8_MIN ? silk_int8_MIN  : (a)))
-#define silk_SAT16(a)                       ((a) > silk_int16_MAX ? silk_int16_MAX : \
-                                           ((a) < silk_int16_MIN ? silk_int16_MIN : (a)))
-#define silk_SAT32(a)                       ((a) > silk_int32_MAX ? silk_int32_MAX : \
-                                           ((a) < silk_int32_MIN ? silk_int32_MIN : (a)))
+#define silk_SAT8(a)                        ((a) > silk_int8_MAX ? silk_int8_MAX  :       \
+                                            ((a) < silk_int8_MIN ? silk_int8_MIN  : (a)))
+#define silk_SAT16(a)                       ((a) > silk_int16_MAX ? silk_int16_MAX :      \
+                                            ((a) < silk_int16_MIN ? silk_int16_MIN : (a)))
+#define silk_SAT32(a)                       ((a) > silk_int32_MAX ? silk_int32_MAX :      \
+                                            ((a) < silk_int32_MIN ? silk_int32_MIN : (a)))
 
 #define silk_CHECK_FIT8(a)                  (a)
 #define silk_CHECK_FIT16(a)                 (a)
@@ -455,13 +453,13 @@ static inline opus_int32 silk_ROR32( opus_int32 a32, opus_int rot )
 
 #define silk_ADD_SAT16(a, b)                (opus_int16)silk_SAT16( silk_ADD32( (opus_int32)(a), (b) ) )
 #define silk_ADD_SAT64(a, b)                ((((a) + (b)) & 0x8000000000000000LL) == 0 ?                            \
-                                           ((((a) & (b)) & 0x8000000000000000LL) != 0 ? silk_int64_MIN : (a)+(b)) :    \
-                                           ((((a) | (b)) & 0x8000000000000000LL) == 0 ? silk_int64_MAX : (a)+(b)) )
+                                            ((((a) & (b)) & 0x8000000000000000LL) != 0 ? silk_int64_MIN : (a)+(b)) : \
+                                            ((((a) | (b)) & 0x8000000000000000LL) == 0 ? silk_int64_MAX : (a)+(b)) )
 
 #define silk_SUB_SAT16(a, b)                (opus_int16)silk_SAT16( silk_SUB32( (opus_int32)(a), (b) ) )
-#define silk_SUB_SAT64(a, b)                ((((a)-(b)) & 0x8000000000000000LL) == 0 ?                                                    \
-                                           (( (a) & ((b)^0x8000000000000000LL) & 0x8000000000000000LL) ? silk_int64_MIN : (a)-(b)) :    \
-                                           ((((a)^0x8000000000000000LL) & (b)  & 0x8000000000000000LL) ? silk_int64_MAX : (a)-(b)) )
+#define silk_SUB_SAT64(a, b)                ((((a)-(b)) & 0x8000000000000000LL) == 0 ?                                               \
+                                            (( (a) & ((b)^0x8000000000000000LL) & 0x8000000000000000LL) ? silk_int64_MIN : (a)-(b)) : \
+                                            ((((a)^0x8000000000000000LL) & (b)  & 0x8000000000000000LL) ? silk_int64_MAX : (a)-(b)) )
 
 /* Saturation for positive input values */
 #define silk_POS_SAT32(a)                   ((a) > silk_int32_MAX ? silk_int32_MAX : (a))
@@ -472,51 +470,51 @@ static inline opus_int32 silk_ROR32( opus_int32 a32, opus_int rot )
 #define silk_ADD_POS_SAT32(a, b)            ((((a)+(b)) & 0x80000000)           ? silk_int32_MAX : ((a)+(b)))
 #define silk_ADD_POS_SAT64(a, b)            ((((a)+(b)) & 0x8000000000000000LL) ? silk_int64_MAX : ((a)+(b)))
 
-#define silk_LSHIFT8(a, shift)              ((opus_int8)((opus_uint8)(a)<<(shift)))                /* shift >= 0, shift < 8  */
-#define silk_LSHIFT16(a, shift)             ((opus_int16)((opus_uint16)(a)<<(shift)))                /* shift >= 0, shift < 16 */
-#define silk_LSHIFT32(a, shift)             ((opus_int32)((opus_uint32)(a)<<(shift)))                /* shift >= 0, shift < 32 */
-#define silk_LSHIFT64(a, shift)             ((opus_int64)((opus_uint64)(a)<<(shift)))                /* shift >= 0, shift < 64 */
-#define silk_LSHIFT(a, shift)               silk_LSHIFT32(a, shift)        /* shift >= 0, shift < 32 */
+#define silk_LSHIFT8(a, shift)              ((opus_int8)((opus_uint8)(a)<<(shift)))         /* shift >= 0, shift < 8  */
+#define silk_LSHIFT16(a, shift)             ((opus_int16)((opus_uint16)(a)<<(shift)))       /* shift >= 0, shift < 16 */
+#define silk_LSHIFT32(a, shift)             ((opus_int32)((opus_uint32)(a)<<(shift)))       /* shift >= 0, shift < 32 */
+#define silk_LSHIFT64(a, shift)             ((opus_int64)((opus_uint64)(a)<<(shift)))       /* shift >= 0, shift < 64 */
+#define silk_LSHIFT(a, shift)               silk_LSHIFT32(a, shift)                         /* shift >= 0, shift < 32 */
 
-#define silk_RSHIFT8(a, shift)              ((a)>>(shift))                /* shift >= 0, shift < 8  */
-#define silk_RSHIFT16(a, shift)             ((a)>>(shift))                /* shift >= 0, shift < 16 */
-#define silk_RSHIFT32(a, shift)             ((a)>>(shift))                /* shift >= 0, shift < 32 */
-#define silk_RSHIFT64(a, shift)             ((a)>>(shift))                /* shift >= 0, shift < 64 */
-#define silk_RSHIFT(a, shift)               silk_RSHIFT32(a, shift)        /* shift >= 0, shift < 32 */
+#define silk_RSHIFT8(a, shift)              ((a)>>(shift))                                  /* shift >= 0, shift < 8  */
+#define silk_RSHIFT16(a, shift)             ((a)>>(shift))                                  /* shift >= 0, shift < 16 */
+#define silk_RSHIFT32(a, shift)             ((a)>>(shift))                                  /* shift >= 0, shift < 32 */
+#define silk_RSHIFT64(a, shift)             ((a)>>(shift))                                  /* shift >= 0, shift < 64 */
+#define silk_RSHIFT(a, shift)               silk_RSHIFT32(a, shift)                         /* shift >= 0, shift < 32 */
 
 /* saturates before shifting */
-#define silk_LSHIFT_SAT16(a, shift)         (silk_LSHIFT16( silk_LIMIT( (a), silk_RSHIFT16( silk_int16_MIN, (shift) ),    \
-                                                                          silk_RSHIFT16( silk_int16_MAX, (shift) ) ), (shift) ))
-#define silk_LSHIFT_SAT32(a, shift)         (silk_LSHIFT32( silk_LIMIT( (a), silk_RSHIFT32( silk_int32_MIN, (shift) ),    \
-                                                                          silk_RSHIFT32( silk_int32_MAX, (shift) ) ), (shift) ))
-
-#define silk_LSHIFT_ovflw(a, shift)        ((opus_int32)((opus_uint32)(a)<<(shift)))        /* shift >= 0, allowed to overflow */
-#define silk_LSHIFT_uint(a, shift)         ((a)<<(shift))        /* shift >= 0 */
-#define silk_RSHIFT_uint(a, shift)         ((a)>>(shift))        /* shift >= 0 */
-
-#define silk_ADD_LSHIFT(a, b, shift)       ((a) + silk_LSHIFT((b), (shift)))             /* shift >= 0 */
-#define silk_ADD_LSHIFT32(a, b, shift)     silk_ADD32((a), silk_LSHIFT32((b), (shift)))   /* shift >= 0 */
-#define silk_ADD_LSHIFT_uint(a, b, shift)  ((a) + silk_LSHIFT_uint((b), (shift)))        /* shift >= 0 */
-#define silk_ADD_RSHIFT(a, b, shift)       ((a) + silk_RSHIFT((b), (shift)))             /* shift >= 0 */
-#define silk_ADD_RSHIFT32(a, b, shift)     silk_ADD32((a), silk_RSHIFT32((b), (shift)))   /* shift >= 0 */
-#define silk_ADD_RSHIFT_uint(a, b, shift)  ((a) + silk_RSHIFT_uint((b), (shift)))        /* shift >= 0 */
-#define silk_SUB_LSHIFT32(a, b, shift)     silk_SUB32((a), silk_LSHIFT32((b), (shift)))   /* shift >= 0 */
-#define silk_SUB_RSHIFT32(a, b, shift)     silk_SUB32((a), silk_RSHIFT32((b), (shift)))   /* shift >= 0 */
+#define silk_LSHIFT_SAT16(a, shift)         (silk_LSHIFT16( silk_LIMIT( (a), silk_RSHIFT16( silk_int16_MIN, (shift) ), \
+                                                    silk_RSHIFT16( silk_int16_MAX, (shift) ) ), (shift) ))
+#define silk_LSHIFT_SAT32(a, shift)         (silk_LSHIFT32( silk_LIMIT( (a), silk_RSHIFT32( silk_int32_MIN, (shift) ), \
+                                                    silk_RSHIFT32( silk_int32_MAX, (shift) ) ), (shift) ))
+
+#define silk_LSHIFT_ovflw(a, shift)         ((opus_int32)((opus_uint32)(a) << (shift)))     /* shift >= 0, allowed to overflow */
+#define silk_LSHIFT_uint(a, shift)          ((a) << (shift))                                /* shift >= 0 */
+#define silk_RSHIFT_uint(a, shift)          ((a) >> (shift))                                /* shift >= 0 */
+
+#define silk_ADD_LSHIFT(a, b, shift)        ((a) + silk_LSHIFT((b), (shift)))               /* shift >= 0 */
+#define silk_ADD_LSHIFT32(a, b, shift)      silk_ADD32((a), silk_LSHIFT32((b), (shift)))    /* shift >= 0 */
+#define silk_ADD_LSHIFT_uint(a, b, shift)   ((a) + silk_LSHIFT_uint((b), (shift)))          /* shift >= 0 */
+#define silk_ADD_RSHIFT(a, b, shift)        ((a) + silk_RSHIFT((b), (shift)))               /* shift >= 0 */
+#define silk_ADD_RSHIFT32(a, b, shift)      silk_ADD32((a), silk_RSHIFT32((b), (shift)))    /* shift >= 0 */
+#define silk_ADD_RSHIFT_uint(a, b, shift)   ((a) + silk_RSHIFT_uint((b), (shift)))          /* shift >= 0 */
+#define silk_SUB_LSHIFT32(a, b, shift)      silk_SUB32((a), silk_LSHIFT32((b), (shift)))    /* shift >= 0 */
+#define silk_SUB_RSHIFT32(a, b, shift)      silk_SUB32((a), silk_RSHIFT32((b), (shift)))    /* shift >= 0 */
 
 /* Requires that shift > 0 */
-#define silk_RSHIFT_ROUND(a, shift)        ((shift) == 1 ? ((a) >> 1) + ((a) & 1) : (((a) >> ((shift) - 1)) + 1) >> 1)
-#define silk_RSHIFT_ROUND64(a, shift)      ((shift) == 1 ? ((a) >> 1) + ((a) & 1) : (((a) >> ((shift) - 1)) + 1) >> 1)
+#define silk_RSHIFT_ROUND(a, shift)         ((shift) == 1 ? ((a) >> 1) + ((a) & 1) : (((a) >> ((shift) - 1)) + 1) >> 1)
+#define silk_RSHIFT_ROUND64(a, shift)       ((shift) == 1 ? ((a) >> 1) + ((a) & 1) : (((a) >> ((shift) - 1)) + 1) >> 1)
 
 /* Number of rightshift required to fit the multiplication */
-#define silk_NSHIFT_MUL_32_32(a, b)        ( -(31- (32-silk_CLZ32(silk_abs(a)) + (32-silk_CLZ32(silk_abs(b))))) )
-#define silk_NSHIFT_MUL_16_16(a, b)        ( -(15- (16-silk_CLZ16(silk_abs(a)) + (16-silk_CLZ16(silk_abs(b))))) )
+#define silk_NSHIFT_MUL_32_32(a, b)         ( -(31- (32-silk_CLZ32(silk_abs(a)) + (32-silk_CLZ32(silk_abs(b))))) )
+#define silk_NSHIFT_MUL_16_16(a, b)         ( -(15- (16-silk_CLZ16(silk_abs(a)) + (16-silk_CLZ16(silk_abs(b))))) )
 
 
-#define silk_min(a, b)                     (((a) < (b)) ? (a) : (b))
-#define silk_max(a, b)                     (((a) > (b)) ? (a) : (b))
+#define silk_min(a, b)                      (((a) < (b)) ? (a) : (b))
+#define silk_max(a, b)                      (((a) > (b)) ? (a) : (b))
 
 /* Macro to convert floating-point constants to fixed-point */
-#define SILK_FIX_CONST( C, Q )           ((opus_int32)((C) * ((opus_int64)1 << (Q)) + 0.5))
+#define SILK_FIX_CONST( C, Q )              ((opus_int32)((C) * ((opus_int64)1 << (Q)) + 0.5))
 
 /* silk_min() versions with typecast in the function call */
 static inline opus_int silk_min_int(opus_int a, opus_int b)
@@ -554,38 +552,36 @@ static inline opus_int64 silk_max_64(opus_int64 a, opus_int64 b)
     return (((a) > (b)) ? (a) : (b));
 }
 
-#define silk_LIMIT( a, limit1, limit2)    ((limit1) > (limit2) ? ((a) > (limit1) ? (limit1) : ((a) < (limit2) ? (limit2) : (a))) \
-                                                             : ((a) > (limit2) ? (limit2) : ((a) < (limit1) ? (limit1) : (a))))
-
-#define silk_LIMIT_int silk_LIMIT
-#define silk_LIMIT_16 silk_LIMIT
-#define silk_LIMIT_32 silk_LIMIT
+#define silk_LIMIT( a, limit1, limit2)      ((limit1) > (limit2) ? ((a) > (limit1) ? (limit1) : ((a) < (limit2) ? (limit2) : (a))) \
+                                                                 : ((a) > (limit2) ? (limit2) : ((a) < (limit1) ? (limit1) : (a))))
 
-/*#define silk_non_neg(a)                 ((a) & ((-(a)) >> (8 * sizeof(a) - 1)))*/   /* doesn't seem faster than silk_max(0, a);*/
+#define silk_LIMIT_int                      silk_LIMIT
+#define silk_LIMIT_16                       silk_LIMIT
+#define silk_LIMIT_32                       silk_LIMIT
 
-#define silk_abs(a)                       (((a) >  0)  ? (a) : -(a))            /* Be careful, silk_abs returns wrong when input equals to silk_intXX_MIN */
-#define silk_abs_int(a)                   (((a) ^ ((a) >> (8 * sizeof(a) - 1))) - ((a) >> (8 * sizeof(a) - 1)))
-#define silk_abs_int32(a)                 (((a) ^ ((a) >> 31)) - ((a) >> 31))
-#define silk_abs_int64(a)                 (((a) >  0)  ? (a) : -(a))
+#define silk_abs(a)                         (((a) >  0)  ? (a) : -(a))            /* Be careful, silk_abs returns wrong when input equals to silk_intXX_MIN */
+#define silk_abs_int(a)                     (((a) ^ ((a) >> (8 * sizeof(a) - 1))) - ((a) >> (8 * sizeof(a) - 1)))
+#define silk_abs_int32(a)                   (((a) ^ ((a) >> 31)) - ((a) >> 31))
+#define silk_abs_int64(a)                   (((a) >  0)  ? (a) : -(a))
 
-#define silk_sign(a)                      ((a) > 0 ? 1 : ( (a) < 0 ? -1 : 0 ))
+#define silk_sign(a)                        ((a) > 0 ? 1 : ( (a) < 0 ? -1 : 0 ))
 
-#define silk_sqrt(a)                      (sqrt(a))
+#define silk_sqrt(a)                        (sqrt(a))
 
 /* PSEUDO-RANDOM GENERATOR                                                          */
 /* Make sure to store the result as the seed for the next call (also in between     */
 /* frames), otherwise result won't be random at all. When only using some of the    */
 /* bits, take the most significant bits by right-shifting.                          */
-#define silk_RAND(seed)                   (silk_MLA_ovflw(907633515, (seed), 196314165))
+#define silk_RAND(seed)                     (silk_MLA_ovflw(907633515, (seed), 196314165))
 
 /*  Add some multiplication functions that can be easily mapped to ARM. */
 
 /*    silk_SMMUL: Signed top word multiply.
           ARMv6        2 instruction cycles.
-          ARMv3M+        3 instruction cycles. use SMULL and ignore LSB registers.(except xM)*/
-/*#define silk_SMMUL(a32, b32)            (opus_int32)silk_RSHIFT(silk_SMLAL(silk_SMULWB((a32), (b32)), (a32), silk_RSHIFT_ROUND((b32), 16)), 16)*/
+          ARMv3M+      3 instruction cycles. use SMULL and ignore LSB registers.(except xM)*/
+/*#define silk_SMMUL(a32, b32)                (opus_int32)silk_RSHIFT(silk_SMLAL(silk_SMULWB((a32), (b32)), (a32), silk_RSHIFT_ROUND((b32), 16)), 16)*/
 /* the following seems faster on x86 */
-#define silk_SMMUL(a32, b32)              (opus_int32)silk_RSHIFT64(silk_SMULL((a32), (b32)), 32)
+#define silk_SMMUL(a32, b32)                (opus_int32)silk_RSHIFT64(silk_SMULL((a32), (b32)), 32)
 
 #include "Inlines.h"
 #include "MacroCount.h"
index 5b13b90..1f7e564 100644 (file)
@@ -41,8 +41,8 @@ static inline void silk_VAD_GetNoiseLevels(
 /**********************************/
 /* Initialization of the Silk VAD */
 /**********************************/
-opus_int silk_VAD_Init(                              /* O    Return value, 0 if success                  */
-    silk_VAD_state              *psSilk_VAD         /* I/O  Pointer to Silk VAD state                   */
+opus_int silk_VAD_Init(                                         /* O    Return value, 0 if success                  */
+    silk_VAD_state              *psSilk_VAD                     /* I/O  Pointer to Silk VAD state                   */
 )
 {
     opus_int b, ret = 0;
@@ -77,9 +77,9 @@ static const opus_int32 tiltWeights[ VAD_N_BANDS ] = { 30000, 6000, -12000, -120
 /***************************************/
 /* Get the speech activity level in Q8 */
 /***************************************/
-opus_int silk_VAD_GetSA_Q8(                          /* O    Return value, 0 if success                  */
-    silk_encoder_state          *psEncC,            /* I/O  Encoder state                               */
-    const opus_int16             pIn[]               /* I    PCM input                                   */
+opus_int silk_VAD_GetSA_Q8(                                     /* O    Return value, 0 if success                  */
+    silk_encoder_state          *psEncC,                        /* I/O  Encoder state                               */
+    const opus_int16            pIn[]                           /* I    PCM input                                   */
 )
 {
     opus_int   SA_Q15, pSNR_dB_Q7, input_tilt;
@@ -271,7 +271,7 @@ opus_int silk_VAD_GetSA_Q8(                          /* O    Return value, 0 if
 /* Noise level estimation */
 /**************************/
 static inline void silk_VAD_GetNoiseLevels(
-    const opus_int32                 pX[ VAD_N_BANDS ],  /* I    subband energies                            */
+    const opus_int32            pX[ VAD_N_BANDS ],  /* I    subband energies                            */
     silk_VAD_state              *psSilk_VAD         /* I/O  Pointer to Silk VAD state                   */
 )
 {
index 5397d86..4505a86 100644 (file)
@@ -33,14 +33,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /* Entropy constrained matrix-weighted VQ, hard-coded to 5-element vectors, for a single input data vector */
 void silk_VQ_WMat_EC(
-    opus_int8                        *ind,               /* O    index of best codebook vector               */
-    opus_int32                       *rate_dist_Q14,     /* O    best weighted quantization error + mu * rate*/
-    const opus_int16                 *in_Q14,            /* I    input vector to be quantized                */
-    const opus_int32                 *W_Q18,             /* I    weighting matrix                            */
-    const opus_int8                  *cb_Q7,             /* I    codebook                                    */
-    const opus_uint8                 *cl_Q5,             /* I    code length for each codebook vector        */
-    const opus_int                   mu_Q9,              /* I    tradeoff between weighted error and rate    */
-    opus_int                         L                   /* I    number of vectors in codebook               */
+    opus_int8                   *ind,                           /* O    index of best codebook vector               */
+    opus_int32                  *rate_dist_Q14,                 /* O    best weighted quant error + mu * rate       */
+    const opus_int16            *in_Q14,                        /* I    input vector to be quantized                */
+    const opus_int32            *W_Q18,                         /* I    weighting matrix                            */
+    const opus_int8             *cb_Q7,                         /* I    codebook                                    */
+    const opus_uint8            *cl_Q5,                         /* I    code length for each codebook vector        */
+    const opus_int              mu_Q9,                          /* I    tradeoff betw. weighted error and rate      */
+    opus_int                    L                               /* I    number of vectors in codebook               */
 )
 {
     opus_int   k;
index a3f93fb..bad630e 100644 (file)
@@ -37,11 +37,11 @@ static opus_int16 A_fb1_21 = -24290; /* (opus_int16)(20623 << 1) */
 
 /* Split signal into two decimated bands using first-order allpass filters */
 void silk_ana_filt_bank_1(
-    const opus_int16      *in,        /* I:   Input signal [N]        */
-    opus_int32            *S,         /* I/O: State vector [2]        */
-    opus_int16            *outL,      /* O:   Low band [N/2]          */
-    opus_int16            *outH,      /* O:   High band [N/2]         */
-    const opus_int32      N           /* I:   Number of input samples */
+    const opus_int16            *in,                /* I    Input signal [N]                                            */ 
+    opus_int32                  *S,                 /* I/O  State vector [2]                                            */
+    opus_int16                  *outL,              /* O    Low band [N/2]                                              */
+    opus_int16                  *outH,              /* O    High band [N/2]                                             */
+    const opus_int32            N                   /* I    Number of input samples                                     */
 )
 {
     opus_int      k, N2 = silk_RSHIFT( N, 1 );
index 74a66a5..91a75b6 100644 (file)
@@ -38,16 +38,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include "SigProc_FIX.h"
 
-
 /* Second order ARMA filter, alternative implementation */
 void silk_biquad_alt(
-    const opus_int16      *in,            /* I:    Input signal                   */
-    const opus_int32      *B_Q28,         /* I:    MA coefficients [3]            */
-    const opus_int32      *A_Q28,         /* I:    AR coefficients [2]            */
-    opus_int32            *S,             /* I/O:  State vector [2]               */
-    opus_int16            *out,           /* O:    Output signal                  */
-    const opus_int32      len,            /* I:    Signal length (must be even)   */
-    opus_int              stride          /* I:    Operate on interleaved signal if > 1 */
+    const opus_int16            *in,                /* I     input signal                                               */
+    const opus_int32            *B_Q28,             /* I     MA coefficients [3]                                        */
+    const opus_int32            *A_Q28,             /* I     AR coefficients [2]                                        */
+    opus_int32                  *S,                 /* I/O   State vector [2]                                           */
+    opus_int16                  *out,               /* O     output signal                                              */
+    const opus_int32            len,                /* I     signal length (must be even)                               */
+    opus_int                    stride              /* I     Operate on interleaved signal if > 1                       */
 )
 {
     /* DIRECT FORM II TRANSPOSED (uses 2 element state vector) */
@@ -56,9 +55,9 @@ void silk_biquad_alt(
 
     /* Negate A_Q28 values and split in two parts */
     A0_L_Q28 = ( -A_Q28[ 0 ] ) & 0x00003FFF;        /* lower part */
-    A0_U_Q28 = silk_RSHIFT( -A_Q28[ 0 ], 14 );       /* upper part */
+    A0_U_Q28 = silk_RSHIFT( -A_Q28[ 0 ], 14 );      /* upper part */
     A1_L_Q28 = ( -A_Q28[ 1 ] ) & 0x00003FFF;        /* lower part */
-    A1_U_Q28 = silk_RSHIFT( -A_Q28[ 1 ], 14 );       /* upper part */
+    A1_U_Q28 = silk_RSHIFT( -A_Q28[ 1 ], 14 );      /* upper part */
 
     for( k = 0; k < len; k++ ) {
         /* S[ 0 ], S[ 1 ]: Q12 */
index ab74272..279a985 100644 (file)
@@ -33,9 +33,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /* Chirp (bandwidth expand) LP AR filter */
 void silk_bwexpander(
-    opus_int16            *ar,        /* I/O  AR filter to be expanded (without leading 1)    */
-    const opus_int        d,          /* I    Length of ar                                    */
-    opus_int32            chirp_Q16   /* I    Chirp factor (typically in the range 0 to 1)    */
+    opus_int16                  *ar,                /* I/O  AR filter to be expanded (without leading 1)                */
+    const opus_int              d,                  /* I    Length of ar                                                */
+    opus_int32                  chirp_Q16           /* I    Chirp factor (typically in the range 0 to 1)                */
 )
 {
     opus_int   i;
index 4bac1c6..2496362 100644 (file)
@@ -33,9 +33,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /* Chirp (bandwidth expand) LP AR filter */
 void silk_bwexpander_32(
-    opus_int32        *ar,       /* I/O  AR filter to be expanded (without leading 1)    */
-    const opus_int    d,         /* I    Length of ar                                    */
-    opus_int32        chirp_Q16  /* I    Chirp factor in Q16                             */
+    opus_int32                  *ar,                /* I/O  AR filter to be expanded (without leading 1)                */
+    const opus_int              d,                  /* I    Length of ar                                                */
+    opus_int32                  chirp_Q16           /* I    Chirp factor in Q16                                         */
 )
 {
     opus_int   i;
index 0a8d726..35888c9 100644 (file)
@@ -35,7 +35,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /* Check encoder control struct */
 opus_int check_control_input(
-    silk_EncControlStruct        *encControl     /* I:   Control structure                               */
+    silk_EncControlStruct        *encControl                    /* I    Control structure                           */
 )
 {
     silk_assert( encControl != NULL );
index 02a3aeb..c0b940a 100644 (file)
@@ -40,11 +40,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /* Encodes signs of excitation */
 void silk_encode_signs(
     ec_enc                      *psRangeEnc,                        /* I/O  Compressor data structure                   */
-    const opus_int8              pulses[],                           /* I    pulse signal                                */
-    opus_int                     length,                             /* I    length of input                             */
-    const opus_int               signalType,                         /* I    Signal type                                 */
-    const opus_int               quantOffsetType,                    /* I    Quantization offset type                    */
-    const opus_int               sum_pulses[ MAX_NB_SHELL_BLOCKS ]   /* I    Sum of absolute pulses per block            */
+    const opus_int8             pulses[],                           /* I    pulse signal                                */
+    opus_int                    length,                             /* I    length of input                             */
+    const opus_int              signalType,                         /* I    Signal type                                 */
+    const opus_int              quantOffsetType,                    /* I    Quantization offset type                    */
+    const opus_int              sum_pulses[ MAX_NB_SHELL_BLOCKS ]   /* I    Sum of absolute pulses per block            */
 )
 {
     opus_int         i, j, p;
@@ -74,11 +74,11 @@ void silk_encode_signs(
 /* Decodes signs of excitation */
 void silk_decode_signs(
     ec_dec                      *psRangeDec,                        /* I/O  Compressor data structure                   */
-    opus_int                     pulses[],                           /* I/O  pulse signal                                */
-    opus_int                     length,                             /* I    length of input                             */
-    const opus_int               signalType,                         /* I    Signal type                                 */
-    const opus_int               quantOffsetType,                    /* I    Quantization offset type                    */
-    const opus_int               sum_pulses[ MAX_NB_SHELL_BLOCKS ]   /* I    Sum of absolute pulses per block            */
+    opus_int                    pulses[],                           /* I/O  pulse signal                                */
+    opus_int                    length,                             /* I    length of input                             */
+    const opus_int              signalType,                         /* I    Signal type                                 */
+    const opus_int              quantOffsetType,                    /* I    Quantization offset type                    */
+    const opus_int              sum_pulses[ MAX_NB_SHELL_BLOCKS ]   /* I    Sum of absolute pulses per block            */
 )
 {
     opus_int         i, j, p;
index 47afecf..a29c9cc 100644 (file)
@@ -83,13 +83,13 @@ typedef struct {
     /* I:   Flag to use constant bitrate                                                    */
     opus_int useCBR;
 
-    /* I:   Maximum number of bits allowed for the frame */
+    /* I:   Maximum number of bits allowed for the frame                                    */
     opus_int maxBits;
 
-    /* I:   Causes a smooth downmix to mono */
+    /* I:   Causes a smooth downmix to mono                                                 */
     opus_int toMono;
 
-    /* I:   Opus encoder is allowing us to switch bandwidth */
+    /* I:   Opus encoder is allowing us to switch bandwidth                                 */
     opus_int opusCanSwitch;
 
     /* O:   Internal sampling rate used, in Hertz; 8000/12000/16000                         */
@@ -104,7 +104,7 @@ typedef struct {
     /* O:   Stereo width */
     opus_int stereoWidth_Q14;
 
-    /* O:   Tells the Opus encoder we're ready to switch */
+    /* O:   Tells the Opus encoder we're ready to switch                                    */
     opus_int switchReady;
 
 } silk_EncControlStruct;
index 3c65fd7..3dbafb0 100644 (file)
@@ -34,8 +34,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /* Control SNR of redidual quantizer */
 opus_int silk_control_SNR(
-    silk_encoder_state          *psEncC,            /* I/O  Pointer to Silk encoder state               */
-    opus_int32                   TargetRate_bps      /* I    Target max bitrate (bps)                    */
+    silk_encoder_state          *psEncC,                        /* I/O  Pointer to Silk encoder state               */
+    opus_int32                  TargetRate_bps                  /* I    Target max bitrate (bps)                    */
 )
 {
     opus_int k, ret = SILK_NO_ERROR;
index e551e9d..a8541f6 100644 (file)
@@ -34,8 +34,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /* Control internal sampling rate */
 opus_int silk_control_audio_bandwidth(
-    silk_encoder_state      *psEncC,            /* I/O  Pointer to Silk encoder state               */
-    silk_EncControlStruct   *encControl         /* I:   Control structure                       */
+    silk_encoder_state          *psEncC,                        /* I/O  Pointer to Silk encoder state               */
+    silk_EncControlStruct       *encControl                     /* I    Control structure                           */
 )
 {
     opus_int   fs_kHz;
@@ -71,7 +71,7 @@ opus_int silk_control_audio_bandwidth(
                     /* Reset transition filter state */
                     silk_memset( psEncC->sLP.In_LP_State, 0, sizeof( psEncC->sLP.In_LP_State ) );
                 }
-                if (encControl->opusCanSwitch) {
+                if( encControl->opusCanSwitch ) {
                     /* Stop transition phase */
                     psEncC->sLP.mode = 0;
 
@@ -91,7 +91,7 @@ opus_int silk_control_audio_bandwidth(
             if( silk_SMULBB( psEncC->fs_kHz, 1000 ) < psEncC->desiredInternal_fs_Hz )
             {
                 /* Switch up */
-                if (encControl->opusCanSwitch) {
+                if( encControl->opusCanSwitch ) {
                     /* Switch to a higher sample frequency */
                     fs_kHz = psEncC->fs_kHz == 8 ? 12 : 16;
 
@@ -115,9 +115,5 @@ opus_int silk_control_audio_bandwidth(
         }
     }
 
-#ifdef FORCE_INTERNAL_FS_KHZ
-    fs_kHz = FORCE_INTERNAL_FS_KHZ;
-#endif
-
     return fs_kHz;
 }
index 418be4d..829b08f 100644 (file)
@@ -36,7 +36,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define silk_encoder_state_Fxx      silk_encoder_state_FLP
 #endif
 #include "tuning_parameters.h"
-
+#include "pitch_est_defines.h"
 
 static const opus_int enc_delay_matrix[3][5] = {
 /*SILK API 8  12  16  24  48 */
@@ -47,34 +47,34 @@ static const opus_int enc_delay_matrix[3][5] = {
 
 opus_int silk_setup_resamplers(
     silk_encoder_state_Fxx          *psEnc,             /* I/O                      */
-    opus_int                         fs_kHz              /* I                        */
+    opus_int                        fs_kHz              /* I                        */
 );
 
 opus_int silk_setup_fs(
     silk_encoder_state_Fxx          *psEnc,             /* I/O                      */
-    opus_int                         fs_kHz,             /* I                        */
-    opus_int                         PacketSize_ms       /* I                        */
+    opus_int                        fs_kHz,             /* I                        */
+    opus_int                        PacketSize_ms       /* I                        */
 );
 
 opus_int silk_setup_complexity(
     silk_encoder_state              *psEncC,            /* I/O                      */
-    opus_int                         Complexity          /* I                        */
+    opus_int                        Complexity          /* I                        */
 );
 
 static inline opus_int silk_setup_LBRR(
     silk_encoder_state              *psEncC,            /* I/O                      */
-    const opus_int32                 TargetRate_bps      /* I                        */
+    const opus_int32                TargetRate_bps      /* I                        */
 );
 
 
 /* Control encoder */
 opus_int silk_control_encoder(
-    silk_encoder_state_Fxx          *psEnc,             /* I/O  Pointer to Silk encoder state           */
-    silk_EncControlStruct           *encControl,        /* I:   Control structure                       */
-    const opus_int32                 TargetRate_bps,     /* I    Target max bitrate (bps)                */
-    const opus_int                   allow_bw_switch,    /* I    Flag to allow switching audio bandwidth */
-    const opus_int                   channelNb,           /* I    Channel number                          */
-    const opus_int                   force_fs_kHz
+    silk_encoder_state_Fxx          *psEnc,                                 /* I/O  Pointer to Silk encoder state                                               */
+    silk_EncControlStruct           *encControl,                            /* I    Control structure                                                           */
+    const opus_int32                TargetRate_bps,                         /* I    Target max bitrate (bps)                                                    */
+    const opus_int                  allow_bw_switch,                        /* I    Flag to allow switching audio bandwidth                                     */
+    const opus_int                  channelNb,                              /* I    Channel number                                                              */
+    const opus_int                  force_fs_kHz
 )
 {
     opus_int   fs_kHz, ret = 0;
@@ -105,8 +105,9 @@ opus_int silk_control_encoder(
     /* Determine internal sampling rate         */
     /********************************************/
     fs_kHz = silk_control_audio_bandwidth( &psEnc->sCmn, encControl );
-    if (force_fs_kHz)
+    if( force_fs_kHz ) {
        fs_kHz = force_fs_kHz;
+    }
     /********************************************/
     /* Prepare resampler and buffered data      */
     /********************************************/
@@ -194,8 +195,8 @@ opus_int silk_setup_resamplers(
 
 opus_int silk_setup_fs(
     silk_encoder_state_Fxx          *psEnc,             /* I/O                      */
-    opus_int                         fs_kHz,             /* I                        */
-    opus_int                         PacketSize_ms       /* I                        */
+    opus_int                        fs_kHz,             /* I                        */
+    opus_int                        PacketSize_ms       /* I                        */
 )
 {
     opus_int ret = SILK_NO_ERROR;
@@ -310,7 +311,7 @@ opus_int silk_setup_fs(
 
 opus_int silk_setup_complexity(
     silk_encoder_state              *psEncC,            /* I/O                      */
-    opus_int                         Complexity          /* I                        */
+    opus_int                        Complexity          /* I                        */
 )
 {
     opus_int ret = 0;
@@ -392,7 +393,7 @@ opus_int silk_setup_complexity(
 
 static inline opus_int silk_setup_LBRR(
     silk_encoder_state          *psEncC,            /* I/O                      */
-    const opus_int32                 TargetRate_bps      /* I                        */
+    const opus_int32            TargetRate_bps      /* I                        */
 )
 {
     opus_int   ret = SILK_NO_ERROR;
index ead7428..f744bc6 100644 (file)
@@ -31,12 +31,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include "main.h"
 
-
 /************************/
 /* Init Decoder State   */
 /************************/
 opus_int silk_init_decoder(
-    silk_decoder_state      *psDec              /* I/O  Decoder state pointer                       */
+    silk_decoder_state          *psDec                          /* I/O  Decoder state pointer                       */
 )
 {
     /* Clear the entire encoder state, except anything copied */
index b8a31b3..5dfcaa9 100644 (file)
@@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <sys/time.h>
 #endif
 
-unsigned long silk_GetHighResolutionTime(void) /* O: time in usec*/
+unsigned long silk_GetHighResolutionTime(void) /* O  time in usec*/
 {
     /* Returns a time counter in microsec   */
     /* the resolution is platform dependent */
@@ -54,7 +54,7 @@ unsigned long silk_GetHighResolutionTime(void) /* O: time in usec*/
     return (unsigned long)((1000000*(lpPerformanceCount.QuadPart)) / lpFrequency.QuadPart);
 }
 #else   /* Linux or Mac*/
-unsigned long GetHighResolutionTime(void) /* O: time in usec*/
+unsigned long GetHighResolutionTime(void) /* O  time in usec*/
 {
     struct timeval tv;
     gettimeofday(&tv, 0);
index e48f55d..a3ea5cd 100644 (file)
@@ -41,7 +41,7 @@ extern "C"
 {
 #endif
 
-unsigned long GetHighResolutionTime(void); /* O: time in usec*/
+unsigned long GetHighResolutionTime(void); /* O  time in usec*/
 
 /* make SILK_DEBUG dependent on compiler's _DEBUG */
 #if defined _WIN32
@@ -62,7 +62,8 @@ unsigned long GetHighResolutionTime(void); /* O: time in usec*/
 #endif
 
 /* Flag for using timers */
-#define SILK_TIC_TOC 0
+#define SILK_TIC_TOC    0
+
 
 #if SILK_TIC_TOC
 
@@ -84,9 +85,9 @@ unsigned long GetHighResolutionTime(void); /* O: time in usec*/
 /*                                                                  */
 /* and call the following just before exiting (from main)           */
 /*                                                                  */
-/* silk_TimerSave("silk_TimingData.txt");                             */
+/* silk_TimerSave("silk_TimingData.txt");                           */
 /*                                                                  */
-/* results are now in silk_TimingData.txt                            */
+/* results are now in silk_TimingData.txt                           */
 
 void silk_TimerSave(char *file_name);
 
@@ -104,10 +105,10 @@ extern LARGE_INTEGER silk_Timer_start[silk_NUM_TIMERS_MAX];
 extern unsigned long silk_Timer_start[silk_NUM_TIMERS_MAX];
 #endif
 extern unsigned int  silk_Timer_cnt[silk_NUM_TIMERS_MAX];
-extern opus_int64     silk_Timer_sum[silk_NUM_TIMERS_MAX];
-extern opus_int64     silk_Timer_max[silk_NUM_TIMERS_MAX];
-extern opus_int64     silk_Timer_min[silk_NUM_TIMERS_MAX];
-extern opus_int64     silk_Timer_depth[silk_NUM_TIMERS_MAX];
+extern opus_int64    silk_Timer_sum[silk_NUM_TIMERS_MAX];
+extern opus_int64    silk_Timer_max[silk_NUM_TIMERS_MAX];
+extern opus_int64    silk_Timer_min[silk_NUM_TIMERS_MAX];
+extern opus_int64    silk_Timer_depth[silk_NUM_TIMERS_MAX];
 
 /* WARNING: TIC()/TOC can measure only up to 0.1 seconds at a time */
 #ifdef _WIN32
@@ -118,25 +119,25 @@ extern opus_int64     silk_Timer_depth[silk_NUM_TIMERS_MAX];
     {                                                       \
         int k;                                              \
         init = 1;                                           \
-        for( k = 0; k < silk_Timer_nTimers; k++ ) {          \
-            if( strcmp(silk_Timer_tags[k], #TAG_NAME) == 0 ) {   \
+        for( k = 0; k < silk_Timer_nTimers; k++ ) {         \
+            if( strcmp(silk_Timer_tags[k], #TAG_NAME) == 0 ) { \
                 ID = k;                                     \
                 break;                                      \
             }                                               \
         }                                                   \
         if (ID == -1) {                                     \
-            ID = silk_Timer_nTimers;                         \
-            silk_Timer_nTimers++;                            \
-            silk_Timer_depth[ID] = silk_Timer_depth_ctr;      \
-            strcpy(silk_Timer_tags[ID], #TAG_NAME);          \
-            silk_Timer_cnt[ID] = 0;                          \
-            silk_Timer_sum[ID] = 0;                          \
-            silk_Timer_min[ID] = 0xFFFFFFFF;                 \
-            silk_Timer_max[ID] = 0;                          \
+            ID = silk_Timer_nTimers;                        \
+            silk_Timer_nTimers++;                           \
+            silk_Timer_depth[ID] = silk_Timer_depth_ctr;    \
+            strcpy(silk_Timer_tags[ID], #TAG_NAME);         \
+            silk_Timer_cnt[ID] = 0;                         \
+            silk_Timer_sum[ID] = 0;                         \
+            silk_Timer_min[ID] = 0xFFFFFFFF;                \
+            silk_Timer_max[ID] = 0;                         \
         }                                                   \
     }                                                       \
-    silk_Timer_depth_ctr++;                                  \
-    QueryPerformanceCounter(&silk_Timer_start[ID]);          \
+    silk_Timer_depth_ctr++;                                 \
+    QueryPerformanceCounter(&silk_Timer_start[ID]);         \
 }
 #else
 #define TIC(TAG_NAME) {                                     \
@@ -146,25 +147,25 @@ extern opus_int64     silk_Timer_depth[silk_NUM_TIMERS_MAX];
     {                                                       \
         int k;                                              \
         init = 1;                                           \
-        for( k = 0; k < silk_Timer_nTimers; k++ ) {          \
-        if( strcmp(silk_Timer_tags[k], #TAG_NAME) == 0 ) {   \
+        for( k = 0; k < silk_Timer_nTimers; k++ ) {         \
+        if( strcmp(silk_Timer_tags[k], #TAG_NAME) == 0 ) {  \
                 ID = k;                                     \
                 break;                                      \
             }                                               \
         }                                                   \
         if (ID == -1) {                                     \
-            ID = silk_Timer_nTimers;                         \
-            silk_Timer_nTimers++;                            \
-            silk_Timer_depth[ID] = silk_Timer_depth_ctr;      \
-            strcpy(silk_Timer_tags[ID], #TAG_NAME);          \
-            silk_Timer_cnt[ID] = 0;                          \
-            silk_Timer_sum[ID] = 0;                          \
-            silk_Timer_min[ID] = 0xFFFFFFFF;                 \
-            silk_Timer_max[ID] = 0;                          \
+            ID = silk_Timer_nTimers;                        \
+            silk_Timer_nTimers++;                           \
+            silk_Timer_depth[ID] = silk_Timer_depth_ctr;    \
+            strcpy(silk_Timer_tags[ID], #TAG_NAME);         \
+            silk_Timer_cnt[ID] = 0;                         \
+            silk_Timer_sum[ID] = 0;                         \
+            silk_Timer_min[ID] = 0xFFFFFFFF;                \
+            silk_Timer_max[ID] = 0;                         \
         }                                                   \
     }                                                       \
-    silk_Timer_depth_ctr++;                                  \
-    silk_Timer_start[ID] = GetHighResolutionTime();          \
+    silk_Timer_depth_ctr++;                                 \
+    silk_Timer_start[ID] = GetHighResolutionTime();         \
 }
 #endif
 
@@ -177,25 +178,25 @@ extern opus_int64     silk_Timer_depth[silk_NUM_TIMERS_MAX];
     {                                                               \
         int k;                                                      \
         init = 1;                                                   \
-        for( k = 0; k < silk_Timer_nTimers; k++ ) {                  \
-            if( strcmp(silk_Timer_tags[k], #TAG_NAME) == 0 ) {       \
+        for( k = 0; k < silk_Timer_nTimers; k++ ) {                 \
+            if( strcmp(silk_Timer_tags[k], #TAG_NAME) == 0 ) {      \
                 ID = k;                                             \
                 break;                                              \
             }                                                       \
         }                                                           \
     }                                                               \
     QueryPerformanceCounter(&lpPerformanceCount);                   \
-    lpPerformanceCount.QuadPart -= silk_Timer_start[ID].QuadPart;    \
+    lpPerformanceCount.QuadPart -= silk_Timer_start[ID].QuadPart;   \
     if((lpPerformanceCount.QuadPart < 100000000) &&                 \
         (lpPerformanceCount.QuadPart >= 0)) {                       \
-        silk_Timer_cnt[ID]++;                                        \
-        silk_Timer_sum[ID] += lpPerformanceCount.QuadPart;           \
-        if( lpPerformanceCount.QuadPart > silk_Timer_max[ID] )       \
-            silk_Timer_max[ID] = lpPerformanceCount.QuadPart;        \
-        if( lpPerformanceCount.QuadPart < silk_Timer_min[ID] )       \
-            silk_Timer_min[ID] = lpPerformanceCount.QuadPart;        \
+        silk_Timer_cnt[ID]++;                                       \
+        silk_Timer_sum[ID] += lpPerformanceCount.QuadPart;          \
+        if( lpPerformanceCount.QuadPart > silk_Timer_max[ID] )      \
+            silk_Timer_max[ID] = lpPerformanceCount.QuadPart;       \
+        if( lpPerformanceCount.QuadPart < silk_Timer_min[ID] )      \
+            silk_Timer_min[ID] = lpPerformanceCount.QuadPart;       \
     }                                                               \
-    silk_Timer_depth_ctr--;                                          \
+    silk_Timer_depth_ctr--;                                         \
 }
 #else
 #define TOC(TAG_NAME) {                                             \
@@ -206,25 +207,25 @@ extern opus_int64     silk_Timer_depth[silk_NUM_TIMERS_MAX];
     {                                                               \
         int k;                                                      \
         init = 1;                                                   \
-        for( k = 0; k < silk_Timer_nTimers; k++ ) {                  \
-            if( strcmp(silk_Timer_tags[k], #TAG_NAME) == 0 ) {       \
+        for( k = 0; k < silk_Timer_nTimers; k++ ) {                 \
+            if( strcmp(silk_Timer_tags[k], #TAG_NAME) == 0 ) {      \
                 ID = k;                                             \
                 break;                                              \
             }                                                       \
         }                                                           \
     }                                                               \
     endTime = GetHighResolutionTime();                              \
-    endTime -= silk_Timer_start[ID];                                 \
+    endTime -= silk_Timer_start[ID];                                \
     if((endTime < 100000000) &&                                     \
         (endTime >= 0)) {                                           \
-        silk_Timer_cnt[ID]++;                                        \
-        silk_Timer_sum[ID] += endTime;                               \
-        if( endTime > silk_Timer_max[ID] )                           \
-            silk_Timer_max[ID] = endTime;                            \
-        if( endTime < silk_Timer_min[ID] )                           \
-            silk_Timer_min[ID] = endTime;                            \
+        silk_Timer_cnt[ID]++;                                       \
+        silk_Timer_sum[ID] += endTime;                              \
+        if( endTime > silk_Timer_max[ID] )                          \
+            silk_Timer_max[ID] = endTime;                           \
+        if( endTime < silk_Timer_min[ID] )                          \
+            silk_Timer_min[ID] = endTime;                           \
     }                                                               \
-        silk_Timer_depth_ctr--;                                      \
+        silk_Timer_depth_ctr--;                                     \
 }
 #endif
 
@@ -238,45 +239,22 @@ extern opus_int64     silk_Timer_depth[silk_NUM_TIMERS_MAX];
 #endif /* SILK_TIC_TOC */
 
 
-
 #if SILK_DEBUG
 /************************************/
 /* write data to file for debugging */
 /************************************/
-/* opens an empty file if this file has not yet been open, then writes to the file and closes it            */
-/* if file has been open previously it is opened again and the fwrite is appending, finally it is closed    */
-#define SAVE_DATA( FILE_NAME, DATA_PTR, N_BYTES ) {                 \
-    static opus_int32 init = 0;                                      \
-    FILE *fp;                                                       \
-    if (init == 0)    {                                               \
-        init = 1;                                                   \
-        fp = fopen(#FILE_NAME, "wb");                               \
-    } else {                                                        \
-        fp = fopen(#FILE_NAME, "ab+");                              \
-    }                                                                \
-    fwrite((DATA_PTR), (N_BYTES), 1, fp);                           \
-    fclose(fp);                                                     \
-}
-
 /* Example: DEBUG_STORE_DATA(testfile.pcm, &RIN[0], 160*sizeof(opus_int16)); */
 
-#if 0
-/* Ensure that everything is written to files when an assert breaks */
-#define DEBUG_STORE_DATA(FILE_NAME, DATA_PTR, N_BYTES) SAVE_DATA(FILE_NAME, DATA_PTR, N_BYTES)
-#define SILK_DEBUG_STORE_CLOSE_FILES
-
-#else
-
 #define silk_NUM_STORES_MAX                                  100
 extern FILE *silk_debug_store_fp[ silk_NUM_STORES_MAX ];
 extern int silk_debug_store_count;
 
 /* Faster way of storing the data */
 #define DEBUG_STORE_DATA( FILE_NAME, DATA_PTR, N_BYTES ) {          \
-    static opus_int init = 0, cnt = 0;                               \
+    static opus_int init = 0, cnt = 0;                              \
     static FILE **fp;                                               \
     if (init == 0) {                                                \
-        init = 1;                                                    \
+        init = 1;                                                   \
         cnt = silk_debug_store_count++;                             \
         silk_debug_store_fp[ cnt ] = fopen(#FILE_NAME, "wb");       \
     }                                                               \
@@ -285,12 +263,11 @@ extern int silk_debug_store_count;
 
 /* Call this at the end of main() */
 #define SILK_DEBUG_STORE_CLOSE_FILES {                              \
-    opus_int i;                                                      \
+    opus_int i;                                                     \
     for( i = 0; i < silk_debug_store_count; i++ ) {                 \
         fclose( silk_debug_store_fp[ i ] );                         \
     }                                                               \
 }
-#endif
 
 /* micro sec */
 #define silk_GETTIME(void)       time = (opus_int64) silk_GetHighResolutionTime();
@@ -299,7 +276,6 @@ extern int silk_debug_store_count;
 
 /* define macros as empty strings */
 #define DEBUG_STORE_DATA(FILE_NAME, DATA_PTR, N_BYTES)
-#define SAVE_DATA(FILE_NAME, DATA_PTR, N_BYTES)
 #define SILK_DEBUG_STORE_CLOSE_FILES
 
 #endif /* SILK_DEBUG */
index 58cf59a..9fe62d9 100644 (file)
@@ -46,7 +46,9 @@ typedef struct {
 /* Decoder functions */
 /*********************/
 
-opus_int silk_Get_Decoder_Size( int *decSizeBytes )
+opus_int silk_Get_Decoder_Size(                         /* O    Returns error code                              */
+    opus_int                        *decSizeBytes       /* O    Number of bytes in SILK decoder state           */
+)
 {
     opus_int ret = SILK_NO_ERROR;
 
@@ -56,8 +58,8 @@ opus_int silk_Get_Decoder_Size( int *decSizeBytes )
 }
 
 /* Reset decoder state */
-opus_int silk_InitDecoder(
-    void* decState                                      /* I/O: State                                          */
+opus_int silk_InitDecoder(                              /* O    Returns error code                              */
+    void                            *decState           /* I/O  State                                           */
 )
 {
     opus_int n, ret = SILK_NO_ERROR;
@@ -71,14 +73,14 @@ opus_int silk_InitDecoder(
 }
 
 /* Decode a frame */
-opus_int silk_Decode(
-    void*                               decState,       /* I/O: State                                           */
-    silk_DecControlStruct*      decControl,     /* I/O: Control Structure                               */
-    opus_int                             lostFlag,       /* I:   0: no loss, 1 loss, 2 decode FEC                */
-    opus_int                             newPacketFlag,  /* I:   Indicates first decoder call for this packet    */
-    ec_dec                              *psRangeDec,    /* I/O  Compressor data structure                       */
-    opus_int16                           *samplesOut,    /* O:   Decoded output speech vector                    */
-    opus_int32                           *nSamplesOut    /* O:   Number of samples decoded                       */
+opus_int silk_Decode(                                   /* O    Returns error code                              */
+    void*                           decState,           /* I/O  State                                           */
+    silk_DecControlStruct*          decControl,         /* I/O  Control Structure                               */
+    opus_int                        lostFlag,           /* I    0: no loss, 1 loss, 2 decode fec                */
+    opus_int                        newPacketFlag,      /* I    Indicates first decoder call for this packet    */
+    ec_dec                          *psRangeDec,        /* I/O  Compressor data structure                       */
+    opus_int16                      *samplesOut,        /* O    Decoded output speech vector                    */
+    opus_int32                      *nSamplesOut        /* O    Number of samples decoded                       */
 )
 {
     opus_int   i, n, delay, decode_only_middle = 0, ret = SILK_NO_ERROR;
@@ -237,7 +239,7 @@ opus_int silk_Decode(
         psDec->channel_state[ 1 ].first_frame_after_reset = 1;
     }
 
-    if (lostFlag == FLAG_DECODE_NORMAL) {
+    if( lostFlag == FLAG_DECODE_NORMAL ) {
         has_side = !decode_only_middle;
     } else {
         has_side = !psDec->prev_decode_only_middle
@@ -318,7 +320,7 @@ opus_int silk_Decode(
         decControl->prevPitchLag = 0;
     }
 
-    if ( lostFlag != FLAG_PACKET_LOST ) {
+    if( lostFlag != FLAG_PACKET_LOST ) {
        psDec->prev_decode_only_middle = decode_only_middle;
     }
     return ret;
@@ -326,10 +328,10 @@ opus_int silk_Decode(
 
 /* Getting table of contents for a packet */
 opus_int silk_get_TOC(
-    const opus_uint8                     *payload,           /* I    Payload data                                */
-    const opus_int                       nBytesIn,           /* I:   Number of input bytes                       */
-    const opus_int                       nFramesPerPayload,  /* I:   Number of SILK frames per payload           */
-    silk_TOC_struct                 *Silk_TOC           /* O:   Type of content                             */
+    const opus_uint8                *payload,           /* I    Payload data                                */
+    const opus_int                  nBytesIn,           /* I    Number of input bytes                       */
+    const opus_int                  nFramesPerPayload,  /* I    Number of SILK frames per payload           */
+    silk_TOC_struct                 *Silk_TOC           /* O    Type of content                             */
 )
 {
     opus_int i, flags, ret = SILK_NO_ERROR;
index fd7283f..9a4c9f3 100644 (file)
@@ -35,10 +35,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /* Core decoder. Performs inverse NSQ operation LTP + LPC */
 /**********************************************************/
 void silk_decode_core(
-    silk_decoder_state      *psDec,                             /* I/O  Decoder state               */
-    silk_decoder_control    *psDecCtrl,                         /* I    Decoder control             */
-    opus_int16                   xq[],                               /* O    Decoded speech              */
-    const opus_int               pulses[ MAX_FRAME_LENGTH ]          /* I    Pulse signal                */
+    silk_decoder_state          *psDec,                         /* I/O  Decoder state                               */
+    silk_decoder_control        *psDecCtrl,                     /* I    Decoder control                             */
+    opus_int16                  xq[],                           /* O    Decoded speech                              */
+    const opus_int              pulses[ MAX_FRAME_LENGTH ]      /* I    Pulse signal                                */
 )
 {
     opus_int   i, j, k, lag = 0, start_idx, sLTP_buf_idx, NLSF_interpolation_flag, signalType;
@@ -77,10 +77,6 @@ void silk_decode_core(
         rand_seed = silk_ADD32_ovflw(rand_seed, pulses[ i ]);
     }
 
-#ifdef SAVE_ALL_INTERNAL_DATA
-    DEBUG_STORE_DATA( dec_q.dat, pulses, psDec->frame_length * sizeof( opus_int ) );
-#endif
-
     /* Copy LPC state */
     silk_memcpy( sLPC_Q14, psDec->sLPC_Q14_buf, MAX_LPC_ORDER * sizeof( opus_int32 ) );
 
@@ -187,11 +183,6 @@ void silk_decode_core(
             pres_Q10 = pexc_Q10;
         }
 
-#ifdef SAVE_ALL_INTERNAL_DATA
-        DEBUG_STORE_DATA( dec_exc_Q10.dat, pexc_Q10, psDec->subfr_length * sizeof( opus_int32 ) );
-        DEBUG_STORE_DATA( dec_res_Q10.dat, pres_Q10, psDec->subfr_length * sizeof( opus_int32 ) );
-#endif
-
         for( i = 0; i < psDec->subfr_length; i++ ) {
             /* Partially unrolled */
             LPC_pred_Q10 = silk_SMULWB(               sLPC_Q14[ MAX_LPC_ORDER + i -  1 ], A_Q12_tmp[ 0 ] );
@@ -223,9 +214,4 @@ void silk_decode_core(
 
     /* Save LPC state */
     silk_memcpy( psDec->sLPC_Q14_buf, sLPC_Q14, MAX_LPC_ORDER * sizeof( opus_int32 ) );
-
-#ifdef SAVE_ALL_INTERNAL_DATA
-    DEBUG_STORE_DATA( dec_sLTP_Q16.dat, &sLTP_Q16[ psDec->ltp_mem_length ], psDec->frame_length * sizeof( opus_int32 ));
-    DEBUG_STORE_DATA( dec_xq.dat, xq, psDec->frame_length * sizeof( opus_int16 ) );
-#endif
 }
index 83c9221..91adc38 100644 (file)
@@ -36,20 +36,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /* Decode frame */
 /****************/
 opus_int silk_decode_frame(
-    silk_decoder_state      *psDec,             /* I/O  Pointer to Silk decoder state               */
-    ec_dec                      *psRangeDec,        /* I/O  Compressor data structure                   */
-    opus_int16                   pOut[],             /* O    Pointer to output speech frame              */
-    opus_int32                   *pN,                /* O    Pointer to size of output frame             */
-    opus_int                     lostFlag,           /* I    0: no loss, 1 loss, 2 decode fec            */
-    opus_int                     condCoding          /* I    The type of conditional coding to use       */
+    silk_decoder_state          *psDec,                         /* I/O  Pointer to Silk decoder state               */
+    ec_dec                      *psRangeDec,                    /* I/O  Compressor data structure                   */
+    opus_int16                  pOut[],                         /* O    Pointer to output speech frame              */
+    opus_int32                  *pN,                            /* O    Pointer to size of output frame             */
+    opus_int                    lostFlag,                       /* I    0: no loss, 1 loss, 2 decode fec            */
+    opus_int                    condCoding                      /* I    The type of conditional coding to use       */
 )
 {
     silk_decoder_control sDecCtrl;
     opus_int         L, mv_len, ret = 0;
     opus_int         pulses[ MAX_FRAME_LENGTH ];
 
-TIC(DECODE_FRAME)
-
     L = psDec->frame_length;
     sDecCtrl.LTP_scale_Q14 = 0;
 
@@ -62,24 +60,18 @@ TIC(DECODE_FRAME)
         /*********************************************/
         /* Decode quantization indices of side info  */
         /*********************************************/
-TIC(decode_indices)
         silk_decode_indices( psDec, psRangeDec, psDec->nFramesDecoded, lostFlag, condCoding );
-TOC(decode_indices)
 
         /*********************************************/
         /* Decode quantization indices of excitation */
         /*********************************************/
-TIC(decode_pulses)
         silk_decode_pulses( psRangeDec, pulses, psDec->indices.signalType,
                 psDec->indices.quantOffsetType, psDec->frame_length );
-TOC(decode_pulses)
 
         /********************************************/
         /* Decode parameters and pulse signal       */
         /********************************************/
-TIC(decode_params)
         silk_decode_parameters( psDec, &sDecCtrl, condCoding );
-TOC(decode_params)
 
         /* Update length. Sampling frequency may have changed */
         L = psDec->frame_length;
@@ -87,9 +79,7 @@ TOC(decode_params)
         /********************************************************/
         /* Run inverse NSQ                                      */
         /********************************************************/
-TIC(decode_core)
         silk_decode_core( psDec, &sDecCtrl, pOut, pulses );
-TOC(decode_core)
 
         /********************************************************/
         /* Update PLC state                                     */
@@ -131,7 +121,5 @@ TOC(decode_core)
     /* Set output frame length */
     *pN = L;
 
-TOC(DECODE_FRAME)
-
     return ret;
 }
index 8ac53f4..e344b1e 100644 (file)
@@ -33,11 +33,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /* Decode side-information parameters from payload */
 void silk_decode_indices(
-    silk_decoder_state      *psDec,             /* I/O  State                                       */
-    ec_dec                      *psRangeDec,        /* I/O  Compressor data structure                   */
-    opus_int                     FrameIndex,         /* I    Frame number                                */
-    opus_int                     decode_LBRR,        /* I    Flag indicating LBRR data is being decoded  */
-    opus_int                     condCoding          /* I    The type of conditional coding to use       */
+    silk_decoder_state          *psDec,                         /* I/O  State                                       */
+    ec_dec                      *psRangeDec,                    /* I/O  Compressor data structure                   */
+    opus_int                    FrameIndex,                     /* I    Frame number                                */
+    opus_int                    decode_LBRR,                    /* I    Flag indicating LBRR data is being decoded  */
+    opus_int                    condCoding                      /* I    The type of conditional coding to use       */
 )
 {
     opus_int   i, k, Ix;
index 1ab8ed7..6c69cfa 100644 (file)
@@ -33,9 +33,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /* Decode parameters from payload */
 void silk_decode_parameters(
-    silk_decoder_state      *psDec,                             /* I/O  State                                    */
-    silk_decoder_control    *psDecCtrl,                         /* I/O  Decoder control                          */
-    opus_int                 condCoding                         /* I    The type of conditional coding to use    */
+    silk_decoder_state          *psDec,                         /* I/O  State                                       */
+    silk_decoder_control        *psDecCtrl,                     /* I/O  Decoder control                             */
+    opus_int                    condCoding                      /* I    The type of conditional coding to use       */
 )
 {
     opus_int   i, k, Ix;
index 6aeb7ab..8fc6f07 100644 (file)
@@ -36,11 +36,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "pitch_est_defines.h"
 
 void silk_decode_pitch(
-    opus_int16       lagIndex,                        /* I                             */
-    opus_int8        contourIndex,                    /* O                             */
-    opus_int         pitch_lags[],                    /* O pitch values                */
-    const opus_int   Fs_kHz,                          /* I sampling frequency (kHz)    */
-    const opus_int   nb_subfr                         /* I number of sub frames        */
+    opus_int16                  lagIndex,           /* I                                                                */
+    opus_int8                   contourIndex,       /* O                                                                */
+    opus_int                    pitch_lags[],       /* O    4 pitch values                                              */
+    const opus_int              Fs_kHz,             /* I    sampling frequency (kHz)                                    */
+    const opus_int              nb_subfr            /* I    number of sub frames                                        */
 )
 {
     opus_int   lag, k, min_lag, max_lag, cbk_size;
index 692ab92..e398f19 100644 (file)
@@ -35,11 +35,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /* Decode quantization indices of excitation */
 /*********************************************/
 void silk_decode_pulses(
-    ec_dec                          *psRangeDec,        /* I/O  Compressor data structure                   */
-    opus_int                         pulses[],           /* O    Excitation signal                           */
-    const opus_int                   signalType,         /* I    Sigtype                                     */
-    const opus_int                   quantOffsetType,    /* I    quantOffsetType                             */
-    const opus_int                   frame_length        /* I    Frame length                                */
+    ec_dec                      *psRangeDec,                    /* I/O  Compressor data structure                   */
+    opus_int                    pulses[],                       /* O    Excitation signal                           */
+    const opus_int              signalType,                     /* I    Sigtype                                     */
+    const opus_int              quantOffsetType,                /* I    quantOffsetType                             */
+    const opus_int              frame_length                    /* I    Frame length                                */
 )
 {
     opus_int   i, j, k, iter, abs_q, nLS, RateLevelIndex;
@@ -55,7 +55,7 @@ void silk_decode_pulses(
     /* Calculate number of shell blocks */
     silk_assert( 1 << LOG2_SHELL_CODEC_FRAME_LENGTH == SHELL_CODEC_FRAME_LENGTH );
     iter = silk_RSHIFT( frame_length, LOG2_SHELL_CODEC_FRAME_LENGTH );
-    if( iter * SHELL_CODEC_FRAME_LENGTH < frame_length ){
+    if( iter * SHELL_CODEC_FRAME_LENGTH < frame_length ) {
         silk_assert( frame_length == 12 * 10 ); /* Make sure only happens for 10 ms @ 12 kHz */
         iter++;
     }
@@ -73,7 +73,7 @@ void silk_decode_pulses(
             nLshifts[ i ]++;
             /* When we've already got 10 LSBs, we shift the table to not allow (MAX_PULSES + 1) */
             sum_pulses[ i ] = ec_dec_icdf( psRangeDec,
-                    silk_pulses_per_block_iCDF[ N_RATE_LEVELS - 1] + (nLshifts[ i ]==10), 8 );
+                    silk_pulses_per_block_iCDF[ N_RATE_LEVELS - 1] + ( nLshifts[ i ] == 10 ), 8 );
         }
     }
 
index f80470f..5579b20 100644 (file)
@@ -40,9 +40,9 @@ static const int dec_delay_matrix[3][5] = {
 
 /* Set decoder sampling rate */
 opus_int silk_decoder_set_fs(
-    silk_decoder_state              *psDec,             /* I/O  Decoder state pointer                       */
-    opus_int                         fs_kHz,             /* I    Sampling frequency (kHz)                    */
-    opus_int                         fs_API_Hz           /* I    API Sampling frequency (Hz)                 */
+    silk_decoder_state          *psDec,                         /* I/O  Decoder state pointer                       */
+    opus_int                    fs_kHz,                         /* I    Sampling frequency (kHz)                    */
+    opus_int                    fs_API_Hz                       /* I    API Sampling frequency (Hz)                 */
 )
 {
     opus_int frame_length, ret = 0;
index 8f9935f..dcfdee9 100644 (file)
@@ -57,7 +57,7 @@ extern "C"
 #define NB_SPEECH_FRAMES_BEFORE_DTX             10      /* eq 200 ms */
 #define MAX_CONSECUTIVE_DTX                     20      /* eq 400 ms */
 
-/* Maximum sampling frequency, should be 16 for embedded */
+/* Maximum sampling frequency */
 #define MAX_FS_KHZ                              16
 #define MAX_API_FS_KHZ                          48
 
@@ -74,12 +74,12 @@ extern "C"
 /* Settings for stereo processing */
 #define STEREO_QUANT_TAB_SIZE                   16
 #define STEREO_QUANT_SUB_STEPS                  5
-#define STEREO_INTERP_LEN_MS                    8           /* must be even */
-#define STEREO_RATIO_SMOOTH_COEF                0.01        /* smoothing coef for signal norms and stereo width */
+#define STEREO_INTERP_LEN_MS                    8       /* must be even */
+#define STEREO_RATIO_SMOOTH_COEF                0.01    /* smoothing coef for signal norms and stereo width */
 
 /* Range of pitch lag estimates */
-#define PITCH_EST_MIN_LAG_MS                    2           /* 2 ms -> 500 Hz */
-#define PITCH_EST_MAX_LAG_MS                    18          /* 18 ms -> 56 Hz */
+#define PITCH_EST_MIN_LAG_MS                    2       /* 2 ms -> 500 Hz */
+#define PITCH_EST_MAX_LAG_MS                    18      /* 18 ms -> 56 Hz */
 
 /* Maximum number of subframes */
 #define MAX_NB_SUBFR                            4
@@ -92,7 +92,7 @@ extern "C"
 #define MAX_FRAME_LENGTH                        ( MAX_FRAME_LENGTH_MS * MAX_FS_KHZ )
 
 #define MAX_ENCODER_DELAY                       18
-#define MAX_DECODER_DELAY                        8
+#define MAX_DECODER_DELAY                       8
 
 /* Milliseconds of lookahead for pitch analysis */
 #define LA_PITCH_MS                             2
@@ -193,11 +193,11 @@ extern "C"
 #define VAD_INTERNAL_SUBFRAMES_LOG2             2
 #define VAD_INTERNAL_SUBFRAMES                  (1 << VAD_INTERNAL_SUBFRAMES_LOG2)
 
-#define VAD_NOISE_LEVEL_SMOOTH_COEF_Q16         1024    /* Must be <  4096                                  */
+#define VAD_NOISE_LEVEL_SMOOTH_COEF_Q16         1024    /* Must be <  4096 */
 #define VAD_NOISE_LEVELS_BIAS                   50
 
 /* Sigmoid settings */
-#define VAD_NEGATIVE_OFFSET_Q5                  128     /* sigmoid is 0 at -128                             */
+#define VAD_NEGATIVE_OFFSET_Q5                  128     /* sigmoid is 0 at -128 */
 #define VAD_SNR_FACTOR_Q16                      45000
 
 /* smoothing for SNR measurement */
@@ -219,10 +219,10 @@ extern "C"
 #define NLSF_QUANT_DEL_DEC_STATES               ( 1 << NLSF_QUANT_DEL_DEC_STATES_LOG2 )
 
 /* Transition filtering for mode switching */
-#define TRANSITION_TIME_MS                      5120 /* 5120 = 64 * FRAME_LENGTH_MS * ( TRANSITION_INT_NUM - 1 ) = 64*(20*4)*/
-#define TRANSITION_NB                           3 /* Hardcoded in tables */
-#define TRANSITION_NA                           2 /* Hardcoded in tables */
-#define TRANSITION_INT_NUM                      5 /* Hardcoded in tables */
+#define TRANSITION_TIME_MS                      5120    /* 5120 = 64 * FRAME_LENGTH_MS * ( TRANSITION_INT_NUM - 1 ) = 64*(20*4)*/
+#define TRANSITION_NB                           3       /* Hardcoded in tables */
+#define TRANSITION_NA                           2       /* Hardcoded in tables */
+#define TRANSITION_INT_NUM                      5       /* Hardcoded in tables */
 #define TRANSITION_FRAMES                       ( TRANSITION_TIME_MS / MAX_FRAME_LENGTH_MS )
 #define TRANSITION_INT_STEPS                    ( TRANSITION_FRAMES  / ( TRANSITION_INT_NUM - 1 ) )
 
@@ -230,9 +230,9 @@ extern "C"
 #define BWE_AFTER_LOSS_Q16                      63570
 
 /* Defines for CN generation */
-#define CNG_BUF_MASK_MAX                        255             /* 2^floor(log2(MAX_FRAME_LENGTH))-1    */
-#define CNG_GAIN_SMTH_Q16                       4634            /* 0.25^(1/4)                           */
-#define CNG_NLSF_SMTH_Q16                       16348           /* 0.25                                 */
+#define CNG_BUF_MASK_MAX                        255     /* 2^floor(log2(MAX_FRAME_LENGTH))-1    */
+#define CNG_GAIN_SMTH_Q16                       4634    /* 0.25^(1/4)                           */
+#define CNG_NLSF_SMTH_Q16                       16348   /* 0.25                                 */
 
 #ifdef __cplusplus
 }
index 01a7e96..02a8fd0 100644 (file)
@@ -44,7 +44,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /* Encoder functions                    */
 /****************************************/
 
-opus_int silk_Get_Encoder_Size( opus_int *encSizeBytes )
+opus_int silk_Get_Encoder_Size(                         /* O    Returns error code                              */
+    opus_int                        *encSizeBytes       /* O    Number of bytes in SILK encoder state           */
+)
 {
     opus_int ret = SILK_NO_ERROR;
 
@@ -56,9 +58,9 @@ opus_int silk_Get_Encoder_Size( opus_int *encSizeBytes )
 /*************************/
 /* Init or Reset encoder */
 /*************************/
-opus_int silk_InitEncoder(
-    void                            *encState,          /* I/O: State                                           */
-    silk_EncControlStruct           *encStatus          /* O:   Control structure                               */
+opus_int silk_InitEncoder(                              /* O    Returns error code                              */
+    void                            *encState,          /* I/O  State                                           */
+    silk_EncControlStruct           *encStatus          /* O    Encoder Status                                  */
 )
 {
     silk_encoder *psEnc;
@@ -88,9 +90,9 @@ opus_int silk_InitEncoder(
 /***************************************/
 /* Read control structure from encoder */
 /***************************************/
-opus_int silk_QueryEncoder(
-    const void *encState,                       /* I:   State Vector                                    */
-    silk_EncControlStruct *encStatus            /* O:   Control Structure                               */
+opus_int silk_QueryEncoder(                             /* O    Returns error code                              */
+    const void                      *encState,          /* I    State                                           */
+    silk_EncControlStruct           *encStatus          /* O    Encoder Status                                  */
 )
 {
     opus_int ret = SILK_NO_ERROR;
@@ -123,14 +125,16 @@ opus_int silk_QueryEncoder(
 /**************************/
 /* Encode frame with Silk */
 /**************************/
-opus_int silk_Encode(
-    void                                *encState,      /* I/O: State                                           */
-    silk_EncControlStruct               *encControl,    /* I:   Control structure                               */
-    const opus_int16                     *samplesIn,     /* I:   Speech sample input vector                      */
-    opus_int                             nSamplesIn,     /* I:   Number of samples in input vector               */
-    ec_enc                              *psRangeEnc,    /* I/O  Compressor data structure                       */
-    opus_int                             *nBytesOut,     /* I/O: Number of bytes in payload (input: Max bytes)   */
-    const opus_int                       prefillFlag     /* I:   Flag to indicate prefilling buffers; no coding  */
+/* Note: if prefillFlag is set, the input must contain 10 ms of audio, irrespective of what                     */
+/* encControl->payloadSize_ms is set to                                                                         */
+opus_int silk_Encode(                                   /* O    Returns error code                              */
+    void                            *encState,          /* I/O  State                                           */
+    silk_EncControlStruct           *encControl,        /* I    Control status                                  */
+    const opus_int16                *samplesIn,         /* I    Speech sample input vector                      */
+    opus_int                        nSamplesIn,         /* I    Number of samples in input vector               */
+    ec_enc                          *psRangeEnc,        /* I/O  Compressor data structure                       */
+    opus_int                        *nBytesOut,         /* I/O  Number of bytes in payload (input: Max bytes)   */
+    const opus_int                  prefillFlag         /* I    Flag to indicate prefilling buffers no coding   */
 )
 {
     opus_int   n, i, nBits, flags, tmp_payloadSize_ms = 0, tmp_complexity = 0, ret = 0;
@@ -270,17 +274,18 @@ opus_int silk_Encode(
                 buf[ n + delay ] = (opus_int16)silk_RSHIFT_ROUND( samplesIn[ 2 * n ] + samplesIn[ 2 * n + 1 ],  1 );
             }
             if(psEnc->nPrevChannelsInternal == 2 && psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded==0) {
-               for ( n = 0; n<MAX_ENCODER_DELAY; n++ )
+               for( n = 0; n<MAX_ENCODER_DELAY; n++ ) {
                   psEnc->state_Fxx[ 0 ].sCmn.delayBuf[ n ] = silk_RSHIFT(psEnc->state_Fxx[ 0 ].sCmn.delayBuf[ n ]+(opus_int32)psEnc->state_Fxx[ 1 ].sCmn.delayBuf[ n ], 1);
+               }
             }
             silk_memcpy(buf, &psEnc->state_Fxx[ 0 ].sCmn.delayBuf[ MAX_ENCODER_DELAY - delay ], delay * sizeof(opus_int16));
             ret += silk_resampler( &psEnc->state_Fxx[ 0 ].sCmn.resampler_state,
                 &psEnc->state_Fxx[ 0 ].sCmn.inputBuf[ psEnc->state_Fxx[ 0 ].sCmn.inputBufIx + 2 ], buf, nSamplesFromInput );
             /* On the first mono frame, average the results for the two resampler states  */
-            if (psEnc->nPrevChannelsInternal == 2 && psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded==0) {
+            if( psEnc->nPrevChannelsInternal == 2 && psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded == 0 ) {
                ret += silk_resampler( &psEnc->state_Fxx[ 1 ].sCmn.resampler_state,
                    &psEnc->state_Fxx[ 1 ].sCmn.inputBuf[ psEnc->state_Fxx[ 1 ].sCmn.inputBufIx + 2 ], buf, nSamplesFromInput );
-               for ( n = 0; n < psEnc->state_Fxx[ 0 ].sCmn.frame_length; n++ ) {
+               for( n = 0; n < psEnc->state_Fxx[ 0 ].sCmn.frame_length; n++ ) {
                   psEnc->state_Fxx[ 0 ].sCmn.inputBuf[ psEnc->state_Fxx[ 0 ].sCmn.inputBufIx+n+2 ] =
                         silk_RSHIFT(psEnc->state_Fxx[ 0 ].sCmn.inputBuf[ psEnc->state_Fxx[ 0 ].sCmn.inputBufIx+n+2 ]
                                   + psEnc->state_Fxx[ 1 ].sCmn.inputBuf[ psEnc->state_Fxx[ 1 ].sCmn.inputBufIx+n+2 ], 1);
@@ -367,8 +372,9 @@ opus_int silk_Encode(
             /* Total target bits for packet */
             nBits = silk_DIV32_16( silk_MUL( encControl->bitRate, encControl->payloadSize_ms ), 1000 );
             /* Subtract half of the bits already used */
-            if (!prefillFlag)
+            if( !prefillFlag ) {
                 nBits -= ec_tell( psRangeEnc ) >> 1;
+            }
             /* Divide by number of uncoded frames left in packet */
             nBits = silk_DIV32_16( nBits, psEnc->state_Fxx[ 0 ].sCmn.nFramesPerPacket - psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded );
             /* Convert to bits/second */
index f87de03..f969a9b 100644 (file)
@@ -33,11 +33,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /* Encode side-information parameters to payload */
 void silk_encode_indices(
-    silk_encoder_state          *psEncC,            /* I/O  Encoder state                               */
-    ec_enc                      *psRangeEnc,        /* I/O  Compressor data structure                   */
-    opus_int                     FrameIndex,         /* I    Frame number                                */
-    opus_int                     encode_LBRR,        /* I    Flag indicating LBRR data is being encoded  */
-    opus_int                     condCoding          /* I    The type of conditional coding to use      */
+    silk_encoder_state          *psEncC,                        /* I/O  Encoder state                               */
+    ec_enc                      *psRangeEnc,                    /* I/O  Compressor data structure                   */
+    opus_int                    FrameIndex,                     /* I    Frame number                                */
+    opus_int                    encode_LBRR,                    /* I    Flag indicating LBRR data is being encoded  */
+    opus_int                    condCoding                      /* I    The type of conditional coding to use       */
 )
 {
     opus_int   i, k, typeOffset;
@@ -45,10 +45,6 @@ void silk_encode_indices(
     opus_int16 ec_ix[ MAX_LPC_ORDER ];
     opus_uint8 pred_Q8[ MAX_LPC_ORDER ];
     const SideInfoIndices *psIndices;
-#if SAVE_ALL_INTERNAL_DATA
-    opus_int nBytes_lagIndex, nBytes_contourIndex, nBytes_LTP;
-    opus_int nBytes_after, nBytes_before;
-#endif
 
     if( encode_LBRR ) {
          psIndices = &psEncC->indices_LBRR[ FrameIndex ];
@@ -71,9 +67,6 @@ void silk_encode_indices(
     /****************/
     /* Encode gains */
     /****************/
-#ifdef SAVE_ALL_INTERNAL_DATA
-    nBytes_before = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
-#endif
     /* first subframe */
     if( condCoding == CODE_CONDITIONALLY ) {
         /* conditional coding */
@@ -92,18 +85,9 @@ void silk_encode_indices(
         ec_enc_icdf( psRangeEnc, psIndices->GainsIndices[ i ], silk_delta_gain_iCDF, 8 );
     }
 
-#ifdef SAVE_ALL_INTERNAL_DATA
-    nBytes_after = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
-    nBytes_after -= nBytes_before; /* bytes just added*/
-    DEBUG_STORE_DATA( nBytes_gains.dat, &nBytes_after, sizeof( opus_int ) );
-#endif
-
     /****************/
     /* Encode NLSFs */
     /****************/
-#ifdef SAVE_ALL_INTERNAL_DATA
-    nBytes_before = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
-#endif
     ec_enc_icdf( psRangeEnc, psIndices->NLSFIndices[ 0 ], &psEncC->psNLSF_CB->CB1_iCDF[ ( psIndices->signalType >> 1 ) * psEncC->psNLSF_CB->nVectors ], 8 );
     silk_NLSF_unpack( ec_ix, pred_Q8, psEncC->psNLSF_CB, psIndices->NLSFIndices[ 0 ] );
     silk_assert( psEncC->psNLSF_CB->order == psEncC->predictLPCOrder );
@@ -125,21 +109,11 @@ void silk_encode_indices(
         ec_enc_icdf( psRangeEnc, psIndices->NLSFInterpCoef_Q2, silk_NLSF_interpolation_factor_iCDF, 8 );
     }
 
-#ifdef SAVE_ALL_INTERNAL_DATA
-    DEBUG_STORE_DATA( lsf_interpol.dat, &psIndices->NLSFInterpCoef_Q2, sizeof(int) );
-    nBytes_after = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
-    nBytes_after -= nBytes_before; /* bytes just added*/
-    DEBUG_STORE_DATA( nBytes_LSF.dat, &nBytes_after, sizeof( opus_int ) );
-#endif
-
     if( psIndices->signalType == TYPE_VOICED )
     {
         /*********************/
         /* Encode pitch lags */
         /*********************/
-#ifdef SAVE_ALL_INTERNAL_DATA
-        nBytes_before = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
-#endif
         /* lag index */
         encode_absolute_lagIndex = 1;
         if( condCoding == CODE_CONDITIONALLY && psEncC->ec_prevSignalType == TYPE_VOICED ) {
@@ -166,14 +140,6 @@ void silk_encode_indices(
         }
         psEncC->ec_prevLagIndex = psIndices->lagIndex;
 
-#ifdef SAVE_ALL_INTERNAL_DATA
-        nBytes_after = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
-        nBytes_lagIndex = nBytes_after - nBytes_before; /* bytes just added*/
-#endif
-
-#ifdef SAVE_ALL_INTERNAL_DATA
-        nBytes_before = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
-#endif
         /* Countour index */
         silk_assert(   psIndices->contourIndex  >= 0 );
         silk_assert( ( psIndices->contourIndex < 34 && psEncC->fs_kHz  > 8 && psEncC->nb_subfr == 4 ) ||
@@ -181,18 +147,10 @@ void silk_encode_indices(
                     ( psIndices->contourIndex < 12 && psEncC->fs_kHz  > 8 && psEncC->nb_subfr == 2 ) ||
                     ( psIndices->contourIndex <  3 && psEncC->fs_kHz == 8 && psEncC->nb_subfr == 2 ) );
         ec_enc_icdf( psRangeEnc, psIndices->contourIndex, psEncC->pitch_contour_iCDF, 8 );
-#ifdef SAVE_ALL_INTERNAL_DATA
-        nBytes_after = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
-        nBytes_contourIndex = nBytes_after - nBytes_before; /* bytes just added*/
-#endif
 
         /********************/
         /* Encode LTP gains */
         /********************/
-#ifdef SAVE_ALL_INTERNAL_DATA
-        nBytes_before = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
-#endif
-
         /* PERIndex value */
         silk_assert( psIndices->PERIndex >= 0 && psIndices->PERIndex < 3 );
         ec_enc_icdf( psRangeEnc, psIndices->PERIndex, silk_LTP_per_index_iCDF, 8 );
@@ -211,30 +169,10 @@ void silk_encode_indices(
             ec_enc_icdf( psRangeEnc, psIndices->LTP_scaleIndex, silk_LTPscale_iCDF, 8 );
         }
         silk_assert( !condCoding || psIndices->LTP_scaleIndex == 0 );
-
-#ifdef SAVE_ALL_INTERNAL_DATA
-        nBytes_after = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
-        nBytes_LTP = nBytes_after - nBytes_before; /* bytes just added*/
-#endif
-    }
-#ifdef SAVE_ALL_INTERNAL_DATA
-    else {
-        /* Unvoiced speech*/
-        nBytes_lagIndex     = 0;
-        nBytes_contourIndex = 0;
-        nBytes_LTP          = 0;
     }
-    DEBUG_STORE_DATA( nBytes_lagIndex.dat,      &nBytes_lagIndex,       sizeof( opus_int ) );
-    DEBUG_STORE_DATA( nBytes_contourIndex.dat,  &nBytes_contourIndex,   sizeof( opus_int ) );
-    DEBUG_STORE_DATA( nBytes_LTP.dat,           &nBytes_LTP,            sizeof( opus_int ) );
-#endif
 
     psEncC->ec_prevSignalType = psIndices->signalType;
 
-#ifdef SAVE_ALL_INTERNAL_DATA
-    nBytes_before = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
-#endif
-
     /***************/
     /* Encode seed */
     /***************/
index 2fd6b50..32eb4cf 100644 (file)
@@ -35,11 +35,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /* Encode quantization indices of excitation */
 /*********************************************/
 
-static inline opus_int combine_and_check(       /* return ok */
-    opus_int         *pulses_comb,           /* O */
-    const opus_int   *pulses_in,             /* I */
-    opus_int         max_pulses,             /* I    max value for sum of pulses */
-    opus_int         len                     /* I    number of output values */
+static inline opus_int combine_and_check(    /* return ok                           */
+    opus_int         *pulses_comb,           /* O                                   */
+    const opus_int   *pulses_in,             /* I                                   */
+    opus_int         max_pulses,             /* I    max value for sum of pulses    */
+    opus_int         len                     /* I    number of output values        */
 )
 {
     opus_int k, sum;
@@ -57,11 +57,11 @@ static inline opus_int combine_and_check(       /* return ok */
 
 /* Encode quantization indices of excitation */
 void silk_encode_pulses(
-    ec_enc                      *psRangeEnc,        /* I/O  compressor data structure                   */
-    const opus_int               signalType,         /* I    Sigtype                                     */
-    const opus_int               quantOffsetType,    /* I    quantOffsetType                             */
-    opus_int8                    pulses[],           /* I    quantization indices                        */
-    const opus_int               frame_length        /* I    Frame length                  &nb