Reformatting changes with an update to the MSVC project files
[opus.git] / silk / fixed / structs_FIX.h
1 /***********************************************************************
2 Copyright (c) 2006-2011, Skype Limited. All rights reserved.
3 Redistribution and use in source and binary forms, with or without
4 modification, (subject to the limitations in the disclaimer below)
5 are permitted provided that the following conditions are met:
6 - Redistributions of source code must retain the above copyright notice,
7 this list of conditions and the following disclaimer.
8 - Redistributions in binary form must reproduce the above copyright
9 notice, this list of conditions and the following disclaimer in the
10 documentation and/or other materials provided with the distribution.
11 - Neither the name of Skype Limited, nor the names of specific
12 contributors, may be used to endorse or promote products derived from
13 this software without specific prior written permission.
14 NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***********************************************************************/
27
28 #ifndef SILK_STRUCTS_FIX_H
29 #define SILK_STRUCTS_FIX_H
30
31 #include "typedef.h"
32 #include "main.h"
33 #include "structs.h"
34
35 #ifdef __cplusplus
36 extern "C"
37 {
38 #endif
39
40 /********************************/
41 /* Noise shaping analysis state */
42 /********************************/
43 typedef struct {
44     opus_int8                   LastGainIndex;
45     opus_int32                  HarmBoost_smth_Q16;
46     opus_int32                  HarmShapeGain_smth_Q16;
47     opus_int32                  Tilt_smth_Q16;
48 } silk_shape_state_FIX;
49
50 /********************************/
51 /* Prefilter state              */
52 /********************************/
53 typedef struct {
54     opus_int16                  sLTP_shp[ LTP_BUF_LENGTH ];
55     opus_int32                  sAR_shp[ MAX_SHAPE_LPC_ORDER + 1 ];
56     opus_int                    sLTP_shp_buf_idx;
57     opus_int32                  sLF_AR_shp_Q12;
58     opus_int32                  sLF_MA_shp_Q12;
59     opus_int                    sHarmHP;
60     opus_int32                  rand_seed;
61     opus_int                    lagPrev;
62 } silk_prefilter_state_FIX;
63
64 /********************************/
65 /* Encoder state FIX            */
66 /********************************/
67 typedef struct {
68     silk_encoder_state          sCmn;                                   /* Common struct, shared with floating-point code       */
69     silk_shape_state_FIX        sShape;                                 /* Shape state                                          */
70     silk_prefilter_state_FIX    sPrefilt;                               /* Prefilter State                                      */
71
72     /* Buffer for find pitch and noise shape analysis */
73     silk_DWORD_ALIGN opus_int16 x_buf[ 2 * MAX_FRAME_LENGTH + LA_SHAPE_MAX ];/* Buffer for find pitch and noise shape analysis  */
74     opus_int                    LTPCorr_Q15;                            /* Normalized correlation from pitch lag estimator      */
75
76     /* Parameters For LTP scaling Control */
77     opus_int                    prevLTPredCodGain_Q7;
78     opus_int                    HPLTPredCodGain_Q7;
79 } silk_encoder_state_FIX;
80
81 /************************/
82 /* Encoder control FIX  */
83 /************************/
84 typedef struct {
85     /* Prediction and coding parameters */
86     opus_int32                  Gains_Q16[ MAX_NB_SUBFR ];
87     silk_DWORD_ALIGN opus_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ];
88     opus_int16                  LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ];
89     opus_int                    LTP_scale_Q14;
90     opus_int                    pitchL[ MAX_NB_SUBFR ];
91
92     /* Noise shaping parameters */
93     /* Testing */
94     silk_DWORD_ALIGN opus_int16 AR1_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ];
95     silk_DWORD_ALIGN opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ];
96     opus_int32                  LF_shp_Q14[        MAX_NB_SUBFR ];      /* Packs two int16 coefficients per int32 value         */
97     opus_int                    GainsPre_Q14[      MAX_NB_SUBFR ];
98     opus_int                    HarmBoost_Q14[     MAX_NB_SUBFR ];
99     opus_int                    Tilt_Q14[          MAX_NB_SUBFR ];
100     opus_int                    HarmShapeGain_Q14[ MAX_NB_SUBFR ];
101     opus_int                    Lambda_Q10;
102     opus_int                    input_quality_Q14;
103     opus_int                    coding_quality_Q14;
104
105     /* measures */
106     opus_int                    sparseness_Q8;
107     opus_int32                  predGain_Q16;
108     opus_int                    LTPredCodGain_Q7;
109     opus_int32                  ResNrg[ MAX_NB_SUBFR ];                 /* Residual energy per subframe                         */
110     opus_int                    ResNrgQ[ MAX_NB_SUBFR ];                /* Q domain for the residual energy > 0                 */
111
112     /* Parameters for CBR mode */
113     opus_int32                  GainsUnq_Q16[ MAX_NB_SUBFR ];
114     opus_int8                   lastGainIndexPrev;
115 } silk_encoder_control_FIX;
116
117 /************************/
118 /* Encoder Super Struct */
119 /************************/
120 typedef struct {
121     silk_encoder_state_FIX      state_Fxx[ ENCODER_NUM_CHANNELS ];
122     stereo_enc_state            sStereo;
123     opus_int32                  nBitsExceeded;
124     opus_int                    nChannelsAPI;
125     opus_int                    nChannelsInternal;
126     opus_int                    nPrevChannelsInternal;
127     opus_int                    timeSinceSwitchAllowed_ms;
128     opus_int                    allowBandwidthSwitch;
129     opus_int                    prev_decode_only_middle;
130 } silk_encoder;
131
132
133 #ifdef __cplusplus
134 }
135 #endif
136
137 #endif