Home | History | Annotate | Download | only in source
      1 /*
      2  *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
      3  *
      4  *  Use of this source code is governed by a BSD-style license
      5  *  that can be found in the LICENSE file in the root of the source
      6  *  tree. An additional intellectual property rights grant can be found
      7  *  in the file PATENTS.  All contributing project authors may
      8  *  be found in the AUTHORS file in the root of the source tree.
      9  */
     10 
     11 /*
     12  * entropy_coding.h
     13  *
     14  * This header file contains all of the functions used to arithmetically
     15  * encode the iSAC bistream
     16  *
     17  */
     18 
     19 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_ENTROPY_CODING_H_
     20 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_ENTROPY_CODING_H_
     21 
     22 #include "structs.h"
     23 
     24 /* decode complex spectrum (return number of bytes in stream) */
     25 WebRtc_Word16 WebRtcIsacfix_DecodeSpec(Bitstr_dec  *streamdata,
     26                                        WebRtc_Word16 *frQ7,
     27                                        WebRtc_Word16 *fiQ7,
     28                                        WebRtc_Word16 AvgPitchGain_Q12);
     29 
     30 /* encode complex spectrum */
     31 int WebRtcIsacfix_EncodeSpec(const WebRtc_Word16 *fr,
     32                              const WebRtc_Word16 *fi,
     33                              Bitstr_enc *streamdata,
     34                              WebRtc_Word16 AvgPitchGain_Q12);
     35 
     36 
     37 /* decode & dequantize LPC Coef */
     38 int WebRtcIsacfix_DecodeLpcCoef(Bitstr_dec  *streamdata,
     39                                 WebRtc_Word32 *LPCCoefQ17,
     40                                 WebRtc_Word32 *gain_lo_hiQ17,
     41                                 WebRtc_Word16 *outmodel);
     42 
     43 int WebRtcIsacfix_DecodeLpc(WebRtc_Word32 *gain_lo_hiQ17,
     44                             WebRtc_Word16 *LPCCoef_loQ15,
     45                             WebRtc_Word16 *LPCCoef_hiQ15,
     46                             Bitstr_dec  *streamdata,
     47                             WebRtc_Word16 *outmodel);
     48 
     49 /* quantize & code LPC Coef */
     50 int WebRtcIsacfix_EncodeLpc(WebRtc_Word32 *gain_lo_hiQ17,
     51                             WebRtc_Word16 *LPCCoef_loQ15,
     52                             WebRtc_Word16 *LPCCoef_hiQ15,
     53                             WebRtc_Word16 *model,
     54                             WebRtc_Word32 *sizeQ11,
     55                             Bitstr_enc *streamdata,
     56                             ISAC_SaveEncData_t* encData,
     57                             transcode_obj *transcodeParam);
     58 
     59 int WebRtcIsacfix_EstCodeLpcGain(WebRtc_Word32 *gain_lo_hiQ17,
     60                                  Bitstr_enc *streamdata,
     61                                  ISAC_SaveEncData_t* encData);
     62 /* decode & dequantize RC */
     63 int WebRtcIsacfix_DecodeRcCoef(Bitstr_dec *streamdata,
     64                                WebRtc_Word16 *RCQ15);
     65 
     66 /* quantize & code RC */
     67 int WebRtcIsacfix_EncodeRcCoef(WebRtc_Word16 *RCQ15,
     68                                Bitstr_enc *streamdata);
     69 
     70 /* decode & dequantize squared Gain */
     71 int WebRtcIsacfix_DecodeGain2(Bitstr_dec *streamdata,
     72                               WebRtc_Word32 *Gain2);
     73 
     74 /* quantize & code squared Gain (input is squared gain) */
     75 int WebRtcIsacfix_EncodeGain2(WebRtc_Word32 *gain2,
     76                               Bitstr_enc *streamdata);
     77 
     78 int WebRtcIsacfix_EncodePitchGain(WebRtc_Word16 *PitchGains_Q12,
     79                                   Bitstr_enc *streamdata,
     80                                   ISAC_SaveEncData_t* encData);
     81 
     82 int WebRtcIsacfix_EncodePitchLag(WebRtc_Word16 *PitchLagQ7,
     83                                  WebRtc_Word16 *PitchGain_Q12,
     84                                  Bitstr_enc *streamdata,
     85                                  ISAC_SaveEncData_t* encData);
     86 
     87 int WebRtcIsacfix_DecodePitchGain(Bitstr_dec *streamdata,
     88                                   WebRtc_Word16 *PitchGain_Q12);
     89 
     90 int WebRtcIsacfix_DecodePitchLag(Bitstr_dec *streamdata,
     91                                  WebRtc_Word16 *PitchGain_Q12,
     92                                  WebRtc_Word16 *PitchLagQ7);
     93 
     94 int WebRtcIsacfix_DecodeFrameLen(Bitstr_dec *streamdata,
     95                                  WebRtc_Word16 *framelength);
     96 
     97 
     98 int WebRtcIsacfix_EncodeFrameLen(WebRtc_Word16 framelength,
     99                                  Bitstr_enc *streamdata);
    100 
    101 int WebRtcIsacfix_DecodeSendBandwidth(Bitstr_dec *streamdata,
    102                                       WebRtc_Word16 *BWno);
    103 
    104 
    105 int WebRtcIsacfix_EncodeReceiveBandwidth(WebRtc_Word16 *BWno,
    106                                          Bitstr_enc *streamdata);
    107 
    108 void WebRtcIsacfix_TranscodeLpcCoef(WebRtc_Word32 *tmpcoeffs_gQ6,
    109                                     WebRtc_Word16 *index_gQQ);
    110 
    111 #endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_FIX_SOURCE_ENTROPY_CODING_H_ */
    112