From 720708ed980a4b3b7974661673a6a13b924bedac Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 19 May 2025 11:35:14 +0530 Subject: [PATCH] Removal of unused float functions and replacing C datatypes with Basop Datatypes --- lib_com/bitstream.c | 66 ++--- lib_com/core_com_config.c | 6 +- lib_com/ivas_cnst.h | 8 +- lib_com/longarith.c | 4 +- lib_com/prot_fx.h | 463 +++++++++++++------------------- lib_com/tns_base.c | 82 +----- lib_com/tools.c | 195 +++----------- lib_com/tools_fx.c | 14 +- lib_dec/dec_acelp_tcx_main_fx.c | 2 +- lib_enc/acelp_core_enc_fx.c | 3 - lib_enc/evs_enc_fx.c | 2 +- lib_enc/prot_fx_enc.h | 1 - lib_enc/rom_enc.h | 1 - lib_rend/ivas_rom_rend.h | 4 - lib_rend/ivas_rom_rend_fx.c | 36 --- 15 files changed, 290 insertions(+), 597 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index d8d4563ed..385000139 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -100,7 +100,7 @@ static Word16 rate2AMRWB_IOmode( *-------------------------------------------------------------------*/ Word16 rate2EVSmode_float( const Word32 brate, /* i : bitrate */ - int16_t *is_amr_wb /* o : (flag) does the bitrate belong to AMR-WB? Can be NULL */ + Word16 *is_amr_wb /* o : (flag) does the bitrate belong to AMR-WB? Can be NULL */ ) { if ( is_amr_wb != NULL ) @@ -575,8 +575,8 @@ Word16 get_ivas_max_num_indices_fx( *-----------------------------------------------------------------------*/ /*! r: maximum number of indices */ -int16_t get_BWE_max_num_indices( - const int32_t extl_brate /* i : extensiona layer bitrate */ +Word16 get_BWE_max_num_indices( + const Word32 extl_brate /* i : extensiona layer bitrate */ ) { /* set the maximum number of indices in the BWE */ @@ -787,10 +787,10 @@ Word16 get_ivas_max_num_indices_metadata_fx( void move_indices( INDICE_HANDLE old_ind_list, /* i/o: old location of indices */ INDICE_HANDLE new_ind_list, /* i/o: new location of indices */ - const int16_t nb_indices /* i : number of moved indices */ + const Word16 nb_indices /* i : number of moved indices */ ) { - int16_t i; + Word16 i; if ( new_ind_list < old_ind_list ) { @@ -1092,14 +1092,14 @@ ivas_error push_next_bits( *-------------------------------------------------------------------*/ /*! r: result: index of the indice in the list, -1 if not found */ -int16_t find_indice( +Word16 find_indice( BSTR_ENC_HANDLE hBstr, /* i : encoder bitstream handle */ - const int16_t id, /* i : ID of the indice */ - uint16_t *value, /* o : value of the quantized indice */ - int16_t *nb_bits /* o : number of bits used to quantize the indice */ + const Word16 id, /* i : ID of the indice */ + UWord16 *value, /* o : value of the quantized indice */ + Word16 *nb_bits /* o : number of bits used to quantize the indice */ ) { - int16_t i; + Word16 i; for ( i = 0; i < hBstr->nb_ind_tot; i++ ) { @@ -1122,12 +1122,12 @@ int16_t find_indice( *-------------------------------------------------------------------*/ /*! r: number of deleted indices */ -uint16_t delete_indice( +UWord16 delete_indice( BSTR_ENC_HANDLE hBstr, /* i : encoder bitstream handle */ - const int16_t id /* i : ID of the indice */ + const Word16 id /* i : ID of the indice */ ) { - int16_t i, j; + Word16 i, j; j = 0; for ( i = 0; i < hBstr->nb_ind_tot; i++ ) @@ -1168,14 +1168,14 @@ uint16_t delete_indice( *-------------------------------------------------------------------*/ /*! r: value of the indice */ -uint16_t get_next_indice( +UWord16 get_next_indice( Decoder_State *st, /* i/o: decoder state structure */ - int16_t nb_bits /* i : number of bits that were used to quantize the indice */ + Word16 nb_bits /* i : number of bits that were used to quantize the indice */ ) { - uint16_t value; - int16_t i; - int32_t nbits_total; + UWord16 value; + Word16 i; + Word32 nbits_total; assert( nb_bits <= 16 ); @@ -1207,11 +1207,11 @@ uint16_t get_next_indice( *-------------------------------------------------------------------*/ /*! r: value of the indice */ -uint16_t get_next_indice_1( +UWord16 get_next_indice_1( Decoder_State *st /* i/o: decoder state structure */ ) { - int32_t nbits_total; + Word32 nbits_total; nbits_total = st->total_brate / FRAMES_PER_SEC; /* detect corrupted bitstream */ if ( ( st->next_bit_pos + 1 > nbits_total && st->codec_mode == MODE1 ) || @@ -1233,7 +1233,7 @@ uint16_t get_next_indice_1( void get_next_indice_tmp( Decoder_State *st, /* o : decoder state structure */ - int16_t nb_bits /* i : number of bits that were used to quantize the indice */ + Word16 nb_bits /* i : number of bits that were used to quantize the indice */ ) { /* update the position in the bitstream */ @@ -1249,15 +1249,15 @@ void get_next_indice_tmp( *-------------------------------------------------------------------*/ /*! r: value of the indice */ -uint16_t get_indice( +UWord16 get_indice( Decoder_State *st, /* i/o: decoder state structure */ - int16_t pos, /* i : absolute position in the bitstream (update after the read) */ - int16_t nb_bits /* i : number of bits that were used to quantize the indice */ + Word16 pos, /* i : absolute position in the bitstream (update after the read) */ + Word16 nb_bits /* i : number of bits that were used to quantize the indice */ ) { - uint16_t value; - int16_t i; - int32_t nbits_total; + UWord16 value; + Word16 i; + Word32 nbits_total; assert( nb_bits <= 16 ); @@ -1584,9 +1584,9 @@ ivas_error write_indices_ivas_fx( *-------------------------------------------------------------------*/ static void decoder_selectCodec( - Decoder_State *st, /* i/o: decoder state structure */ - const int32_t total_brate, /* i : total bitrate */ - const int16_t bit0 /* i : first bit */ + Decoder_State *st, /* i/o: decoder state structure */ + const Word32 total_brate, /* i : total bitrate */ + const Word16 bit0 /* i : first bit */ ) { /* set the AMR-WB IO flag */ @@ -1724,7 +1724,7 @@ void ivas_set_bitstream_pointers( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { - int16_t k, num_bits; + Word16 k, num_bits; Decoder_State **sts; num_bits = 0; @@ -1734,7 +1734,7 @@ void ivas_set_bitstream_pointers( { sts = st_ivas->hSCE[k]->hCoreCoder; sts[0]->bit_stream = st_ivas->bit_stream + num_bits; - num_bits += (int16_t) ( st_ivas->hSCE[k]->element_brate / FRAMES_PER_SEC ); + num_bits += (Word16) ( st_ivas->hSCE[k]->element_brate / FRAMES_PER_SEC ); } /* set bitstream pointers for CPEs */ @@ -1742,7 +1742,7 @@ void ivas_set_bitstream_pointers( { sts = st_ivas->hCPE[k]->hCoreCoder; sts[0]->bit_stream = st_ivas->bit_stream + num_bits; - num_bits += (int16_t) ( st_ivas->hCPE[k]->element_brate / FRAMES_PER_SEC ); + num_bits += (Word16) ( st_ivas->hCPE[k]->element_brate / FRAMES_PER_SEC ); } return; diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c index f75f28a18..152870be7 100644 --- a/lib_com/core_com_config.c +++ b/lib_com/core_com_config.c @@ -492,12 +492,12 @@ Word16 sr2fscale_fx( return extract_l( Mpy_32_16_1( sr_core, FSCALE_DENOM_BY_12800_Q15 ) ); /*Q0*/ } -int16_t sr2fscale( - const int32_t sr_core /* i : internal sampling rate */ +Word16 sr2fscale( + const Word32 sr_core /* i : internal sampling rate */ ) { - return (int16_t) ( ( FSCALE_DENOM * sr_core ) / 12800 ); + return (Word16) ( ( FSCALE_DENOM * sr_core ) / 12800 ); } Word32 getCoreSamplerateMode2( diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 9243b3f50..097ba1789 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -509,8 +509,8 @@ enum #define STEREO_DFT32MS_N_NS FRAME_SIZE_NS /* 20 ms */ #define STEREO_DFT32MS_OVL_NS 3125000L /* 3.125ms - Overlap for the outer edges of windows on decoder */ #define STEREO_DFT32MS_OVL2_NS 9375000L /* 9.375ms - Overlap for the inner edges of windows on decoder */ -#define STEREO_DFT32MS_WIN_CENTER_NS ( int32_t )( ( FRAME_SIZE_NS + STEREO_DFT32MS_OVL_NS ) * 0.5f ) /* 11.5625ms - mid point of the two windows wrt the left edge of overlap */ -#define STEREO_DFT32MS_ZP_NS ( int32_t )( 0.5f * ( STEREO_DFT32MS_N_NS - STEREO_DFT32MS_WIN_CENTER_NS - ( STEREO_DFT32MS_OVL2_NS * 0.5f ) ) ) /* 2 sided zp calculated such that window size is satisfied */ +#define STEREO_DFT32MS_WIN_CENTER_NS ( Word32 )( ( FRAME_SIZE_NS + STEREO_DFT32MS_OVL_NS ) * 0.5f ) /* 11.5625ms - mid point of the two windows wrt the left edge of overlap */ +#define STEREO_DFT32MS_ZP_NS ( Word32 )( 0.5f * ( STEREO_DFT32MS_N_NS - STEREO_DFT32MS_WIN_CENTER_NS - ( STEREO_DFT32MS_OVL2_NS * 0.5f ) ) ) /* 2 sided zp calculated such that window size is satisfied */ #define STEREO_DFT32MS_OVL_MAX NS2SA( 48000, STEREO_DFT32MS_OVL_NS ) #define STEREO_DFT32MS_OVL2_MAX NS2SA( 48000, STEREO_DFT32MS_OVL2_NS ) @@ -799,7 +799,7 @@ enum fea_names #define L_DEC_MEM_LEN_ICA L_NCSHIFTMAX + ( N_MAX_SHIFT_CHANGE + 1 ) + SINC_ORDER1 / INTERP_FACTOR1 #define L_FRAME_DS NS2SA( CORR_INTER_FS, FRAME_SIZE_NS ) #define L_XCORRMEM_DS NS2SA( CORR_INTER_FS, 2 * ( ACELP_LOOK_NS ) ) -#define L_NCSHIFT_DS ( int16_t )( ( ( int32_t )(CORR_INTER_FS) *L_NCSHIFTMAX ) / 48000L ) +#define L_NCSHIFT_DS ( Word16 )( ( ( Word32 )(CORR_INTER_FS) *L_NCSHIFTMAX ) / 48000L ) #define L_SAMPLES_LA_NS 625000L #define L_MEM_RECALC_TBE_16K NS2SA( 16000, L_MEM_RECALC_TBE_NS ) @@ -1446,7 +1446,7 @@ typedef struct { typedef struct { Word32 value[81]; - unsigned short length[81]; + UWord16 length[81]; } HUFF_ELEMENTS; typedef struct { diff --git a/lib_com/longarith.c b/lib_com/longarith.c index 72a763de3..c5ace652c 100644 --- a/lib_com/longarith.c +++ b/lib_com/longarith.c @@ -64,14 +64,14 @@ void longadd( assert( lena >= lenb ); for ( h = 0; h < lenb; h++ ) { - carry += ( (uint32_t) a[h] ) + ( (uint32_t) b[h] ); + carry += ( (UWord32) a[h] ) + ( (UWord32) b[h] ); a[h] = (UWord16) carry; carry = carry >> 16; } for ( ; h < lena; h++ ) { - carry = ( (uint32_t) a[h] ) + carry; + carry = ( (UWord32) a[h] ) + carry; a[h] = (UWord16) carry; carry = carry >> 16; } diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index c7d35daca..498be3137 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -72,9 +72,6 @@ #define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) ) #endif -#define log_base_2( x ) ( (double) log( (double) ( x ) ) * 1.4426950408889634074f ) -#define round_f( x ) ( ( ( x ) > 0 ) ? (int32_t) ( ( x ) + 0.5f ) : ( -(int32_t) ( ( -x ) + 0.5f ) ) ) - #ifndef ABSVAL #define ABSVAL( a ) ( ( a ) >= 0 ? ( a ) : ( -( a ) ) ) #endif @@ -1576,19 +1573,19 @@ Word16 gsc_gainQ_fx( ); Word16 gsc_gainQ_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const int16_t element_mode, /* i : element mode */ - const int16_t idchan, /* i : channel ID */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + const Word16 element_mode, /* i : element mode */ + const Word16 idchan, /* i : channel ID */ const Word16 y_gain4[], /* i : Energy per band */ // Q12 Word16 y_gainQ[], /* o : quantized energy per band */ // Q12 - const int32_t core_brate, /* i : Core rate */ - const int16_t coder_type, /* i : coding type */ - const int16_t bwidth, /* i : input signal bandwidth */ - const int16_t L_frame, /* i : frame length */ - const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const int32_t core_brate_inp /* i : true core bitrate */ + const Word32 core_brate, /* i : Core rate */ + const Word16 coder_type, /* i : coding type */ + const Word16 bwidth, /* i : input signal bandwidth */ + const Word16 L_frame, /* i : frame length */ + const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const Word32 core_brate_inp /* i : true core bitrate */ ); // frame_ener.c @@ -1779,7 +1776,7 @@ void Ener_per_band_comp_ivas_fx( const Word16 Q_exc, /* i : frame length */ const Word16 Mband, /* i : Max band */ const Word16 Eflag, /* i : flag of highest band */ - const int16_t L_frame /* i : frame length */ + const Word16 L_frame /* i : frame length */ ); void Ener_per_band_comp_ivas_fx_2( const Word16 exc_diff_fx[], /* i : target signal Q_exc_diff */ @@ -2633,7 +2630,7 @@ void Interpolate_allpass_steep_fx( void Interpolate_allpass_steep_fx32( const Word32 *in_fx, /* i : input array of size N */ Word32 *mem_fx, /* i/o: memory */ - const int16_t N, /* i : number of input samples */ + const Word16 N, /* i : number of input samples */ Word32 *out_fx /* o : output array of size 2*N */ ); @@ -2647,7 +2644,7 @@ void interpolate_3_over_2_allpass_fx( void interpolate_3_over_2_allpass_fx32( const Word32 *input, /* i : input signal Qx */ - const int16_t len, /* i : number of input samples */ + const Word16 len, /* i : number of input samples */ Word32 *out, /* o : output signal */ Word32 *mem /* i/o: memory */ ); @@ -2931,16 +2928,16 @@ void tbe_celp_exc( ); void tbe_celp_exc_ivas( - const int16_t element_mode, /* i : element mode */ - const int16_t idchan, /* i : channel ID */ - const Word16 L_frame_fx, /* i : Frame lenght */ - const int16_t L_subfr, /* i : subframe length */ - const Word16 i_subfr_fx, /* i : sub frame */ - const Word16 T0_fx, /* i : Integer pitch */ - const Word16 T0_frac_fx, /* i : Fractional part of the pitch */ - Word16 *error_fx, /* i/o: Error */ - Word16 *bwe_exc_fx, /* i/o: bandwitdh extension signal */ - const int16_t tdm_LRTD_flag /* i : LRTD stereo mode flag */ + const Word16 element_mode, /* i : element mode */ + const Word16 idchan, /* i : channel ID */ + const Word16 L_frame_fx, /* i : Frame lenght */ + const Word16 L_subfr, /* i : subframe length */ + const Word16 i_subfr_fx, /* i : sub frame */ + const Word16 T0_fx, /* i : Integer pitch */ + const Word16 T0_frac_fx, /* i : Fractional part of the pitch */ + Word16 *error_fx, /* i/o: Error */ + Word16 *bwe_exc_fx, /* i/o: bandwitdh extension signal */ + const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */ ); void flip_and_downmix_generic_fx( @@ -3159,8 +3156,8 @@ void GenSHBSynth_fx32( Word32 *shb_syn_speech_32k, /* o : output highband component */ Word32 Hilbert_Mem[], /* i/o: memory */ Word32 state_lsyn_filt_shb_local[], /* i/o: memory */ - const int16_t L_frame, /* i : ACELP frame length */ - int16_t *syn_dm_phase ); + const Word16 L_frame, /* i : ACELP frame length */ + Word16 *syn_dm_phase ); void ScaleShapedSHB_fx( const Word16 length, /* i : SHB overlap length */ @@ -3245,7 +3242,7 @@ void wb_tbe_extras_reset_synth_fx( Word16 state_lsyn_filt_shb[], Word16 state_ls #ifdef FIX_1439_SPEEDUP_SIMPLIFY_elliptic_bpf_48k_generic void elliptic_bpf_48k_generic_fx( #ifdef FIX_1439_SPEEDUP_SIMPLIFY_elliptic_bpf_48k_generic_STAGE2 - const int16_t element_mode, + const Word16 element_mode, #endif Word16 IsUpsampled3, Word16 input_fx[], /* i : input signal Q_input_fx*/ @@ -3280,7 +3277,7 @@ void synthesise_fb_high_band_fx( Word16 Qout #ifdef FIX_1439_SPEEDUP_SIMPLIFY_elliptic_bpf_48k_generic_STAGE2 , - int16_t element_mode + Word16 element_mode #endif ); @@ -3747,8 +3744,8 @@ void const *GetTnsEnabledSingleFilter( void const *p, const Word16 index, Word16 void *SetTnsEnabledSingleFilter( void *p, const Word16 index, const Word16 value ); -void const *GetTnsOnWhite( void const *p, const int16_t index, int16_t *pValue ); -void *SetTnsOnWhite( void *p, const int16_t index, const int16_t value ); +void const *GetTnsOnWhite( void const *p, const Word16 index, Word16 *pValue ); +void *SetTnsOnWhite( void *p, const Word16 index, const Word16 value ); /*tns_base.h*/ /** Reset TNS data. @@ -4113,8 +4110,8 @@ void cng_params_upd_ivas_fx( const Word16 element_mode, /* i : Element mode */ const Word16 bwidth /* i : Audio bandwidth */ ); -int16_t get_cng_mode( - const int32_t last_active_brate /* i : last active bitrate */ +Word16 get_cng_mode( + const Word32 last_active_brate /* i : last active bitrate */ ); // core_com_config.c @@ -4301,12 +4298,12 @@ void lpc2mdct( void lpc2mdct_2( Word16 *lpcCoeffs, - const int16_t lpcOrder, + const Word16 lpcOrder, Word16 mdct_gains_fx[], Word16 mdct_gains_e[], Word16 mdct_inv_gains_fx[], Word16 mdct_inv_gains_e[], - const int16_t length ); + const Word16 length ); void mdct_shaping( Word32 x[], @@ -4941,25 +4938,25 @@ void cb_shape_fx( // longarith.c void longadd( - uint16_t a[], /* i/o: vector of the length lena */ - const uint16_t b[], /* i/o: vector of the length lenb */ - const int16_t lena, /* i/o: length of vector a[] */ - const int16_t lenb /* i/o: length of vector b[] */ + UWord16 a[], /* i/o: vector of the length lena */ + const UWord16 b[], /* i/o: vector of the length lenb */ + const Word16 lena, /* i/o: length of vector a[] */ + const Word16 lenb /* i/o: length of vector b[] */ ); void longshiftright( - uint16_t a[], /* i : vector of the length lena */ - const int16_t b, /* i : number of bit positions to shift right */ - uint16_t d[], /* o : vector of the length lend */ - int16_t lena, /* i : length of vector a[] */ - const int16_t lend /* i : length of vector d[] */ + UWord16 a[], /* i : vector of the length lena */ + const Word16 b, /* i : number of bit positions to shift right */ + UWord16 d[], /* o : vector of the length lend */ + Word16 lena, /* i : length of vector a[] */ + const Word16 lend /* i : length of vector d[] */ ); void longshiftleft( - const uint16_t a[], /* i : vector of the length len */ - const int16_t b, /* i : number of bit positions to shift left */ - uint16_t d[], /* o : vector of the length len */ - const int16_t len /* i : length of vector a[] and d[] */ + const UWord16 a[], /* i : vector of the length len */ + const Word16 b, /* i : number of bit positions to shift left */ + UWord16 d[], /* o : vector of the length len */ + const Word16 len /* i : length of vector a[] and d[] */ ); void longshr( @@ -5637,7 +5634,7 @@ void enhancer_fx( void enhancer_ivas_fx( const Word16 codec_mode, /* i : flag indicating Codec Mode */ const Word32 core_brate, /* i : decoder bitrate */ - const int16_t cbk_index, /* i : */ + const Word16 cbk_index, /* i : */ const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ const Word16 coder_type, /* i : coder type */ const Word16 i_subfr, /* i : subframe number */ @@ -6398,11 +6395,11 @@ void ivas_RefineTonalComponents_fx( const PsychoacousticParameters *psychParamsCurrent ); ivas_error PsychoacousticParameters_Init( - const int32_t sr_core, /* i : sampling rate of core-coder */ - const int16_t nBins, /* i : Number of bins (spectral lines) */ - const int8_t nBands, /* i : Number of spectrum subbands */ - const int16_t isTCX20, /* i : Flag indicating if the subband division is for TCX20 or TCX10 */ - const int16_t isWarped, /* i : Flag indicating if the scale is linear or warped */ + const Word32 sr_core, /* i : sampling rate of core-coder */ + const Word16 nBins, /* i : Number of bins (spectral lines) */ + const Word8 nBands, /* i : Number of spectrum subbands */ + const Word16 isTCX20, /* i : Flag indicating if the subband division is for TCX20 or TCX10 */ + const Word16 isWarped, /* i : Flag indicating if the scale is linear or warped */ PsychoacousticParameters *pPsychParams ); // TonalIMDCTconcealment_fx.c @@ -8279,17 +8276,17 @@ Word16 FEC_synchro_exc_fx( ); void decod_unvoiced_fx( - Decoder_State *st_fx, /* i/o: decoder static memory */ - const Word16 *Aq_fx, /* Q12 i : LP filter coefficient */ - const Word16 Es_pred_fx, /* i : predicted scaled innov. energy */ - const int16_t uc_two_stage_flag, /* i : flag indicating two-stage UC */ - const Word16 coder_type, /* Q0 i : coding type */ - Word16 *tmp_noise_fx, /* Q0 o : long term temporary noise energy */ - Word16 *pitch_buf_fx, /* Q6 o : floating pitch values for each subframe*/ - Word16 *voice_factors_fx, /* Q15 o : voicing factors */ - Word16 *exc_fx, /* Q_X o : adapt. excitation exc */ - Word16 *exc2_fx, /* Q_X o : adapt. excitation/total exc */ - Word16 *bwe_exc_fx, /* Q_X i/o: excitation for SWB TBE */ + Decoder_State *st_fx, /* i/o: decoder static memory */ + const Word16 *Aq_fx, /* Q12 i : LP filter coefficient */ + const Word16 Es_pred_fx, /* i : predicted scaled innov. energy */ + const Word16 uc_two_stage_flag, /* i : flag indicating two-stage UC */ + const Word16 coder_type, /* Q0 i : coding type */ + Word16 *tmp_noise_fx, /* Q0 o : long term temporary noise energy */ + Word16 *pitch_buf_fx, /* Q6 o : floating pitch values for each subframe*/ + Word16 *voice_factors_fx, /* Q15 o : voicing factors */ + Word16 *exc_fx, /* Q_X o : adapt. excitation exc */ + Word16 *exc2_fx, /* Q_X o : adapt. excitation/total exc */ + Word16 *bwe_exc_fx, /* Q_X i/o: excitation for SWB TBE */ Word16 *gain_buf ); // gaus_dec_fx.c @@ -8473,10 +8470,10 @@ void mode_switch_decoder_LPD_ivas_fx( // ari_hm_dec.c -int16_t DecodeIndex( +Word16 DecodeIndex( Decoder_State *st, - const int16_t Bandwidth, /* o : NB, 1: (S)WB */ - int16_t *PeriodicityIndex ); + const Word16 Bandwidth, /* o : NB, 1: (S)WB */ + Word16 *PeriodicityIndex ); Word16 DecodeIndex_fx( Decoder_State *st, @@ -8553,7 +8550,7 @@ void IGFSCFDecoderReset( void IGFSCFDecoderDecode( IGFSCFDEC_INSTANCE_HANDLE hPublicData, /* i/o: handle to public data or NULL in case there was no instance created */ Decoder_State *st, /* i/o: pointer to decoder state */ - int16_t *sfe, /* o : ptr to an array which will contain the decoded quantized coefficients */ + Word16 *sfe, /* o : ptr to an array which will contain the decoded quantized coefficients */ const Word16 igfGridIdx, /* i : igf grid index see declaration of IGF_GRID_IDX for details */ const Word16 indepFlag /* i : if 1 on input the decoder will be forced to reset, if 0 on input the decoder will be forced to encode without a reset */ @@ -8681,11 +8678,11 @@ Word16 DecodeTnsData_ivas_fx( // parametr_bitmapping.c using ivas void GetParameters( ParamsBitMap const *paramsBitMap, - const int16_t nParams, + const Word16 nParams, void const *pParameter, - int16_t **pStream, - int16_t *pnSize, - int16_t *pnBits ); + Word16 **pStream, + Word16 *pnSize, + Word16 *pnBits ); void GetParameters_fx( ParamsBitMap const *paramsBitMap, @@ -8705,10 +8702,10 @@ void EncodeTnsData_ivas_fx( void SetParameters( ParamsBitMap const *paramsBitMap, - const int16_t nParams, + const Word16 nParams, void *pParameter, - const int16_t **pStream, - int16_t *pnSize ); + const Word16 **pStream, + Word16 *pnSize ); void SetParameters_fx( ParamsBitMap const *paramsBitMap, @@ -8719,18 +8716,18 @@ void SetParameters_fx( void WriteToBitstream( ParamsBitMap const *paramsBitMap, - const int16_t nParams, - const int16_t **pStream, - int16_t *pnSize, + const Word16 nParams, + const Word16 **pStream, + Word16 *pnSize, BSTR_ENC_HANDLE hBstr, - int16_t *pnBits ); + Word16 *pnBits ); void ReadFromBitstream( ParamsBitMap const *paramsBitMap, - const int16_t nArrayLength, + const Word16 nArrayLength, Decoder_State *st, - int16_t **pStream, - int16_t *pnSize ); + Word16 **pStream, + Word16 *pnSize ); void ReadFromBitstream_fx( ParamsBitMap const *paramsBitMap, @@ -9289,7 +9286,7 @@ void v_add_fx( const Word32 x1[], /* i : Input vector 1 */ const Word32 x2[], /* i : Input vector 2 */ Word32 y[], /* o : Output vector that contains vector 1 + vector 2 */ - const int16_t N /* i : Vector length */ + const Word16 N /* i : Vector length */ ); void v_shr_16( @@ -9343,10 +9340,10 @@ void configureCldfb_ivas_fx( ); // dec4t64.c void dec_acelp_fast_fx( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t cdk_index, /* i : codebook index */ - Word16 code[], /* o : algebraic (fixed) codebook excitation */ - const int16_t L_subfr /* i : subframe length */ + Decoder_State *st, /* i/o: decoder state structure */ + const Word16 cdk_index, /* i : codebook index */ + Word16 code[], /* o : algebraic (fixed) codebook excitation */ + const Word16 L_subfr /* i : subframe length */ ); // codec_tcx_common.c void tcx5SpectrumInterleaving_fx( @@ -9384,7 +9381,7 @@ void cldfbAnalysis_ivas_fx( const Word32 *timeIn_fx, /* i : time buffer Qx */ Word32 **realBuffer_fx, /* o : real value buffer Qx - 5*/ Word32 **imagBuffer_fx, /* o : imag value buffer QX - 5*/ - const int16_t samplesToProcess, /* i : samples to process */ + const Word16 samplesToProcess, /* i : samples to process */ HANDLE_CLDFB_FILTER_BANK h_cldfb /* i : filterbank state */ ); @@ -9403,7 +9400,7 @@ void cldfbSynthesis_ivas_fx( // bass_psfilter.c void addBassPostFilter_ivas_fx( const Word32 *harm_timeIn_fx, - const int16_t samplesToProcess, + const Word16 samplesToProcess, Word32 **rAnalysis_fx, Word32 **iAnalysis_fx, HANDLE_CLDFB_FILTER_BANK cldfb ); @@ -9563,8 +9560,8 @@ void fd_bwe_dec_init_fx( void stereo_dft_dec_open( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ - const int32_t output_Fs, /* i : output sampling rate */ - const int16_t nchan_transport /* i : number of transport channels */ + const Word32 output_Fs, /* i : output sampling rate */ + const Word16 nchan_transport /* i : number of transport channels */ ); void ivas_bw_switching_pre_proc_fx( @@ -10260,8 +10257,8 @@ void dctT2_N_apply_matrix_fx( ); Word32 sum2_f_32_fx( - const Word32 *vec, /* i : input vector */ - const int16_t lvec, /* i : length of input vector */ + const Word32 *vec, /* i : input vector */ + const Word16 lvec, /* i : length of input vector */ Word16 gb ); Word32 sum2_32_fx( @@ -10411,10 +10408,10 @@ void generate_stereo_masking_noise_fx( Word16 Q_syn, Decoder_State *st, /* i/o: decoder state structure */ STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i : TD stereo structure */ - const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ - const int16_t fadeOut, /* i : only fade out of previous state */ + const Word16 flag_sec_CNA, /* i : CNA flag for secondary channel */ + const Word16 fadeOut, /* i : only fade out of previous state */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ - const int16_t nchan_out /* i : number of output channels */ + const Word16 nchan_out /* i : number of output channels */ ); void SynthesisSTFT_fx( @@ -10422,10 +10419,10 @@ void SynthesisSTFT_fx( Word32 *timeDomainOutput, Word32 *olapBuffer, const Word16 *olapWin, - const int16_t tcx_transition, + const Word16 tcx_transition, HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - const int16_t element_mode, /* i : element mode */ - const int16_t nchan_out /* i : number of output channels */ + const Word16 element_mode, /* i : element mode */ + const Word16 nchan_out /* i : number of output channels */ ); void FdCng_decodeSID_ivas_fx( @@ -10807,7 +10804,7 @@ Word16 msvq_stage1_dct_recalc_candidates_fdcng_wb_fx( const Word16 st1_syn_vec_e, /* i : exp for IDCT24 synthesis vectors */ const Word32 *u_fx, /* i : target signal */ const Word16 u_e, /* i : exp for target signal */ - const int16_t maxC_st1, /* i : number of candidates in stage1 */ + const Word16 maxC_st1, /* i : number of candidates in stage1 */ Word32 *dist_ptr_fx, /* i/o: updated MSE vector for stage1 */ Word16 *dist_ptr_e /* i/o: exp for updated MSE vector for stage1 */ ); @@ -10880,69 +10877,42 @@ void WriteToBitstream_ivas_fx( * MODE1 prototypes *----------------------------------------------------------------------------------*/ -/*! r: inverse square root of input value */ -float inv_sqrt( - const float x /* i : input value */ -); - /*! r: output random value */ -int16_t own_random( - int16_t *seed /* i/o: random seed */ -); - -/*! r: sign of x (+1/-1) */ -float sign( - const float x /* i : input value of x */ +Word16 own_random( + Word16 *seed /* i/o: random seed */ ); -/*! r: logarithm2 of x */ -float log2_f( - const float x /* i : input value of x */ -); - -int16_t norm_ul_float( - uint32_t UL_var1 ); +Word16 norm_ul_float( + UWord32 UL_var1 ); /*! r: sum of all vector elements */ -int16_t sum_s( - const int16_t *vec, /* i : input vector */ - const int16_t lvec /* i : length of input vector */ +Word16 sum_s( + const Word16 *vec, /* i : input vector */ + const Word16 lvec /* i : length of input vector */ ); /*! r: sum of all vector elements */ -int32_t sum_l( - const int32_t *vec, /* i : input vector */ - const int16_t lvec /* i : length of input vector */ -); - -/*! r: sum of all squared vector elements */ -float sum2_f( - const float *vec, /* i : input vector */ - const int16_t lvec /* i : length of input vector */ +Word32 sum_l( + const Word32 *vec, /* i : input vector */ + const Word16 lvec /* i : length of input vector */ ); void set_c( - int8_t y[], /* i/o: Vector to set */ - const int8_t a, /* i : Value to set the vector to */ - const int32_t N /* i : Length of the vector */ + Word8 y[], /* i/o: Vector to set */ + const Word8 a, /* i : Value to set the vector to */ + const Word32 N /* i : Length of the vector */ ); void set_s( - int16_t y[], /* i/o: Vector to set */ - const int16_t a, /* i : Value to set the vector to */ - const int16_t N /* i : Lenght of the vector */ + Word16 y[], /* i/o: Vector to set */ + const Word16 a, /* i : Value to set the vector to */ + const Word16 N /* i : Lenght of the vector */ ); void set_l( - int32_t y[], /* i/o: Vector to set */ - const int32_t a, /* i : Value to set the vector to */ - const int16_t N /* i : Length of the vector */ -); - -void set_f( - float y[], /* i/o: Vector to set */ - const float a, /* i : Value to set the vector to */ - const int16_t N /* i : Lenght of the vector */ + Word32 y[], /* i/o: Vector to set */ + const Word32 a, /* i : Value to set the vector to */ + const Word16 N /* i : Length of the vector */ ); void set_zero_fx( @@ -10959,52 +10929,26 @@ void set16_zero_fx( ); void set_zero( - float *vec, /* o : input vector */ - const int16_t lvec /* i : length of the vector */ + float *vec, /* o : input vector */ + const Word16 lvec /* i : length of the vector */ ); void mvr2r( const float x[], /* i : input vector */ float y[], /* o : output vector */ - const int16_t n /* i : vector size */ + const Word16 n /* i : vector size */ ); void mvs2s( - const int16_t x[], /* i : input vector */ - int16_t y[], /* o : output vector */ - const int16_t n /* i : vector size */ -); - -uint32_t mvr2s( - const float x[], /* i : input vector */ - int16_t y[], /* o : output vector */ - const int16_t n /* i : vector size */ -); - -void mvs2r( - const int16_t x[], /* i : input vector */ - float y[], /* o : output vector */ - const int16_t n /* i : vector size */ + const Word16 x[], /* i : input vector */ + Word16 y[], /* o : output vector */ + const Word16 n /* i : vector size */ ); void mvl2l( - const int32_t x[], /* i : input vector */ - int32_t y[], /* o : output vector */ - const int16_t n /* i : vector size */ -); - - -/*! r: index of the maximum value in the input vector */ -int16_t maximum( - const float *vec, /* i : input vector */ - const int16_t lvec, /* i : length of input vector */ - float *max_val /* o : maximum value in the input vector */ -); -/*! r: index of the maximum value in the input vector */ -int16_t maximumAbs( - const float *vec, /* i : input vector */ - const int16_t lvec, /* i : length of input vector */ - float *max_val /* o : maximum value in the input vector */ + const Word32 x[], /* i : input vector */ + Word32 y[], /* o : output vector */ + const Word16 n /* i : vector size */ ); Word16 maximumAbs_l( @@ -11014,63 +10958,22 @@ Word16 maximumAbs_l( ); /*! r: index of the minimum value in the input vector */ -int16_t minimum( - const float *vec, /* i : input vector */ - const int16_t lvec, /* i : length of input vector */ - float *min_val /* o : minimum value in the input vector */ -); - -/*! r: index of the minimum value in the input vector */ -int16_t minimum_s( - const int16_t *vec, /* i : Input vector */ - const int16_t lvec, /* i : Vector length */ - int16_t *min_val /* o : minimum value in the input vector */ -); - -/*! r: return index with max energy value in vector */ -int16_t emaximum( - const float *vec, /* i : input vector */ - const int16_t lvec, /* i : length of input vector */ - float *ener_max /* o : maximum energy value */ -); - -/*! r: vector mean */ -float mean( - const float *vec, /* i : input vector */ - const int16_t lvec /* i : length of input vector */ -); - -/*! r: dot product of x[] and y[] */ -float dotp( - const float x[], /* i : vector x[] */ - const float y[], /* i : vector y[] */ - const int16_t n /* i : vector length */ -); - -void v_add( - const float x1[], /* i : Input vector 1 */ - const float x2[], /* i : Input vector 2 */ - float y[], /* o : Output vector that contains vector 1 + vector 2 */ - const int16_t N /* i : Vector length */ -); - -void v_sub( - const float x1[], /* i : Input vector 1 */ - const float x2[], /* i : Input vector 2 */ - float y[], /* o : Output vector that contains vector 1 - vector 2 */ - const int16_t N /* i : Vector length */ +Word16 minimum_s( + const Word16 *vec, /* i : Input vector */ + const Word16 lvec, /* i : Vector length */ + Word16 *min_val /* o : minimum value in the input vector */ ); /*! r: dequanzited gain */ float usdequant( - const int16_t idx, /* i : quantizer index */ - const float qlow, /* i : lowest codebook entry (index 0) */ - const float delta /* i : quantization step */ + const Word16 idx, /* i : quantizer index */ + const float qlow, /* i : lowest codebook entry (index 0) */ + const float delta /* i : quantization step */ ); void sort( - uint16_t *x, /* i/o: Vector to be sorted */ - uint16_t len /* i/o: vector length */ + UWord16 *x, /* i/o: Vector to be sorted */ + UWord16 len /* i/o: vector length */ ); void sort_l( @@ -11081,9 +10984,9 @@ void sort_l( ivas_error push_indice( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - int16_t id, /* i : ID of the indice */ - uint16_t value, /* i : value of the quantized indice */ - int16_t nb_bits /* i : number of bits used to quantize the indice */ + Word16 id, /* i : ID of the indice */ + UWord16 value, /* i : value of the quantized indice */ + Word16 nb_bits /* i : number of bits used to quantize the indice */ ); ivas_error push_next_indice( @@ -11105,8 +11008,8 @@ Word16 get_ivas_max_num_indices_fx( ); /*! r: maximum number of indices */ -int16_t get_BWE_max_num_indices( - const int32_t extl_brate /* i : extensiona layer bitrate */ +Word16 get_BWE_max_num_indices( + const Word32 extl_brate /* i : extensiona layer bitrate */ ); /*! r: maximum number of indices */ @@ -11115,9 +11018,9 @@ Word16 get_ivas_max_num_indices_metadata_fx( const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); ivas_error ind_list_realloc( - INDICE_HANDLE old_ind_list, /* i : pointer to the beginning of the old buffer of indices */ - const int16_t max_num_indices, /* i : new maximum number of allowed indices in the list */ - Encoder_Struct *st_ivas /* i : IVAS encoder structure */ + INDICE_HANDLE old_ind_list, /* i : pointer to the beginning of the old buffer of indices */ + const Word16 max_num_indices, /* i : new maximum number of allowed indices in the list */ + Encoder_Struct *st_ivas /* i : IVAS encoder structure */ ); ivas_error check_ind_list_limits( @@ -11127,44 +11030,44 @@ ivas_error check_ind_list_limits( void move_indices( INDICE_HANDLE old_ind_list, /* i/o: old location of indices */ INDICE_HANDLE new_ind_list, /* i/o: new location of indices */ - const int16_t nb_indices /* i : number of moved indices */ + const Word16 nb_indices /* i : number of moved indices */ ); /*! r: index of the indice in the list, -1 if not found */ -int16_t find_indice( +Word16 find_indice( BSTR_ENC_HANDLE hBstr, /* i : encoder bitstream handle */ - const int16_t id, /* i : ID of the indice */ - uint16_t *value, /* o : value of the quantized indice */ - int16_t *nb_bits /* o : number of bits used to quantize the indice */ + const Word16 id, /* i : ID of the indice */ + UWord16 *value, /* o : value of the quantized indice */ + Word16 *nb_bits /* o : number of bits used to quantize the indice */ ); /*! r: number of deleted indices */ -uint16_t delete_indice( +UWord16 delete_indice( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const int16_t id /* i : ID of the indice */ + const Word16 id /* i : ID of the indice */ ); /*! r: value of the indice */ -uint16_t get_next_indice( +UWord16 get_next_indice( Decoder_State *st, /* i/o: decoder state structure */ - int16_t nb_bits /* i : number of bits that were used to quantize the indice */ + Word16 nb_bits /* i : number of bits that were used to quantize the indice */ ); /*! r: value of the indice */ -uint16_t get_next_indice_1( +UWord16 get_next_indice_1( Decoder_State *st /* i/o: decoder state structure */ ); void get_next_indice_tmp( Decoder_State *st, /* o : decoder state structure */ - int16_t nb_bits /* i : number of bits that were used to quantize the indice */ + Word16 nb_bits /* i : number of bits that were used to quantize the indice */ ); /*! r: value of the indice */ -uint16_t get_indice( +UWord16 get_indice( Decoder_State *st, /* i/o: decoder state structure */ - int16_t pos, /* i : absolute position in the bitstream */ - int16_t nb_bits /* i : number of bits that were used to quantize the indice */ + Word16 pos, /* i : absolute position in the bitstream */ + Word16 nb_bits /* i : number of bits that were used to quantize the indice */ ); void reset_indices_dec( @@ -11173,7 +11076,7 @@ void reset_indices_dec( Word16 rate2EVSmode_float( const Word32 brate, /* i : bitrate */ - int16_t *is_amr_wb /* o : (flag) does the bitrate belong to AMR-WB? Can be NULL */ + Word16 *is_amr_wb /* o : (flag) does the bitrate belong to AMR-WB? Can be NULL */ ); @@ -11200,13 +11103,13 @@ void mdct_switching_dec_fx( Decoder_State *st /* i/o: decoder state structure */ ); -int16_t print_disclaimer( +Word16 print_disclaimer( FILE *fPtr ); void fft_rel( - float x[], /* i/o: input/output vector */ - const int16_t n, /* i : vector length */ - const int16_t m /* i : log2 of vector length */ + float x[], /* i/o: input/output vector */ + const Word16 n, /* i : vector length */ + const Word16 m /* i : log2 of vector length */ ); void preemph_ivas_fx( @@ -11219,8 +11122,8 @@ void preemph_ivas_fx( void create_offset( UWord32 *offset_scale1, UWord32 *offset_scale2, - const int16_t mode, - const int16_t prediction_flag ); + const Word16 mode, + const Word16 prediction_flag ); void BASOP_cfft_ivas( Word32 *re, /* i/o: real part */ @@ -11465,31 +11368,31 @@ void writeTCXWindowing_fx( ); void writeLPCparam( - Encoder_State *st, /* i/o: encoder state structure */ - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - const int16_t param_lpc[], /* i : LPC parameters to write */ - const int16_t bits_param_lpc[], /* i : bits per LPC parameter */ - const int16_t no_param_lpc, /* i : number of LPC parameters */ - int16_t *nbits_lpc /* o : LPC bits written */ + Encoder_State *st, /* i/o: encoder state structure */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + const Word16 param_lpc[], /* i : LPC parameters to write */ + const Word16 bits_param_lpc[], /* i : bits per LPC parameter */ + const Word16 no_param_lpc, /* i : number of LPC parameters */ + Word16 *nbits_lpc /* o : LPC bits written */ ); -void const *GetTnsOnWhite( void const *p, const int16_t index, int16_t *pValue ); -void *SetTnsOnWhite( void *p, const int16_t index, const int16_t value ); -void const *GetNumOfTnsFilters_flt( void const *p, const int16_t index, int16_t *pValue ); -void *SetNumOfTnsFilters_flt( void *p, const int16_t index, const int16_t value ); +void const *GetTnsOnWhite( void const *p, const Word16 index, Word16 *pValue ); +void *SetTnsOnWhite( void *p, const Word16 index, const Word16 value ); +void const *GetNumOfTnsFilters_flt( void const *p, const Word16 index, Word16 *pValue ); +void *SetNumOfTnsFilters_flt( void *p, const Word16 index, const Word16 value ); -int16_t DecodeSWBTCX10TnsFilterCoeff_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); -int16_t DecodeSWBTCX20TnsFilterCoeff_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); +Word16 DecodeSWBTCX10TnsFilterCoeff_flt( Decoder_State *st, const Word16 index, Word16 *pValue ); +Word16 DecodeSWBTCX20TnsFilterCoeff_flt( Decoder_State *st, const Word16 index, Word16 *pValue ); -int16_t DecodeWBTCX20TnsFilterCoeff_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); +Word16 DecodeWBTCX20TnsFilterCoeff_flt( Decoder_State *st, const Word16 index, Word16 *pValue ); -int16_t DecodeTnsFilterOrderSWBTCX10_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); -int16_t DecodeTnsFilterOrderSWBTCX20_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); +Word16 DecodeTnsFilterOrderSWBTCX10_flt( Decoder_State *st, const Word16 index, Word16 *pValue ); +Word16 DecodeTnsFilterOrderSWBTCX20_flt( Decoder_State *st, const Word16 index, Word16 *pValue ); -int16_t EncodeTnsFilterOrderSWBTCX10_flt( const int16_t value, const int16_t index ); +Word16 EncodeTnsFilterOrderSWBTCX10_flt( const Word16 value, const Word16 index ); -int16_t GetTnsFilterOrderBitsSWBTCX10_flt( const int16_t value, const int16_t index ); -int16_t DecodeTnsFilterOrder_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); +Word16 GetTnsFilterOrderBitsSWBTCX10_flt( const Word16 value, const Word16 index ); +Word16 DecodeTnsFilterOrder_flt( Decoder_State *st, const Word16 index, Word16 *pValue ); void ResetTnsData_flt( STnsData *pTnsData ); @@ -11542,7 +11445,7 @@ void analysisCldfbEncoder_ivas_fx( ivas_error openCldfb_ivas( HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ CLDFB_TYPE type, /* i : analysis or synthesis */ - const int32_t sampling_rate, /* i : sampling rate */ + const Word32 sampling_rate, /* i : sampling rate */ CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ ); diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c index 82de45023..5e18430be 100644 --- a/lib_com/tns_base.c +++ b/lib_com/tns_base.c @@ -809,43 +809,19 @@ static Word16 DecodeUsingTable( Decoder_State *st, Word16 *pValue /*Q0*/, const /* TNS filter coefficients */ -int16_t DecodeSWBTCX20TnsFilterCoeff_flt( Decoder_State *st, const int16_t index, int16_t *pValue ) +Word16 DecodeSWBTCX20TnsFilterCoeff_flt( Decoder_State *st, const Word16 index, Word16 *pValue ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return DecodeUsingTable( st, pValue, codesTnsCoeffSWBTCX20[index], nTnsCoeffCodes ); } -// int16_t GetSWBTCX10TnsFilterCoeffBits_flt( const int16_t value, const int16_t index ) -//{ -// assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); -// return GetBitsFromTable( value, codesTnsCoeffSWBTCX10[index], nTnsCoeffCodes ); -// } - -// int16_t EncodeSWBTCX10TnsFilterCoeff_flt( const int16_t value, const int16_t index ) -//{ -// assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); -// return EncodeUsingTable( value, codesTnsCoeffSWBTCX10[index], nTnsCoeffCodes ); -// } - -int16_t DecodeSWBTCX10TnsFilterCoeff_flt( Decoder_State *st, const int16_t index, int16_t *pValue ) +Word16 DecodeSWBTCX10TnsFilterCoeff_flt( Decoder_State *st, const Word16 index, Word16 *pValue ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return DecodeUsingTable( st, pValue, codesTnsCoeffSWBTCX10[index], nTnsCoeffCodes ); } -// int16_t GetWBTCX20TnsFilterCoeffBits_flt( const int16_t value, const int16_t index ) -//{ -// assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); -// return GetBitsFromTable( value, codesTnsCoeffWBTCX20[index], nTnsCoeffCodes ); -// } - -// int16_t EncodeWBTCX20TnsFilterCoeff_flt( const int16_t value, const int16_t index ) -//{ -// assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); -// return EncodeUsingTable( value, codesTnsCoeffWBTCX20[index], nTnsCoeffCodes ); -// } - -int16_t DecodeWBTCX20TnsFilterCoeff_flt( Decoder_State *st, const int16_t index, int16_t *pValue ) +Word16 DecodeWBTCX20TnsFilterCoeff_flt( Decoder_State *st, const Word16 index, Word16 *pValue ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return DecodeUsingTable( st, pValue, codesTnsCoeffWBTCX20[index], nTnsCoeffCodes ); @@ -854,49 +830,25 @@ int16_t DecodeWBTCX20TnsFilterCoeff_flt( Decoder_State *st, const int16_t index, /* TNS filter order */ -// void const *GetTnsFilterOrder_flt( void const *p, const int16_t index, int16_t *pValue ) -//{ -// *pValue = ( (STnsFilter const *) p )[index].order; -// return ( (STnsFilter const *) p )[index].coefIndex; -// } - -// void *SetTnsFilterOrder_flt( void *p, const int16_t index, const int16_t value ) -//{ -// ( (STnsFilter *) p )[index].order = value; -// return ( (STnsFilter *) p )[index].coefIndex; -// } - -// int16_t GetTnsFilterOrderBitsSWBTCX20_flt( const int16_t value, const int16_t index ) -//{ -// (void) index; -// return GetBitsFromTable( value - 1, codesTnsOrderTCX20, nTnsOrderCodes ); -// } - -// int16_t EncodeTnsFilterOrderSWBTCX20_flt( const int16_t value, const int16_t index ) -//{ -// (void) index; -// return EncodeUsingTable( value - 1, codesTnsOrderTCX20, nTnsOrderCodes ); -// } - -int16_t DecodeTnsFilterOrderSWBTCX20_flt( Decoder_State *st, const int16_t index, int16_t *pValue ) +Word16 DecodeTnsFilterOrderSWBTCX20_flt( Decoder_State *st, const Word16 index, Word16 *pValue ) { (void) index; return DecodeUsingTable( st, pValue, codesTnsOrderTCX20, nTnsOrderCodes ); } -int16_t GetTnsFilterOrderBitsSWBTCX10_flt( const int16_t value, const int16_t index ) +Word16 GetTnsFilterOrderBitsSWBTCX10_flt( const Word16 value, const Word16 index ) { (void) index; return GetBitsFromTable( value - 1, codesTnsOrderTCX10, nTnsOrderCodes ); } -int16_t EncodeTnsFilterOrderSWBTCX10_flt( const int16_t value, const int16_t index ) +Word16 EncodeTnsFilterOrderSWBTCX10_flt( const Word16 value, const Word16 index ) { (void) index; return EncodeUsingTable( value - 1, codesTnsOrderTCX10, nTnsOrderCodes ); } -int16_t DecodeTnsFilterOrderSWBTCX10_flt( Decoder_State *st, const int16_t index, int16_t *pValue ) +Word16 DecodeTnsFilterOrderSWBTCX10_flt( Decoder_State *st, const Word16 index, Word16 *pValue ) { (void) index; return DecodeUsingTable( st, pValue, codesTnsOrderTCX10, nTnsOrderCodes ); @@ -1105,42 +1057,36 @@ void *SetTnsEnabled( void *p, const Word16 index, const Word16 value ) /* Number of TNS filters */ -void const *GetNumOfTnsFilters_flt( void const *p, const int16_t index, int16_t *pValue ) +void const *GetNumOfTnsFilters_flt( void const *p, const Word16 index, Word16 *pValue ) { - *pValue = (int16_t) abs( ( (STnsData const *) p )[index].nFilters ); + *pValue = (Word16) abs( ( (STnsData const *) p )[index].nFilters ); return ( (STnsData const *) p )[index].filter; } -void *SetNumOfTnsFilters_flt( void *p, const int16_t index, const int16_t value ) +void *SetNumOfTnsFilters_flt( void *p, const Word16 index, const Word16 value ) { - ( (STnsData *) p )[index].nFilters = (int16_t) abs( value ); + ( (STnsData *) p )[index].nFilters = (Word16) abs( value ); return ( (STnsData *) p )[index].filter; } -int16_t DecodeTnsFilterOrder_flt( Decoder_State *st, const int16_t index, int16_t *pValue ) +Word16 DecodeTnsFilterOrder_flt( Decoder_State *st, const Word16 index, Word16 *pValue ) { (void) index; return DecodeUsingTable( st, pValue, codesTnsOrder, nTnsOrderCodes ); } /* TNS on whitened spectra flag */ -void const *GetTnsOnWhite( void const *p, const int16_t index, int16_t *pValue ) +void const *GetTnsOnWhite( void const *p, const Word16 index, Word16 *pValue ) { *pValue = ( (STnsData const *) p )[index].tnsOnWhitenedSpectra > 0 ? 1 : 0; return NULL; } -void *SetTnsOnWhite( void *p, const int16_t index, const int16_t value ) +void *SetTnsOnWhite( void *p, const Word16 index, const Word16 value ) { ( (STnsData *) p )[index].tnsOnWhitenedSpectra = value; return NULL; } -// void const *GetTnsEnabledSingleFilter( void const *p, const int16_t index, int16_t *pValue ) -//{ -// *pValue = ( (STnsData const *) p )[index].nFilters != 0 ? 1 : 0; -// return ( (STnsData const *) p )[index].filter; -// } - void const *GetTnsEnabledSingleFilter( void const *p, const Word16 index, Word16 *pValue ) { move16(); diff --git a/lib_com/tools.c b/lib_com/tools.c index f7303c6f3..9166d16eb 100644 --- a/lib_com/tools.c +++ b/lib_com/tools.c @@ -47,51 +47,23 @@ *------------------------------------------------------------------*/ /*! r: output random value */ -int16_t own_random( - int16_t *seed /* i/o: random seed */ +Word16 own_random( + Word16 *seed /* i/o: random seed */ ) { - *seed = (int16_t) ( *seed * 31821L + 13849L ); + *seed = (Word16) ( *seed * 31821L + 13849L ); return ( *seed ); } /*--------------------------------------------------------------------- - * sign() + * norm_ul_float() * *---------------------------------------------------------------------*/ -/*! r: sign of x (+1/-1) */ -float sign( - const float x /* i : input value of x */ -) +Word16 norm_ul_float( UWord32 UL_var1 ) { - if ( x < 0.0f ) - { - return -1.0f; - } - else - { - return 1.0f; - } -} - -/*--------------------------------------------------------------------- - * log2_f() - * - *---------------------------------------------------------------------*/ - -/*! r: logarithm2 of x */ -float log2_f( - const float x /* i : input value of x */ -) -{ - return (float) ( log( x ) / log( 2.0f ) ); -} - -int16_t norm_ul_float( uint32_t UL_var1 ) -{ - int16_t var_out; + Word16 var_out; if ( UL_var1 == 0 ) { @@ -99,7 +71,7 @@ int16_t norm_ul_float( uint32_t UL_var1 ) } else { - for ( var_out = 0; UL_var1 < (uint32_t) 0x80000000U; var_out++ ) + for ( var_out = 0; UL_var1 < (UWord32) 0x80000000U; var_out++ ) { UL_var1 <<= 1; } @@ -118,13 +90,13 @@ int16_t norm_ul_float( uint32_t UL_var1 ) *---------------------------------------------------------------------*/ /*! r: sum of all vector elements */ -int16_t sum_s( - const int16_t *vec, /* i : input vector */ - const int16_t lvec /* i : length of input vector */ +Word16 sum_s( + const Word16 *vec, /* i : input vector */ + const Word16 lvec /* i : length of input vector */ ) { - int16_t i; - int16_t tmp; + Word16 i; + Word16 tmp; tmp = 0; for ( i = 0; i < lvec; i++ ) @@ -182,7 +154,7 @@ Word32 sum2_f_16_gb_fx( const Word16 lvec, /* i : length of input vector */ Word16 gb ) { - int16_t i; + Word16 i; Word32 tmp; tmp = 0; @@ -311,7 +283,6 @@ Word32 sum2_32_fx( /*-------------------------------------------------------------------* * set_c() * set_s() - * set_f() * set_l() * set_d() * @@ -319,12 +290,12 @@ Word32 sum2_32_fx( *-------------------------------------------------------------------*/ void set_c( - int8_t y[], /* i/o: Vector to set */ - const int8_t a, /* i : Value to set the vector to */ - const int32_t N /* i : Length of the vector */ + Word8 y[], /* i/o: Vector to set */ + const Word8 a, /* i : Value to set the vector to */ + const Word32 N /* i : Length of the vector */ ) { - int16_t i; + Word16 i; for ( i = 0; i < N; i++ ) { @@ -336,12 +307,12 @@ void set_c( void set_s( - int16_t y[], /* i/o: Vector to set */ - const int16_t a, /* i : Value to set the vector to */ - const int16_t N /* i : Length of the vector */ + Word16 y[], /* i/o: Vector to set */ + const Word16 a, /* i : Value to set the vector to */ + const Word16 N /* i : Length of the vector */ ) { - int16_t i; + Word16 i; for ( i = 0; i < N; i++ ) { @@ -353,28 +324,12 @@ void set_s( void set_l( - int32_t y[], /* i/o: Vector to set */ - const int32_t a, /* i : Value to set the vector to */ - const int16_t N /* i : Length of the vector */ -) -{ - int16_t i; - - for ( i = 0; i < N; i++ ) - { - y[i] = a; - } - - return; -} - -void set_f( - float y[], /* i/o: Vector to set */ - const float a, /* i : Value to set the vector to */ - const int16_t N /* i : Lenght of the vector */ + Word32 y[], /* i/o: Vector to set */ + const Word32 a, /* i : Value to set the vector to */ + const Word16 N /* i : Length of the vector */ ) { - int16_t i; + Word16 i; for ( i = 0; i < N; i++ ) { @@ -391,11 +346,11 @@ void set_f( *---------------------------------------------------------------------*/ void set_zero( - float *vec, /* o : input vector */ - const int16_t lvec /* i : length of the vector */ + float *vec, /* o : input vector */ + const Word16 lvec /* i : length of the vector */ ) { - int16_t i; + Word16 i; for ( i = 0; i < lvec; i++ ) { @@ -409,8 +364,6 @@ void set_zero( /*---------------------------------------------------------------------* * mvr2r() * mvs2s() - * mvr2s() - * mvs2r() * mvr2d() * mvd2r() * @@ -420,10 +373,10 @@ void set_zero( void mvr2r( const float x[], /* i : input vector */ float y[], /* o : output vector */ - const int16_t n /* i : vector size */ + const Word16 n /* i : vector size */ ) { - int16_t i; + Word16 i; if ( n <= 0 ) { @@ -450,12 +403,12 @@ void mvr2r( } void mvs2s( - const int16_t x[], /* i : input vector */ - int16_t y[], /* o : output vector */ - const int16_t n /* i : vector size */ + const Word16 x[], /* i : input vector */ + Word16 y[], /* o : output vector */ + const Word16 n /* i : vector size */ ) { - int16_t i; + Word16 i; if ( n <= 0 ) { @@ -482,12 +435,12 @@ void mvs2s( } void mvl2l( - const int32_t x[], /* i : input vector */ - int32_t y[], /* o : output vector */ - const int16_t n /* i : vector size */ + const Word32 x[], /* i : input vector */ + Word32 y[], /* o : output vector */ + const Word16 n /* i : vector size */ ) { - int16_t i; + Word16 i; if ( n <= 0 ) { @@ -687,32 +640,6 @@ Word16 minimum_l( return ind; } -/*---------------------------------------------------------------------* - * dotp() - * - * Dot product of vector x[] and vector y[] - *---------------------------------------------------------------------*/ - -/*! r: dot product of x[] and y[] */ -float dotp( - const float x[], /* i : vector x[] */ - const float y[], /* i : vector y[] */ - const int16_t n /* i : vector length */ -) -{ - int16_t i; - float suma; - - suma = x[0] * y[0]; - - for ( i = 1; i < n; i++ ) - { - suma += x[i] * y[i]; - } - - return suma; -} - /*---------------------------------------------------------------------* * dotp() * @@ -800,20 +727,6 @@ Word32 dotp_fixed_32( return W_extract_l( suma ); } -/*---------------------------------------------------------------------* - * inv_sqrt() - * - * Find the inverse square root of the input value - *---------------------------------------------------------------------*/ - -/*! r: inverse square root of input value */ -float inv_sqrt( - const float x /* i : input value */ -) -{ - return (float) ( 1.0 / sqrt( x ) ); -} - /*-------------------------------------------------------------------* * v_add_w64() * @@ -839,32 +752,8 @@ void v_add_w64( return; } - -/*-------------------------------------------------------------------* - * v_sub() - * - * Subtraction of two vectors sample by sample - *-------------------------------------------------------------------*/ - -void v_sub( - const float x1[], /* i : Input vector 1 */ - const float x2[], /* i : Input vector 2 */ - float y[], /* o : Output vector that contains vector 1 - vector 2 */ - const int16_t N /* i : Vector length */ -) -{ - int16_t i; - - for ( i = 0; i < N; i++ ) - { - y[i] = x1[i] - x2[i]; - } - - return; -} - /*-------------------------------------------------------------------* - * v_sub() + * v_sub_fixed() * * Subtraction of two vectors sample by sample *-------------------------------------------------------------------*/ @@ -977,9 +866,9 @@ void v_multc_fixed_16_16( *-------------------------------------------------------------------*/ float usdequant( - const int16_t idx, /* i : quantizer index */ - const float qlow, /* i : lowest codebook entry (index 0) */ - const float delta /* i : quantization step */ + const Word16 idx, /* i : quantizer index */ + const float qlow, /* i : lowest codebook entry (index 0) */ + const float delta /* i : quantization step */ ) { float g; diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 14a97a034..77e779efd 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -241,9 +241,9 @@ void fix2f_16( Word16 *var_fix, float *var_flt, Word32 expo ) #undef WMC_TOOL_SKIP -int16_t norm_ul( uint32_t UL_var1 ) +Word16 norm_ul( UWord32 UL_var1 ) { - int16_t var_out; + Word16 var_out; if ( UL_var1 == 0 ) { @@ -251,7 +251,7 @@ int16_t norm_ul( uint32_t UL_var1 ) } else { - for ( var_out = 0; UL_var1 < (uint32_t) 0x80000000U; var_out++ ) + for ( var_out = 0; UL_var1 < (UWord32) 0x80000000U; var_out++ ) { UL_var1 <<= 1; } @@ -997,7 +997,7 @@ void scale_sig( } /*---------------------------------------------------------------------* - * mean() + * mean_fx() * *---------------------------------------------------------------------*/ Word16 mean_fx( /* o : mean of vector */ @@ -2171,7 +2171,7 @@ Word16 own_random2_fx( Word16 seed ) } /*--------------------------------------------------------------------- - * sign() + * sign_fx() * *---------------------------------------------------------------------*/ @@ -4207,7 +4207,7 @@ Word16 lin_interp_ivas_fx( } /*--------------------------------------------------------------------- - * sign() + * sign_l() * *---------------------------------------------------------------------*/ @@ -4245,7 +4245,7 @@ void v_mult16_fixed( } /*---------------------------------------------------------------------* - * set_zero() + * set_zero_fx() * * Set a vector vec[] of dimension lvec to zero *---------------------------------------------------------------------*/ diff --git a/lib_dec/dec_acelp_tcx_main_fx.c b/lib_dec/dec_acelp_tcx_main_fx.c index 21bf7cf12..eea558914 100644 --- a/lib_dec/dec_acelp_tcx_main_fx.c +++ b/lib_dec/dec_acelp_tcx_main_fx.c @@ -364,7 +364,7 @@ Word16 dec_acelp_tcx_frame_fx( { /* Copy back parameters from previous frame, because there is a high risk they are corrupt * DO concealment with configuration used in previous frame */ - st->m_frame_type = (uint8_t) m_frame_type; + st->m_frame_type = (UWord8) m_frame_type; move16(); st->bwidth = bwidth; move16(); diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index 6ba21136e..f942a19ff 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -38,7 +38,6 @@ ivas_error acelp_core_enc_fx( Word16 pitch_buf_fx[NB_SUBFR16k], /* o : floating pitch for each subframe Q6*/ Word16 *unbits_fx, /* o : number of unused bits Q0*/ STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ - const float tdm_lsfQ_PCh[M], /* i : Q LSFs for primary channel */ const Word16 Q_new, const Word16 shift ) { @@ -107,8 +106,6 @@ ivas_error acelp_core_enc_fx( * Initialization *------------------------------------------------------------------*/ - (void) tdm_lsfQ_PCh; - Es_pred_fx = 0; move16(); diff --git a/lib_enc/evs_enc_fx.c b/lib_enc/evs_enc_fx.c index 624ec20fc..8e9a82378 100644 --- a/lib_enc/evs_enc_fx.c +++ b/lib_enc/evs_enc_fx.c @@ -269,7 +269,7 @@ ivas_error evs_enc_fx( IF( EQ_16( st->core, ACELP_CORE ) ) { acelp_core_enc_fx( st, inp, ener, A, Aw, epsP_h, epsP_l, lsp_new, lsp_mid, vad_hover_flag, - attack_flag, bwe_exc_extended, voice_factors, old_syn_12k8_16k, pitch_buf, &unbits, NULL, NULL, Q_new, shift ); + attack_flag, bwe_exc_extended, voice_factors, old_syn_12k8_16k, pitch_buf, &unbits, NULL, Q_new, shift ); } /*---------------------------------------------------------------------* * HQ core encoding diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 72137bdce..d3528370f 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -61,7 +61,6 @@ ivas_error acelp_core_enc_fx( Word16 pitch_buf_fx[NB_SUBFR16k], /* o : floating pitch for each subframe Q6*/ Word16 *unbits_fx, /* o : number of unused bits Q0*/ STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ - const float tdm_lsfQ_PCh[M], /* i : Q LSFs for primary channel */ const Word16 Q_new, const Word16 shift diff --git a/lib_enc/rom_enc.h b/lib_enc/rom_enc.h index 35fd3027d..7da1da92a 100644 --- a/lib_enc/rom_enc.h +++ b/lib_enc/rom_enc.h @@ -52,7 +52,6 @@ extern const Word16 W_HIST_S_FX[DTX_HIST_SIZE]; /* CNG & DTX - table for calcula extern const Word16 bwd_start_bin[]; // Q0 extern const Word16 bwd_end_bin[]; // Q0 -extern const float h_fir[]; /* 2nd order fir filter for wsp, decimation by 2 */ extern const Word16 h_fir_fx[]; /* 2nd order fir filter for wsp, decimation by 2 Q15*/ extern const Word16 preemphCompensation_fx[]; // Q11 diff --git a/lib_rend/ivas_rom_rend.h b/lib_rend/ivas_rom_rend.h index f62440749..7f9cfb57a 100644 --- a/lib_rend/ivas_rom_rend.h +++ b/lib_rend/ivas_rom_rend.h @@ -121,10 +121,6 @@ extern const Word32 ivas_reverb_default_fc_fx[]; /*Q-16*/ extern const Word32 ivas_reverb_default_RT60_fx[]; /*Q-26*/ extern const Word32 ivas_reverb_default_DSR_fx[]; /*Q-30*/ -extern const float ivas_reverb_default_fc[]; -extern const float ivas_reverb_default_RT60[]; -extern const float ivas_reverb_default_DSR[]; - extern const Word32 release_cnst_table[4][201]; // Q31 /*----------------------------------------------------------------------------------* diff --git a/lib_rend/ivas_rom_rend_fx.c b/lib_rend/ivas_rom_rend_fx.c index 4f101582c..d14be4afe 100644 --- a/lib_rend/ivas_rom_rend_fx.c +++ b/lib_rend/ivas_rom_rend_fx.c @@ -561,42 +561,6 @@ const Word32 ivas_reverb_default_DSR_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q30*/ = 66, 30, 28 }; -const float ivas_reverb_default_fc[IVAS_REVERB_DEFAULT_N_BANDS] = -{ - 20.0f, 25.0f, 31.5f, 40.0f, - 50.0f, 63.0f, 80.0f, 100.0f, - 125.0f, 160.0f, 200.0f, 250.0f, - 315.0f, 400.0f, 500.0f, 630.0f, - 800.0f, 1000.0f, 1250.0f, 1600.0f, - 2000.0f, 2500.0f, 3150.0f, 4000.0f, - 5000.0f, 6300.0f, 8000.0f, 10000.0f, - 12500.0f, 16000.0f, 20000.0f -}; - -const float ivas_reverb_default_RT60[IVAS_REVERB_DEFAULT_N_BANDS] = -{ - 1.3622f, 1.4486f, 1.3168f, 1.5787f, - 1.4766f, 1.3954f, 1.2889f, 1.3462f, - 1.0759f, 1.0401f, 1.097f, 1.085f, - 1.091f, 1.0404f, 1.0499f, 1.0699f, - 1.1028f, 1.1714f, 1.1027f, 1.0666f, - 1.055f, 1.0553f, 1.0521f, 1.0569f, - 1.0421f, 0.97822f, 0.80487f, 0.75944f, - 0.71945f, 0.61682f, 0.60031f -}; - -const float ivas_reverb_default_DSR[IVAS_REVERB_DEFAULT_N_BANDS] = -{ - 1.8811e-08f, 2.1428e-08f, 1.3972e-08f, 1.51e-08f, - 1.287e-08f, 1.8747e-08f, 2.413e-08f, 3.9927e-08f, - 8.9719e-08f, 1.902e-07f, 3.702e-07f, 6.1341e-07f, - 7.1432e-07f, 6.5331e-07f, 4.6094e-07f, 5.4683e-07f, - 7.0134e-07f, 6.856e-07f, 7.114e-07f, 6.9604e-07f, - 5.2939e-07f, 5.699e-07f, 6.1773e-07f, 5.7488e-07f, - 4.7748e-07f, 2.7213e-07f, 1.3681e-07f, 1.0941e-07f, - 6.2001e-08f, 2.8483e-08f, 2.6267e-08f -}; - const Word32 release_cnst_table[4][201] = // Q31 { { -- GitLab