Add minimal doxygen markup to the public headers.
[opus.git] / silk / silk_structs.h
index 78bb98a..854d0cd 100644 (file)
-/***********************************************************************\r
-Copyright (c) 2006-2011, Skype Limited. All rights reserved. \r
-Redistribution and use in source and binary forms, with or without \r
-modification, (subject to the limitations in the disclaimer below) \r
-are permitted provided that the following conditions are met:\r
-- Redistributions of source code must retain the above copyright notice,\r
-this list of conditions and the following disclaimer.\r
-- Redistributions in binary form must reproduce the above copyright \r
-notice, this list of conditions and the following disclaimer in the \r
-documentation and/or other materials provided with the distribution.\r
-- Neither the name of Skype Limited, nor the names of specific \r
-contributors, may be used to endorse or promote products derived from \r
-this software without specific prior written permission.\r
-NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED \r
-BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND \r
-CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,\r
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND \r
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE \r
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, \r
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF \r
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON \r
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \r
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE \r
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-***********************************************************************/\r
-\r
-#ifndef SILK_STRUCTS_H\r
-#define SILK_STRUCTS_H\r
-\r
-#ifdef HAVE_CONFIG_H\r
-#include "config.h"\r
-#endif\r
-\r
-#include "silk_typedef.h"\r
-#include "silk_SigProc_FIX.h"\r
-#include "silk_define.h"\r
-#include "entenc.h"\r
-#include "entdec.h"\r
-\r
-#ifdef __cplusplus\r
-extern "C"\r
-{\r
-#endif\r
-\r
-/************************************/\r
-/* Noise shaping quantization state */\r
-/************************************/\r
-typedef struct {\r
-    SKP_int16   xq[           2 * MAX_FRAME_LENGTH ]; /* Buffer for quantized output signal */\r
-    SKP_int32   sLTP_shp_Q10[ 2 * MAX_FRAME_LENGTH ];\r
-    SKP_int32   sLPC_Q14[ MAX_SUB_FRAME_LENGTH + NSQ_LPC_BUF_LENGTH ];\r
-    SKP_int32   sAR2_Q14[ MAX_SHAPE_LPC_ORDER ];\r
-    SKP_int32   sLF_AR_shp_Q12;\r
-    SKP_int     lagPrev;\r
-    SKP_int     sLTP_buf_idx;\r
-    SKP_int     sLTP_shp_buf_idx;\r
-    SKP_int32   rand_seed;\r
-    SKP_int32   prev_inv_gain_Q16;\r
-    SKP_int     rewhite_flag;\r
-} silk_nsq_state;\r
-\r
-/********************************/\r
-/* VAD state                    */\r
-/********************************/\r
-typedef struct {\r
-    SKP_int32   AnaState[ 2 ];                  /* Analysis filterbank state: 0-8 kHz                       */\r
-    SKP_int32   AnaState1[ 2 ];                 /* Analysis filterbank state: 0-4 kHz                       */\r
-    SKP_int32   AnaState2[ 2 ];                 /* Analysis filterbank state: 0-2 kHz                       */\r
-    SKP_int32   XnrgSubfr[ VAD_N_BANDS ];       /* Subframe energies                                        */\r
-    SKP_int32   NrgRatioSmth_Q8[ VAD_N_BANDS ]; /* Smoothed energy level in each band                       */\r
-    SKP_int16   HPstate;                        /* State of differentiator in the lowest band               */\r
-    SKP_int32   NL[ VAD_N_BANDS ];              /* Noise energy level in each band                          */\r
-    SKP_int32   inv_NL[ VAD_N_BANDS ];          /* Inverse noise energy level in each band                  */\r
-    SKP_int32   NoiseLevelBias[ VAD_N_BANDS ];  /* Noise level estimator bias/offset                        */\r
-    SKP_int32   counter;                        /* Frame counter used in the initial phase                  */\r
-} silk_VAD_state;\r
-\r
-/* Variable cut-off low-pass filter state */\r
-typedef struct {\r
-    SKP_int32                   In_LP_State[ 2 ];           /* Low pass filter state */\r
-    SKP_int32                   transition_frame_no;        /* Counter which is mapped to a cut-off frequency */\r
-    SKP_int                     mode;                       /* Operating mode, <0: switch down, >0: switch up; 0: do nothing */\r
-} silk_LP_state;\r
-\r
-/* Structure containing NLSF codebook */\r
-typedef struct {\r
-    const SKP_int16             nVectors;\r
-    const SKP_int16             order;\r
-    const SKP_int16             quantStepSize_Q16;\r
-    const SKP_int16             invQuantStepSize_Q6;\r
-    const SKP_uint8             *CB1_NLSF_Q8;\r
-    const SKP_uint8             *CB1_iCDF;\r
-    const SKP_uint8             *pred_Q8;\r
-    const SKP_uint8             *ec_sel;\r
-    const SKP_uint8             *ec_iCDF;\r
-    const SKP_uint8             *ec_Rates_Q5;\r
-    const SKP_int16             *deltaMin_Q15;\r
-} silk_NLSF_CB_struct;\r
-\r
-typedef struct {\r
-    SKP_int16                   pred_prev_Q13[ 2 ];\r
-    SKP_int16                   sMid[ 2 ];\r
-    SKP_int16                   sSide[ 2 ];\r
-    SKP_int32                   mid_side_amp_Q0[ 4 ];\r
-    SKP_int16                   smth_width_Q14;\r
-    SKP_int16                   width_prev_Q14;\r
-    SKP_int8                    ix[ MAX_FRAMES_PER_PACKET ][ 2 ][ 4 ];\r
-} stereo_enc_state;\r
-\r
-typedef struct {\r
-    SKP_int16                   pred_prev_Q13[ 2 ];\r
-    SKP_int16                   sMid[ 2 ];\r
-    SKP_int16                   sSide[ 2 ];\r
-} stereo_dec_state;\r
-\r
-typedef struct {\r
-    SKP_int8                    GainsIndices[ MAX_NB_SUBFR ];\r
-    SKP_int8                    LTPIndex[ MAX_NB_SUBFR ];\r
-    SKP_int8                    NLSFIndices[ MAX_LPC_ORDER + 1 ];\r
-    SKP_int16                   lagIndex;\r
-    SKP_int8                    contourIndex;\r
-    SKP_int8                    signalType;\r
-    SKP_int8                    quantOffsetType;\r
-    SKP_int8                    NLSFInterpCoef_Q2;\r
-    SKP_int8                    PERIndex;\r
-    SKP_int8                    LTP_scaleIndex;\r
-    SKP_int8                    Seed;\r
-} SideInfoIndices;\r
-\r
-/********************************/\r
-/* Encoder state                */\r
-/********************************/\r
-typedef struct {\r
-    SKP_int32                       In_HP_State[ 2 ];               /* High pass filter state                                               */\r
-    SKP_int32                       variable_HP_smth1_Q15;          /* State of first smoother                                              */\r
-    SKP_int32                       variable_HP_smth2_Q15;          /* State of second smoother                                             */\r
-    SKP_int                         HP_cutoff_Hz;                   /* Fixed cutoff frequency (if zero: adaptive)                           */\r
-    silk_LP_state                   sLP;                            /* Low pass filter state                                                */\r
-    silk_VAD_state                  sVAD;                           /* Voice activity detector state                                        */\r
-    silk_nsq_state                  sNSQ;                           /* Noise Shape Quantizer State                                          */\r
-    SKP_int16                       prev_NLSFq_Q15[ MAX_LPC_ORDER ];/* Previously quantized NLSF vector                                     */\r
-    SKP_int                         speech_activity_Q8;             /* Speech activity                                                      */\r
-    SKP_int                         allow_bandwidth_switch;         /* Flag indicating that switching of internal bandwidth is allowed      */\r
-    SKP_int8                        LBRRprevLastGainIndex;\r
-    SKP_int8                        prevSignalType;\r
-    SKP_int                         prevLag;\r
-    SKP_int                         pitch_LPC_win_length;\r
-    SKP_int                         max_pitch_lag;                  /* Highest possible pitch lag (samples)                                 */\r
-    SKP_int32                       API_fs_Hz;                      /* API sampling frequency (Hz)                                          */\r
-    SKP_int32                       prev_API_fs_Hz;                 /* Previous API sampling frequency (Hz)                                 */\r
-    SKP_int                         maxInternal_fs_Hz;              /* Maximum internal sampling frequency (Hz)                             */\r
-    SKP_int                         minInternal_fs_Hz;              /* Minimum internal sampling frequency (Hz)                             */\r
-    SKP_int                         desiredInternal_fs_Hz;          /* Soft request for internal sampling frequency (Hz)                    */\r
-    SKP_int                         fs_kHz;                         /* Internal sampling frequency (kHz)                                    */\r
-    SKP_int                         nb_subfr;                       /* Number of 5 ms subframes in a frame                                  */\r
-    SKP_int                         frame_length;                   /* Frame length (samples)                                               */\r
-    SKP_int                         subfr_length;                   /* Subframe length (samples)                                            */\r
-    SKP_int                         ltp_mem_length;                 /* Length of LTP memory                                                 */\r
-    SKP_int                         la_pitch;                       /* Look-ahead for pitch analysis (samples)                              */\r
-    SKP_int                         la_shape;                       /* Look-ahead for noise shape analysis (samples)                        */\r
-    SKP_int                         shapeWinLength;                 /* Window length for noise shape analysis (samples)                     */\r
-    SKP_int32                       TargetRate_bps;                 /* Target bitrate (bps)                                                 */\r
-    SKP_int                         PacketSize_ms;                  /* Number of milliseconds to put in each packet                         */\r
-    SKP_int                         PacketLoss_perc;                /* Packet loss rate measured by farend                                  */\r
-    SKP_int32                       frameCounter;\r
-    SKP_int                         Complexity;                     /* Complexity setting                                                   */\r
-    SKP_int                         nStatesDelayedDecision;         /* Number of states in delayed decision quantization                    */\r
-    SKP_int                         useInterpolatedNLSFs;           /* Flag for using NLSF interpolation                                    */\r
-    SKP_int                         shapingLPCOrder;                /* Filter order for noise shaping filters                               */\r
-    SKP_int                         predictLPCOrder;                /* Filter order for prediction filters                                  */\r
-    SKP_int                         pitchEstimationComplexity;      /* Complexity level for pitch estimator                                 */\r
-    SKP_int                         pitchEstimationLPCOrder;        /* Whitening filter order for pitch estimator                           */\r
-    SKP_int32                       pitchEstimationThreshold_Q16;   /* Threshold for pitch estimator                                        */\r
-    SKP_int                         LTPQuantLowComplexity;          /* Flag for low complexity LTP quantization                             */\r
-    SKP_int                         mu_LTP_Q9;                      /* Rate-distortion tradeoff in LTP quantization                         */\r
-    SKP_int                         NLSF_MSVQ_Survivors;            /* Number of survivors in NLSF MSVQ                                     */\r
-    SKP_int                         first_frame_after_reset;        /* Flag for deactivating NLSF interp. and fluc. reduction after resets  */\r
-    SKP_int                         controlled_since_last_payload;  /* Flag for ensuring codec_control only runs once per packet            */\r
-       SKP_int                         warping_Q16;                    /* Warping parameter for warped noise shaping                           */\r
-    SKP_int                         useCBR;                         /* Flag to enable constant bitrate                                      */\r
-    SKP_int                         prefillFlag;                    /* Flag to indicate that only buffers are prefilled, no coding          */\r
-    const SKP_uint8                 *pitch_lag_low_bits_iCDF;       /* Pointer to iCDF table for low bits of pitch lag index                */\r
-    const SKP_uint8                 *pitch_contour_iCDF;            /* Pointer to iCDF table for pitch contour index                        */\r
-    const silk_NLSF_CB_struct       *psNLSF_CB;                     /* Pointer to NLSF codebook                                             */\r
-    SKP_int                         input_quality_bands_Q15[ VAD_N_BANDS ];\r
-    SKP_int                         input_tilt_Q15;\r
-    SKP_int                         SNR_dB_Q7;                      /* Quality setting                                                      */\r
-\r
-    SKP_int8                        VAD_flags[ MAX_FRAMES_PER_PACKET ];\r
-    SKP_int8                        LBRR_flag;\r
-    SKP_int                         LBRR_flags[ MAX_FRAMES_PER_PACKET ];\r
-\r
-    SideInfoIndices                 indices;\r
-       SKP_int8                        pulses[ MAX_FRAME_LENGTH ];\r
-\r
-    /* Input/output buffering */\r
-    SKP_int16                       inputBuf__[ MAX_FRAME_LENGTH + 2 ]; /* Buffer containing input signal                                   */\r
-    SKP_int16                       *inputBuf;                      /* Points to second element of above buffer                             */\r
-    SKP_int                         inputBufIx;\r
-    SKP_int                         nFramesPerPacket;\r
-    SKP_int                         nFramesEncoded;                 /* Number of frames analyzed in current packet                          */\r
-\r
-    SKP_int                         nChannelsAPI;\r
-    SKP_int                         nChannelsInternal;\r
-    SKP_int                         channelNb;\r
-\r
-    /* Parameters For LTP scaling Control */\r
-    SKP_int                         frames_since_onset;\r
-\r
-    /* Specifically for entropy coding */\r
-    SKP_int                         ec_prevSignalType;\r
-    SKP_int16                       ec_prevLagIndex;\r
-\r
-    silk_resampler_state_struct resampler_state;\r
-\r
-    /* DTX */\r
-    SKP_int                         useDTX;                         /* Flag to enable DTX                                                   */\r
-    SKP_int                         inDTX;                          /* Flag to signal DTX period                                            */\r
-    SKP_int                         noSpeechCounter;                /* Counts concecutive nonactive frames, used by DTX                     */\r
-\r
-    /* Inband Low Bitrate Redundancy (LBRR) data */ \r
-    SKP_int                         useInBandFEC;                   /* Saves the API setting for query                                      */\r
-    SKP_int                         LBRR_enabled;                   /* Depends on useInBandFRC, bitrate and packet loss rate                */\r
-    SKP_int                         LBRR_GainIncreases;             /* Gains increment for coding LBRR frames                               */\r
-    SideInfoIndices                 indices_LBRR[ MAX_FRAMES_PER_PACKET ];\r
-       SKP_int8                        pulses_LBRR[ MAX_FRAMES_PER_PACKET ][ MAX_FRAME_LENGTH ];\r
-} silk_encoder_state;\r
-\r
-\r
-/* Struct for Packet Loss Concealment */\r
-typedef struct {\r
-    SKP_int32   pitchL_Q8;                      /* Pitch lag to use for voiced concealment                  */\r
-    SKP_int16   LTPCoef_Q14[ LTP_ORDER ];       /* LTP coeficients to use for voiced concealment            */\r
-    SKP_int16   prevLPC_Q12[ MAX_LPC_ORDER ];\r
-    SKP_int     last_frame_lost;                /* Was previous frame lost                                  */\r
-    SKP_int32   rand_seed;                      /* Seed for unvoiced signal generation                      */\r
-    SKP_int16   randScale_Q14;                  /* Scaling of unvoiced random signal                        */\r
-    SKP_int32   conc_energy;\r
-    SKP_int     conc_energy_shift;\r
-    SKP_int16   prevLTP_scale_Q14;\r
-    SKP_int32   prevGain_Q16[ MAX_NB_SUBFR ];\r
-    SKP_int     fs_kHz;\r
-} silk_PLC_struct;\r
-\r
-/* Struct for CNG */\r
-typedef struct {\r
-    SKP_int32   CNG_exc_buf_Q10[ MAX_FRAME_LENGTH ];\r
-    SKP_int16   CNG_smth_NLSF_Q15[ MAX_LPC_ORDER ];\r
-    SKP_int32   CNG_synth_state[ MAX_LPC_ORDER ];\r
-    SKP_int32   CNG_smth_Gain_Q16;\r
-    SKP_int32   rand_seed;\r
-    SKP_int     fs_kHz;\r
-} silk_CNG_struct;\r
-\r
-/********************************/\r
-/* Decoder state                */\r
-/********************************/\r
-typedef struct {\r
-    SKP_int32       prev_inv_gain_Q16;\r
-    SKP_int32       sLTP_Q16[ 2 * MAX_FRAME_LENGTH ];\r
-    SKP_int32       sLPC_Q14[ MAX_SUB_FRAME_LENGTH + MAX_LPC_ORDER ];\r
-    SKP_int32       exc_Q10[ MAX_FRAME_LENGTH ];\r
-    SKP_int16       outBuf[ 2 * MAX_FRAME_LENGTH ];             /* Buffer for output signal                                             */\r
-    SKP_int         lagPrev;                                    /* Previous Lag                                                         */\r
-    SKP_int8        LastGainIndex;                              /* Previous gain index                                                  */\r
-    SKP_int         fs_kHz;                                     /* Sampling frequency in kHz                                            */\r
-    SKP_int32       prev_API_sampleRate;                        /* Previous API sample frequency (Hz)                                   */\r
-    SKP_int         nb_subfr;                                   /* Number of 5 ms subframes in a frame                                  */\r
-    SKP_int         frame_length;                               /* Frame length (samples)                                               */\r
-    SKP_int         subfr_length;                               /* Subframe length (samples)                                            */\r
-    SKP_int         ltp_mem_length;                             /* Length of LTP memory                                                 */\r
-    SKP_int         LPC_order;                                  /* LPC order                                                            */\r
-    SKP_int16       prevNLSF_Q15[ MAX_LPC_ORDER ];              /* Used to interpolate LSFs                                             */\r
-    SKP_int         first_frame_after_reset;                    /* Flag for deactivating NLSF interp. and fluc. reduction after resets  */\r
-    const SKP_uint8 *pitch_lag_low_bits_iCDF;                   /* Pointer to iCDF table for low bits of pitch lag index                */\r
-    const SKP_uint8 *pitch_contour_iCDF;                        /* Pointer to iCDF table for pitch contour index                        */\r
-\r
-    /* For buffering payload in case of more frames per packet */\r
-    SKP_int         nFramesDecoded;\r
-    SKP_int         nFramesPerPacket;\r
-\r
-    /* Specifically for entropy coding */\r
-    SKP_int         ec_prevSignalType;\r
-    SKP_int16       ec_prevLagIndex;\r
-\r
-    SKP_int         VAD_flags[ MAX_FRAMES_PER_PACKET ];\r
-    SKP_int         LBRR_flag;\r
-    SKP_int         LBRR_flags[ MAX_FRAMES_PER_PACKET ];\r
-\r
-    silk_resampler_state_struct resampler_state;\r
-\r
-    const silk_NLSF_CB_struct   *psNLSF_CB;                 /* Pointer to NLSF codebook                                             */\r
-\r
-    /* Quantization indices */\r
-    SideInfoIndices indices;\r
-    \r
-    /* CNG state */\r
-    silk_CNG_struct sCNG;\r
-\r
-    /* Stuff used for PLC */\r
-    SKP_int         lossCnt;\r
-    SKP_int         prevSignalType;\r
-\r
-    silk_PLC_struct sPLC;\r
-\r
-} silk_decoder_state;\r
-\r
-/************************/\r
-/* Decoder control      */\r
-/************************/\r
-typedef struct {\r
-    /* prediction and coding parameters */\r
-    SKP_int             pitchL[ MAX_NB_SUBFR ];\r
-    SKP_int32           Gains_Q16[ MAX_NB_SUBFR ];\r
-    /* holds interpolated and final coefficients, 4-byte aligned */\r
-    SKP_DWORD_ALIGN SKP_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ];\r
-    SKP_int16           LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ];\r
-    SKP_int             LTP_scale_Q14;\r
-} silk_decoder_control;\r
-\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif\r
+/***********************************************************************
+Copyright (c) 2006-2011, Skype Limited. All rights reserved.
+Redistribution and use in source and binary forms, with or without
+modification, (subject to the limitations in the disclaimer below)
+are permitted provided that the following conditions are met:
+- Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+- Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+- Neither the name of Skype Limited, nor the names of specific
+contributors, may be used to endorse or promote products derived from
+this software without specific prior written permission.
+NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
+BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+***********************************************************************/
+
+#ifndef SILK_STRUCTS_H
+#define SILK_STRUCTS_H
+
+#include "silk_typedef.h"
+#include "silk_SigProc_FIX.h"
+#include "silk_define.h"
+#include "entenc.h"
+#include "entdec.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/************************************/
+/* Noise shaping quantization state */
+/************************************/
+typedef struct {
+    opus_int16   xq[           2 * MAX_FRAME_LENGTH ]; /* Buffer for quantized output signal */
+    opus_int32   sLTP_shp_Q10[ 2 * MAX_FRAME_LENGTH ];
+    opus_int32   sLPC_Q14[ MAX_SUB_FRAME_LENGTH + NSQ_LPC_BUF_LENGTH ];
+    opus_int32   sAR2_Q14[ MAX_SHAPE_LPC_ORDER ];
+    opus_int32   sLF_AR_shp_Q12;
+    opus_int     lagPrev;
+    opus_int     sLTP_buf_idx;
+    opus_int     sLTP_shp_buf_idx;
+    opus_int32   rand_seed;
+    opus_int32   prev_inv_gain_Q16;
+    opus_int     rewhite_flag;
+} silk_nsq_state;
+
+/********************************/
+/* VAD state                    */
+/********************************/
+typedef struct {
+    opus_int32   AnaState[ 2 ];                  /* Analysis filterbank state: 0-8 kHz                       */
+    opus_int32   AnaState1[ 2 ];                 /* Analysis filterbank state: 0-4 kHz                       */
+    opus_int32   AnaState2[ 2 ];                 /* Analysis filterbank state: 0-2 kHz                       */
+    opus_int32   XnrgSubfr[ VAD_N_BANDS ];       /* Subframe energies                                        */
+    opus_int32   NrgRatioSmth_Q8[ VAD_N_BANDS ]; /* Smoothed energy level in each band                       */
+    opus_int16   HPstate;                        /* State of differentiator in the lowest band               */
+    opus_int32   NL[ VAD_N_BANDS ];              /* Noise energy level in each band                          */
+    opus_int32   inv_NL[ VAD_N_BANDS ];          /* Inverse noise energy level in each band                  */
+    opus_int32   NoiseLevelBias[ VAD_N_BANDS ];  /* Noise level estimator bias/offset                        */
+    opus_int32   counter;                        /* Frame counter used in the initial phase                  */
+} silk_VAD_state;
+
+/* Variable cut-off low-pass filter state */
+typedef struct {
+    opus_int32                   In_LP_State[ 2 ];           /* Low pass filter state */
+    opus_int32                   transition_frame_no;        /* Counter which is mapped to a cut-off frequency */
+    opus_int                     mode;                       /* Operating mode, <0: switch down, >0: switch up; 0: do nothing */
+} silk_LP_state;
+
+/* Structure containing NLSF codebook */
+typedef struct {
+    const opus_int16             nVectors;
+    const opus_int16             order;
+    const opus_int16             quantStepSize_Q16;
+    const opus_int16             invQuantStepSize_Q6;
+    const opus_uint8             *CB1_NLSF_Q8;
+    const opus_uint8             *CB1_iCDF;
+    const opus_uint8             *pred_Q8;
+    const opus_uint8             *ec_sel;
+    const opus_uint8             *ec_iCDF;
+    const opus_uint8             *ec_Rates_Q5;
+    const opus_int16             *deltaMin_Q15;
+} silk_NLSF_CB_struct;
+
+typedef struct {
+    opus_int16                   pred_prev_Q13[ 2 ];
+    opus_int16                   sMid[ 2 ];
+    opus_int16                   sSide[ 2 ];
+    opus_int32                   mid_side_amp_Q0[ 4 ];
+    opus_int16                   smth_width_Q14;
+    opus_int16                   width_prev_Q14;
+    opus_int8                    predIx[ MAX_FRAMES_PER_PACKET ][ 2 ][ 3 ];
+    opus_int8                    mid_only_flags[ MAX_FRAMES_PER_PACKET ];
+} stereo_enc_state;
+
+typedef struct {
+    opus_int16                   pred_prev_Q13[ 2 ];
+    opus_int16                   sMid[ 2 ];
+    opus_int16                   sSide[ 2 ];
+} stereo_dec_state;
+
+typedef struct {
+    opus_int8                    GainsIndices[ MAX_NB_SUBFR ];
+    opus_int8                    LTPIndex[ MAX_NB_SUBFR ];
+    opus_int8                    NLSFIndices[ MAX_LPC_ORDER + 1 ];
+    opus_int16                   lagIndex;
+    opus_int8                    contourIndex;
+    opus_int8                    signalType;
+    opus_int8                    quantOffsetType;
+    opus_int8                    NLSFInterpCoef_Q2;
+    opus_int8                    PERIndex;
+    opus_int8                    LTP_scaleIndex;
+    opus_int8                    Seed;
+} SideInfoIndices;
+
+/********************************/
+/* Encoder state                */
+/********************************/
+typedef struct {
+    opus_int32                       In_HP_State[ 2 ];               /* High pass filter state                                               */
+    opus_int32                       variable_HP_smth1_Q15;          /* State of first smoother                                              */
+    opus_int32                       variable_HP_smth2_Q15;          /* State of second smoother                                             */
+    silk_LP_state                   sLP;                            /* Low pass filter state                                                */
+    silk_VAD_state                  sVAD;                           /* Voice activity detector state                                        */
+    silk_nsq_state                  sNSQ;                           /* Noise Shape Quantizer State                                          */
+    opus_int16                       prev_NLSFq_Q15[ MAX_LPC_ORDER ];/* Previously quantized NLSF vector                                     */
+    opus_int                         speech_activity_Q8;             /* Speech activity                                                      */
+    opus_int                         allow_bandwidth_switch;         /* Flag indicating that switching of internal bandwidth is allowed      */
+    opus_int8                        LBRRprevLastGainIndex;
+    opus_int8                        prevSignalType;
+    opus_int                         prevLag;
+    opus_int                         pitch_LPC_win_length;
+    opus_int                         max_pitch_lag;                  /* Highest possible pitch lag (samples)                                 */
+    opus_int32                       API_fs_Hz;                      /* API sampling frequency (Hz)                                          */
+    opus_int32                       prev_API_fs_Hz;                 /* Previous API sampling frequency (Hz)                                 */
+    opus_int                         maxInternal_fs_Hz;              /* Maximum internal sampling frequency (Hz)                             */
+    opus_int                         minInternal_fs_Hz;              /* Minimum internal sampling frequency (Hz)                             */
+    opus_int                         desiredInternal_fs_Hz;          /* Soft request for internal sampling frequency (Hz)                    */
+    opus_int                         fs_kHz;                         /* Internal sampling frequency (kHz)                                    */
+    opus_int                         nb_subfr;                       /* Number of 5 ms subframes in a frame                                  */
+    opus_int                         frame_length;                   /* Frame length (samples)                                               */
+    opus_int                         subfr_length;                   /* Subframe length (samples)                                            */
+    opus_int                         ltp_mem_length;                 /* Length of LTP memory                                                 */
+    opus_int                         la_pitch;                       /* Look-ahead for pitch analysis (samples)                              */
+    opus_int                         la_shape;                       /* Look-ahead for noise shape analysis (samples)                        */
+    opus_int                         shapeWinLength;                 /* Window length for noise shape analysis (samples)                     */
+    opus_int32                       TargetRate_bps;                 /* Target bitrate (bps)                                                 */
+    opus_int                         PacketSize_ms;                  /* Number of milliseconds to put in each packet                         */
+    opus_int                         PacketLoss_perc;                /* Packet loss rate measured by farend                                  */
+    opus_int32                       frameCounter;
+    opus_int                         Complexity;                     /* Complexity setting                                                   */
+    opus_int                         nStatesDelayedDecision;         /* Number of states in delayed decision quantization                    */
+    opus_int                         useInterpolatedNLSFs;           /* Flag for using NLSF interpolation                                    */
+    opus_int                         shapingLPCOrder;                /* Filter order for noise shaping filters                               */
+    opus_int                         predictLPCOrder;                /* Filter order for prediction filters                                  */
+    opus_int                         pitchEstimationComplexity;      /* Complexity level for pitch estimator                                 */
+    opus_int                         pitchEstimationLPCOrder;        /* Whitening filter order for pitch estimator                           */
+    opus_int32                       pitchEstimationThreshold_Q16;   /* Threshold for pitch estimator                                        */
+    opus_int                         LTPQuantLowComplexity;          /* Flag for low complexity LTP quantization                             */
+    opus_int                         mu_LTP_Q9;                      /* Rate-distortion tradeoff in LTP quantization                         */
+    opus_int                         NLSF_MSVQ_Survivors;            /* Number of survivors in NLSF MSVQ                                     */
+    opus_int                         first_frame_after_reset;        /* Flag for deactivating NLSF interp. and fluc. reduction after resets  */
+    opus_int                         controlled_since_last_payload;  /* Flag for ensuring codec_control only runs once per packet            */
+    opus_int                         warping_Q16;                    /* Warping parameter for warped noise shaping                           */
+    opus_int                         useCBR;                         /* Flag to enable constant bitrate                                      */
+    opus_int                         prefillFlag;                    /* Flag to indicate that only buffers are prefilled, no coding          */
+    const opus_uint8                 *pitch_lag_low_bits_iCDF;       /* Pointer to iCDF table for low bits of pitch lag index                */
+    const opus_uint8                 *pitch_contour_iCDF;            /* Pointer to iCDF table for pitch contour index                        */
+    const silk_NLSF_CB_struct       *psNLSF_CB;                     /* Pointer to NLSF codebook                                             */
+    opus_int                         input_quality_bands_Q15[ VAD_N_BANDS ];
+    opus_int                         input_tilt_Q15;
+    opus_int                         SNR_dB_Q7;                      /* Quality setting                                                      */
+
+    opus_int8                        VAD_flags[ MAX_FRAMES_PER_PACKET ];
+    opus_int8                        LBRR_flag;
+    opus_int                         LBRR_flags[ MAX_FRAMES_PER_PACKET ];
+
+    SideInfoIndices                 indices;
+    opus_int8                        pulses[ MAX_FRAME_LENGTH ];
+
+    /* Input/output buffering */
+    opus_int16                       inputBuf[ MAX_FRAME_LENGTH + 2 ]; /* Buffer containing input signal                                   */
+    opus_int                         inputBufIx;
+    opus_int                         nFramesPerPacket;
+    opus_int                         nFramesEncoded;                 /* Number of frames analyzed in current packet                          */
+
+    opus_int                         nChannelsAPI;
+    opus_int                         nChannelsInternal;
+    opus_int                         channelNb;
+
+    /* Parameters For LTP scaling Control */
+    opus_int                         frames_since_onset;
+
+    /* Specifically for entropy coding */
+    opus_int                         ec_prevSignalType;
+    opus_int16                       ec_prevLagIndex;
+
+    silk_resampler_state_struct resampler_state;
+
+    /* DTX */
+    opus_int                         useDTX;                         /* Flag to enable DTX                                                   */
+    opus_int                         inDTX;                          /* Flag to signal DTX period                                            */
+    opus_int                         noSpeechCounter;                /* Counts concecutive nonactive frames, used by DTX                     */
+
+    /* Inband Low Bitrate Redundancy (LBRR) data */
+    opus_int                         useInBandFEC;                   /* Saves the API setting for query                                      */
+    opus_int                         LBRR_enabled;                   /* Depends on useInBandFRC, bitrate and packet loss rate                */
+    opus_int                         LBRR_GainIncreases;             /* Gains increment for coding LBRR frames                               */
+    SideInfoIndices                 indices_LBRR[ MAX_FRAMES_PER_PACKET ];
+    opus_int8                        pulses_LBRR[ MAX_FRAMES_PER_PACKET ][ MAX_FRAME_LENGTH ];
+} silk_encoder_state;
+
+
+/* Struct for Packet Loss Concealment */
+typedef struct {
+    opus_int32   pitchL_Q8;                      /* Pitch lag to use for voiced concealment                  */
+    opus_int16   LTPCoef_Q14[ LTP_ORDER ];       /* LTP coeficients to use for voiced concealment            */
+    opus_int16   prevLPC_Q12[ MAX_LPC_ORDER ];
+    opus_int     last_frame_lost;                /* Was previous frame lost                                  */
+    opus_int32   rand_seed;                      /* Seed for unvoiced signal generation                      */
+    opus_int16   randScale_Q14;                  /* Scaling of unvoiced random signal                        */
+    opus_int32   conc_energy;
+    opus_int     conc_energy_shift;
+    opus_int16   prevLTP_scale_Q14;
+    opus_int32   prevGain_Q16[ MAX_NB_SUBFR ];
+    opus_int     fs_kHz;
+} silk_PLC_struct;
+
+/* Struct for CNG */
+typedef struct {
+    opus_int32   CNG_exc_buf_Q10[ MAX_FRAME_LENGTH ];
+    opus_int16   CNG_smth_NLSF_Q15[ MAX_LPC_ORDER ];
+    opus_int32   CNG_synth_state[ MAX_LPC_ORDER ];
+    opus_int32   CNG_smth_Gain_Q16;
+    opus_int32   rand_seed;
+    opus_int     fs_kHz;
+} silk_CNG_struct;
+
+/********************************/
+/* Decoder state                */
+/********************************/
+typedef struct {
+    opus_int32       prev_inv_gain_Q16;
+    opus_int32       sLTP_Q16[ 2 * MAX_FRAME_LENGTH ];
+    opus_int32       sLPC_Q14[ MAX_SUB_FRAME_LENGTH + MAX_LPC_ORDER ];
+    opus_int32       exc_Q10[ MAX_FRAME_LENGTH ];
+    opus_int16       outBuf[ 2 * MAX_FRAME_LENGTH ];             /* Buffer for output signal                                             */
+    opus_int         lagPrev;                                    /* Previous Lag                                                         */
+    opus_int8        LastGainIndex;                              /* Previous gain index                                                  */
+    opus_int         fs_kHz;                                     /* Sampling frequency in kHz                                            */
+    opus_int32       prev_API_sampleRate;                        /* Previous API sample frequency (Hz)                                   */
+    opus_int         nb_subfr;                                   /* Number of 5 ms subframes in a frame                                  */
+    opus_int         frame_length;                               /* Frame length (samples)                                               */
+    opus_int         subfr_length;                               /* Subframe length (samples)                                            */
+    opus_int         ltp_mem_length;                             /* Length of LTP memory                                                 */
+    opus_int         LPC_order;                                  /* LPC order                                                            */
+    opus_int16       prevNLSF_Q15[ MAX_LPC_ORDER ];              /* Used to interpolate LSFs                                             */
+    opus_int         first_frame_after_reset;                    /* Flag for deactivating NLSF interp. and fluc. reduction after resets  */
+    const opus_uint8 *pitch_lag_low_bits_iCDF;                   /* Pointer to iCDF table for low bits of pitch lag index                */
+    const opus_uint8 *pitch_contour_iCDF;                        /* Pointer to iCDF table for pitch contour index                        */
+
+    /* For buffering payload in case of more frames per packet */
+    opus_int         nFramesDecoded;
+    opus_int         nFramesPerPacket;
+
+    /* Specifically for entropy coding */
+    opus_int         ec_prevSignalType;
+    opus_int16       ec_prevLagIndex;
+
+    opus_int         VAD_flags[ MAX_FRAMES_PER_PACKET ];
+    opus_int         LBRR_flag;
+    opus_int         LBRR_flags[ MAX_FRAMES_PER_PACKET ];
+
+    silk_resampler_state_struct resampler_state;
+
+    const silk_NLSF_CB_struct   *psNLSF_CB;                 /* Pointer to NLSF codebook                                             */
+
+    /* Quantization indices */
+    SideInfoIndices indices;
+
+    /* CNG state */
+    silk_CNG_struct sCNG;
+
+    /* Stuff used for PLC */
+    opus_int         lossCnt;
+    opus_int         prevSignalType;
+
+    silk_PLC_struct sPLC;
+
+} silk_decoder_state;
+
+/************************/
+/* Decoder control      */
+/************************/
+typedef struct {
+    /* prediction and coding parameters */
+    opus_int             pitchL[ MAX_NB_SUBFR ];
+    opus_int32           Gains_Q16[ MAX_NB_SUBFR ];
+    /* holds interpolated and final coefficients, 4-byte aligned */
+    SKP_DWORD_ALIGN opus_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ];
+    opus_int16           LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ];
+    opus_int             LTP_scale_Q14;
+} silk_decoder_control;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif