shithub: opus

Download patch

ref: 59647fdb655bf6dc363c155b23bc817d195dc17d
parent: afc8d53b1b1d4a740551b3bbf8c2ac45061786ed
author: Gregory Maxwell <[email protected]>
date: Wed Sep 28 11:44:53 EDT 2011

Misc. silk/ cleanups: static inline things which are only used in one file.

--- a/silk/NLSF_decode.c
+++ b/silk/NLSF_decode.c
@@ -32,7 +32,7 @@
 #include "main.h"
 
 /* Predictive dequantizer for NLSF residuals */
-void silk_NLSF_residual_dequant(                            /* O    Returns RD value in Q30                     */
+static inline void silk_NLSF_residual_dequant(               /* O    Returns RD value in Q30                     */
           opus_int16         x_Q10[],                        /* O    Output [ order ]                            */
     const opus_int8          indices[],                      /* I    Quantization indices [ order ]              */
     const opus_uint8         pred_coef_Q8[],                 /* I    Backward predictor coefs [ order ]          */
--- a/silk/PLC.c
+++ b/silk/PLC.c
@@ -37,6 +37,18 @@
 static const opus_int16 PLC_RAND_ATTENUATE_V_Q15[NB_ATT]  = { 31130, 26214 }; /* 0.95, 0.8 */
 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      */
+);
+
+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    */
+);
+
+
 void silk_PLC_Reset(
     silk_decoder_state      *psDec              /* I/O Decoder state        */
 )
@@ -75,7 +87,7 @@
 /**************************************************/
 /* Update state of PLC                            */
 /**************************************************/
-void silk_PLC_update(
+static inline void silk_PLC_update(
     silk_decoder_state          *psDec,             /* (I/O) Decoder state          */
     silk_decoder_control        *psDecCtrl          /* (I/O) Decoder control        */
 )
@@ -147,7 +159,7 @@
     silk_memcpy( psPLC->prevGain_Q16, psDecCtrl->Gains_Q16, psDec->nb_subfr * sizeof( opus_int32 ) );
 }
 
-void silk_PLC_conceal(
+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 */
--- a/silk/PLC.h
+++ b/silk/PLC.h
@@ -53,17 +53,6 @@
     opus_int                     lost                /* I Loss flag              */
 );
 
