Home | History | Annotate | Download | only in float
      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, are permitted provided that the following conditions
      5 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 Internet Society, IETF or IETF Trust, nor the
     12 names of specific contributors, may be used to endorse or promote
     13 products derived from this software without specific prior written
     14 permission.
     15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     16 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     17 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     18 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
     19 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     20 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     21 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     22 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     23 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     24 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     25 POSSIBILITY OF SUCH DAMAGE.
     26 ***********************************************************************/
     27 
     28 #ifndef SILK_STRUCTS_FLP_H
     29 #define SILK_STRUCTS_FLP_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     silk_float                  HarmShapeGain_smth;
     46     silk_float                  Tilt_smth;
     47 } silk_shape_state_FLP;
     48 
     49 /********************************/
     50 /* Encoder state FLP            */
     51 /********************************/
     52 typedef struct {
     53     silk_encoder_state          sCmn;                               /* Common struct, shared with fixed-point code */
     54     silk_shape_state_FLP        sShape;                             /* Noise shaping state */
     55 
     56     /* Buffer for find pitch and noise shape analysis */
     57     silk_float                  x_buf[ 2 * MAX_FRAME_LENGTH + LA_SHAPE_MAX ];/* Buffer for find pitch and noise shape analysis */
     58     silk_float                  LTPCorr;                            /* Normalized correlation from pitch lag estimator */
     59 } silk_encoder_state_FLP;
     60 
     61 /************************/
     62 /* Encoder control FLP  */
     63 /************************/
     64 typedef struct {
     65     /* Prediction and coding parameters */
     66     silk_float                  Gains[ MAX_NB_SUBFR ];
     67     silk_float                  PredCoef[ 2 ][ MAX_LPC_ORDER ];     /* holds interpolated and final coefficients */
     68     silk_float                  LTPCoef[LTP_ORDER * MAX_NB_SUBFR];
     69     silk_float                  LTP_scale;
     70     opus_int                    pitchL[ MAX_NB_SUBFR ];
     71 
     72     /* Noise shaping parameters */
     73     silk_float                  AR[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ];
     74     silk_float                  LF_MA_shp[     MAX_NB_SUBFR ];
     75     silk_float                  LF_AR_shp[     MAX_NB_SUBFR ];
     76     silk_float                  Tilt[          MAX_NB_SUBFR ];
     77     silk_float                  HarmShapeGain[ MAX_NB_SUBFR ];
     78     silk_float                  Lambda;
     79     silk_float                  input_quality;
     80     silk_float                  coding_quality;
     81 
     82     /* Measures */
     83     silk_float                  predGain;
     84     silk_float                  LTPredCodGain;
     85     silk_float                  ResNrg[ MAX_NB_SUBFR ];             /* Residual energy per subframe */
     86 
     87     /* Parameters for CBR mode */
     88     opus_int32                  GainsUnq_Q16[ MAX_NB_SUBFR ];
     89     opus_int8                   lastGainIndexPrev;
     90 } silk_encoder_control_FLP;
     91 
     92 /************************/
     93 /* Encoder Super Struct */
     94 /************************/
     95 typedef struct {
     96     silk_encoder_state_FLP      state_Fxx[ ENCODER_NUM_CHANNELS ];
     97     stereo_enc_state            sStereo;
     98     opus_int32                  nBitsUsedLBRR;
     99     opus_int32                  nBitsExceeded;
    100     opus_int                    nChannelsAPI;
    101     opus_int                    nChannelsInternal;
    102     opus_int                    nPrevChannelsInternal;
    103     opus_int                    timeSinceSwitchAllowed_ms;
    104     opus_int                    allowBandwidthSwitch;
    105     opus_int                    prev_decode_only_middle;
    106 } silk_encoder;
    107 
    108 #ifdef __cplusplus
    109 }
    110 #endif
    111 
    112 #endif
    113