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