cannam@154: /*********************************************************************** cannam@154: Copyright (c) 2006-2011, Skype Limited. All rights reserved. cannam@154: Redistribution and use in source and binary forms, with or without cannam@154: modification, are permitted provided that the following conditions cannam@154: are met: cannam@154: - Redistributions of source code must retain the above copyright notice, cannam@154: this list of conditions and the following disclaimer. cannam@154: - Redistributions in binary form must reproduce the above copyright cannam@154: notice, this list of conditions and the following disclaimer in the cannam@154: documentation and/or other materials provided with the distribution. cannam@154: - Neither the name of Internet Society, IETF or IETF Trust, nor the cannam@154: names of specific contributors, may be used to endorse or promote cannam@154: products derived from this software without specific prior written cannam@154: permission. cannam@154: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" cannam@154: AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE cannam@154: IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE cannam@154: ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE cannam@154: LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR cannam@154: CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF cannam@154: SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS cannam@154: INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN cannam@154: CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) cannam@154: ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE cannam@154: POSSIBILITY OF SUCH DAMAGE. cannam@154: ***********************************************************************/ cannam@154: cannam@154: #ifndef SILK_STRUCTS_FIX_H cannam@154: #define SILK_STRUCTS_FIX_H cannam@154: cannam@154: #include "typedef.h" cannam@154: #include "main.h" cannam@154: #include "structs.h" cannam@154: cannam@154: #ifdef __cplusplus cannam@154: extern "C" cannam@154: { cannam@154: #endif cannam@154: cannam@154: /********************************/ cannam@154: /* Noise shaping analysis state */ cannam@154: /********************************/ cannam@154: typedef struct { cannam@154: opus_int8 LastGainIndex; cannam@154: opus_int32 HarmBoost_smth_Q16; cannam@154: opus_int32 HarmShapeGain_smth_Q16; cannam@154: opus_int32 Tilt_smth_Q16; cannam@154: } silk_shape_state_FIX; cannam@154: cannam@154: /********************************/ cannam@154: /* Encoder state FIX */ cannam@154: /********************************/ cannam@154: typedef struct { cannam@154: silk_encoder_state sCmn; /* Common struct, shared with floating-point code */ cannam@154: silk_shape_state_FIX sShape; /* Shape state */ cannam@154: cannam@154: /* Buffer for find pitch and noise shape analysis */ cannam@154: silk_DWORD_ALIGN opus_int16 x_buf[ 2 * MAX_FRAME_LENGTH + LA_SHAPE_MAX ];/* Buffer for find pitch and noise shape analysis */ cannam@154: opus_int LTPCorr_Q15; /* Normalized correlation from pitch lag estimator */ cannam@154: opus_int32 resNrgSmth; cannam@154: } silk_encoder_state_FIX; cannam@154: cannam@154: /************************/ cannam@154: /* Encoder control FIX */ cannam@154: /************************/ cannam@154: typedef struct { cannam@154: /* Prediction and coding parameters */ cannam@154: opus_int32 Gains_Q16[ MAX_NB_SUBFR ]; cannam@154: silk_DWORD_ALIGN opus_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ]; cannam@154: opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ]; cannam@154: opus_int LTP_scale_Q14; cannam@154: opus_int pitchL[ MAX_NB_SUBFR ]; cannam@154: cannam@154: /* Noise shaping parameters */ cannam@154: /* Testing */ cannam@154: silk_DWORD_ALIGN opus_int16 AR_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ]; cannam@154: opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ]; /* Packs two int16 coefficients per int32 value */ cannam@154: opus_int Tilt_Q14[ MAX_NB_SUBFR ]; cannam@154: opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ]; cannam@154: opus_int Lambda_Q10; cannam@154: opus_int input_quality_Q14; cannam@154: opus_int coding_quality_Q14; cannam@154: cannam@154: /* measures */ cannam@154: opus_int32 predGain_Q16; cannam@154: opus_int LTPredCodGain_Q7; cannam@154: opus_int32 ResNrg[ MAX_NB_SUBFR ]; /* Residual energy per subframe */ cannam@154: opus_int ResNrgQ[ MAX_NB_SUBFR ]; /* Q domain for the residual energy > 0 */ cannam@154: cannam@154: /* Parameters for CBR mode */ cannam@154: opus_int32 GainsUnq_Q16[ MAX_NB_SUBFR ]; cannam@154: opus_int8 lastGainIndexPrev; cannam@154: } silk_encoder_control_FIX; cannam@154: cannam@154: /************************/ cannam@154: /* Encoder Super Struct */ cannam@154: /************************/ cannam@154: typedef struct { cannam@154: silk_encoder_state_FIX state_Fxx[ ENCODER_NUM_CHANNELS ]; cannam@154: stereo_enc_state sStereo; cannam@154: opus_int32 nBitsUsedLBRR; cannam@154: opus_int32 nBitsExceeded; cannam@154: opus_int nChannelsAPI; cannam@154: opus_int nChannelsInternal; cannam@154: opus_int nPrevChannelsInternal; cannam@154: opus_int timeSinceSwitchAllowed_ms; cannam@154: opus_int allowBandwidthSwitch; cannam@154: opus_int prev_decode_only_middle; cannam@154: } silk_encoder; cannam@154: cannam@154: cannam@154: #ifdef __cplusplus cannam@154: } cannam@154: #endif cannam@154: cannam@154: #endif