-void silk_PLC_update(
-    silk_decoder_state      *psDec,             /* I/O Decoder state        */
-    silk_decoder_control    *psDecCtrl          /* I/O Decoder control      */
-);
-
-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    */
-);
-
 void silk_PLC_glue_frames(
     silk_decoder_state      *psDec,             /* I/O decoder state        */
     opus_int16                   signal[],           /* I/O signal               */
--- a/silk/SigProc_FIX.h
+++ b/silk/SigProc_FIX.h
@@ -58,13 +58,6 @@
 );
 
 /*!
- * Clear the states of all resampling filters, without resetting sampling rate ratio
- */
-opus_int silk_resampler_clear(
-    silk_resampler_state_struct            *S          /* I/O: Resampler state             */
-);
-
-/*!
  * Resampler: convert from one sampling rate to another
  */
 opus_int silk_resampler(
--- a/silk/VAD.c
+++ b/silk/VAD.c
@@ -32,6 +32,12 @@
 #include <stdlib.h>
 #include "main.h"
 
+/* Silk VAD noise level estimation */
+static inline void silk_VAD_GetNoiseLevels(
+    const opus_int32             pX[ VAD_N_BANDS ], /* I    subband energies                            */
+    silk_VAD_state              *psSilk_VAD         /* I/O  Pointer to Silk VAD state                   */
+);
+
 /**********************************/
 /* Initialization of the Silk VAD */
 /**********************************/
@@ -264,7 +270,7 @@
 /**************************/
 /* Noise level estimation */
 /**************************/
-void silk_VAD_GetNoiseLevels(
+static inline void silk_VAD_GetNoiseLevels(
     const opus_int32                 pX[ VAD_N_BANDS ],  /* I    subband energies                            */
     silk_VAD_state              *psSilk_VAD         /* I/O  Pointer to Silk VAD state                   */
 )
--- a/silk/float/LPC_analysis_filter_FLP.c
+++ b/silk/float/LPC_analysis_filter_FLP.c
@@ -40,7 +40,7 @@
 /************************************************/
 
 /* 16th order LPC analysis filter, does not write first 16 samples */
-void silk_LPC_analysis_filter16_FLP(
+static inline void silk_LPC_analysis_filter16_FLP(
           silk_float                 r_LPC[],            /* O    LPC residual signal                     */
     const silk_float                 PredCoef[],         /* I    LPC coefficients                        */
     const silk_float                 s[],                /* I    Input signal                            */
@@ -78,7 +78,7 @@
 }
 
 /* 14th order LPC analysis filter, does not write first 14 samples */
-void silk_LPC_analysis_filter14_FLP(
+static inline void silk_LPC_analysis_filter14_FLP(
           silk_float                 r_LPC[],            /* O    LPC residual signal                     */
     const silk_float                 PredCoef[],         /* I    LPC coefficients                        */
     const silk_float                 s[],                /* I    Input signal                            */
@@ -114,7 +114,7 @@
 }
 
 /* 12th order LPC analysis filter, does not write first 12 samples */
-void silk_LPC_analysis_filter12_FLP(
+static inline void silk_LPC_analysis_filter12_FLP(
           silk_float                 r_LPC[],            /* O    LPC residual signal                     */
     const silk_float                 PredCoef[],         /* I    LPC coefficients                        */
     const silk_float                 s[],                /* I    Input signal                            */
@@ -148,7 +148,7 @@
 }
 
 /* 10th order LPC analysis filter, does not write first 10 samples */
-void silk_LPC_analysis_filter10_FLP(
+static inline void silk_LPC_analysis_filter10_FLP(
           silk_float                 r_LPC[],            /* O    LPC residual signal                     */
     const silk_float                 PredCoef[],         /* I    LPC coefficients                        */
     const silk_float                 s[],                /* I    Input signal                            */
@@ -180,7 +180,7 @@
 }
 
 /* 8th order LPC analysis filter, does not write first 8 samples */
-void silk_LPC_analysis_filter8_FLP(
+static inline void silk_LPC_analysis_filter8_FLP(
           silk_float                 r_LPC[],            /* O    LPC residual signal                     */
     const silk_float                 PredCoef[],         /* I    LPC coefficients                        */
     const silk_float                 s[],                /* I    Input signal                            */
@@ -210,7 +210,7 @@
 }
 
 /* 6th order LPC analysis filter, does not write first 6 samples */
-void silk_LPC_analysis_filter6_FLP(
+static inline void silk_LPC_analysis_filter6_FLP(
           silk_float                 r_LPC[],            /* O    LPC residual signal                     */
     const silk_float                 PredCoef[],         /* I    LPC coefficients                        */
     const silk_float                 s[],                /* I    Input signal                            */
--- a/silk/float/encode_frame_FLP.c
+++ b/silk/float/encode_frame_FLP.c
@@ -32,6 +32,13 @@
 #include "main_FLP.h"
 #include "tuning_parameters.h"
 
+/* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode with lower bitrate           */
+static inline void silk_LBRR_encode_FLP(
+    silk_encoder_state_FLP          *psEnc,             /* I/O  Encoder state FLP                       */
+    silk_encoder_control_FLP        *psEncCtrl,         /* I/O  Encoder control FLP                     */
+    const silk_float                 xfw[]               /* I    Input signal                            */
+);
+
 /****************/
 /* Encode frame */
 /****************/
@@ -212,7 +219,7 @@
 }
 
 /* Low-Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode excitation at lower bitrate  */
-void silk_LBRR_encode_FLP(
+static inline void silk_LBRR_encode_FLP(
     silk_encoder_state_FLP          *psEnc,             /* I/O  Encoder state FLP                       */
     silk_encoder_control_FLP        *psEncCtrl,         /* I/O  Encoder control FLP                     */
     const silk_float                 xfw[]               /* I    Input signal                            */
--- a/silk/float/main_FLP.h
+++ b/silk/float/main_FLP.h
@@ -60,13 +60,6 @@
     ec_enc                          *psRangeEnc         /* I/O  compressor data structure               */
 );
 
-/* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode with lower bitrate           */
-void silk_LBRR_encode_FLP(
-    silk_encoder_state_FLP          *psEnc,             /* I/O  Encoder state FLP                       */
-    silk_encoder_control_FLP        *psEncCtrl,         /* I/O  Encoder control FLP                     */
-    const silk_float                 xfw[]               /* I    Input signal                            */
-);
-
 /* Initializes the Silk encoder state */
 opus_int silk_init_encoder(
     silk_encoder_state_FLP          *psEnc              /* I/O  Encoder state FLP                       */
--- a/silk/float/solve_LS_FLP.c
+++ b/silk/float/solve_LS_FLP.c
@@ -37,7 +37,7 @@
  * Matrix D (only the diagonal elements returned in a vector)such that
  * the symmetric matric A is given by A = L*D*L'.
  **********************************************************************/
-void silk_LDL_FLP(
+static inline void silk_LDL_FLP(
     silk_float           *A,      /* (I/O) Pointer to Symetric Square Matrix */
     opus_int             M,       /* (I) Size of Matrix */
     silk_float           *L,      /* (I/O) Pointer to Square Upper triangular Matrix */
@@ -48,7 +48,7 @@
  * Function to solve linear equation Ax = b, when A is a MxM lower
  * triangular matrix, with ones on the diagonal.
  **********************************************************************/
-void silk_SolveWithLowerTriangularWdiagOnes_FLP(
+static inline void silk_SolveWithLowerTriangularWdiagOnes_FLP(
     const silk_float     *L,     /* (I) Pointer to Lower Triangular Matrix */
     opus_int             M,      /* (I) Dim of Matrix equation */
     const silk_float     *b,     /* (I) b Vector */
@@ -59,7 +59,7 @@
  * Function to solve linear equation (A^T)x = b, when A is a MxM lower
  * triangular, with ones on the diagonal. (ie then A^T is upper triangular)
  **********************************************************************/
-void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP(
+static inline void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP(
     const silk_float     *L,     /* (I) Pointer to Lower Triangular Matrix */
     opus_int             M,      /* (I) Dim of Matrix equation */
     const silk_float     *b,     /* (I) b Vector */
@@ -109,7 +109,7 @@
     silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP( &L[ 0 ][ 0 ], M, T, x );
 }
 
-void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP(
+static inline void silk_SolveWithUpperTriangularFromLowerWdiagOnes_FLP(
     const silk_float     *L,     /* (I) Pointer to Lower Triangular Matrix */
     opus_int             M,      /* (I) Dim of Matrix equation */
     const silk_float     *b,     /* (I) b Vector */
@@ -131,7 +131,7 @@
     }
 }
 
-void silk_SolveWithLowerTriangularWdiagOnes_FLP(
+static inline void silk_SolveWithLowerTriangularWdiagOnes_FLP(
     const silk_float     *L,     /* (I) Pointer to Lower Triangular Matrix */
     opus_int             M,      /* (I) Dim of Matrix equation */
     const silk_float     *b,     /* (I) b Vector */
@@ -153,7 +153,7 @@
     }
 }
 
-void silk_LDL_FLP(
+static inline void silk_LDL_FLP(
     silk_float           *A,      /* (I/O) Pointer to Symetric Square Matrix */
     opus_int             M,       /* (I) Size of Matrix */
     silk_float           *L,      /* (I/O) Pointer to Square Upper triangular Matrix */
--- a/silk/main.h
+++ b/silk/main.h
@@ -268,12 +268,6 @@
     silk_VAD_state              *psSilk_VAD         /* I/O  Pointer to Silk VAD state                   */
 );
 
-/* Silk VAD noise level estimation */
-void silk_VAD_GetNoiseLevels(
-    const opus_int32             pX[ VAD_N_BANDS ],  /* I    subband energies                            */
-    silk_VAD_state              *psSilk_VAD         /* I/O  Pointer to Silk VAD state                   */
-);
-
 /* Get 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                               */
--- a/silk/resampler.c
+++ b/silk/resampler.c
@@ -141,18 +141,6 @@
     return 0;
 }
 
-/* Clear the states of all resampling filters, without resetting sampling rate ratio */
-opus_int silk_resampler_clear(
-    silk_resampler_state_struct    *S            /* I/O: Resampler state             */
-)
-{
-    /* Clear state */
-    silk_memset( S->sDown2, 0, sizeof( S->sDown2 ) );
-    silk_memset( S->sIIR,   0, sizeof( S->sIIR ) );
-    silk_memset( S->sFIR,   0, sizeof( S->sFIR ) );
-    return 0;
-}
-
 /* Resampler: convert from one sampling rate to another                                 */
 opus_int silk_resampler(
     silk_resampler_state_struct    *S,                    /* I/O: Resampler state             */