Loading lib_com/ivas_prot.h +30 −0 Original line number Diff line number Diff line Loading @@ -1406,6 +1406,13 @@ void stereo_dft_quantize_res_gains( int16_t *ig, int16_t *ir ); #ifdef IVAS_FLOAT_FIXED void stereo_dft_dequantize_itd_fx( Word16 *ind, Word32 *out, const Word32 output_Fs ); #endif // IVAS_FLOAT_FIXED void stereo_dft_dequantize_itd( int16_t *ind, Loading @@ -1428,6 +1435,14 @@ void stereo_dft_enc_sid_coh( int16_t *nb_bits, /* i/o: number of bits written */ float *cohBand /* i/o: Coherence per band */ ); #ifdef IVAS_FLOAT_FIXED void stereo_dft_dec_sid_coh_fx( Decoder_State *st, /* i/o: decoder state structure */ const Word16 nbands, /* i : number of DFT stereo bands */ Word16 *coh, /* i/o: coherence */ Word16 *nb_bits /* i/o: number of bits read */ ); #endif // IVAS_FLOAT_FIXED void stereo_dft_dec_sid_coh( Decoder_State *st, /* i/o: decoder state structure */ Loading Loading @@ -1559,6 +1574,21 @@ void bpf_pitch_coherence( Decoder_State *st, /* i/o: decoder state structure */ const float pitch_buf[] /* i : pitch for each subframe [0,1,2,3] */ ); #ifdef IVAS_FLOAT_FIXED void stereo_dft_dec_read_BS_fx( const Word32 ivas_total_brate, /* i : IVAS total bitrate */ const Word32 element_brate, /* i : element bitrate */ Word32 *total_brate, /* o : total bitrate */ Decoder_State *st, /* i/o: decoder state structure */ STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder stereo handle */ const Word16 bwidth, /* i : bandwidth */ const Word16 output_frame, /* i : output frame length */ Word32 res_buf[STEREO_DFT_N_8k], /* o : residual buffer */ Word16 *nb_bits, /* o : number of bits read */ Word16 *coh, /* i/o: Coherence */ const Word16 ivas_format /* i : ivas format */ ); #endif // IVAS_FLOAT_FIXED void stereo_dft_dec_read_BS( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ Loading lib_com/ivas_rom_com.c +18 −0 Original line number Diff line number Diff line Loading @@ -930,12 +930,30 @@ const float dft_cng_coh_pred[STEREO_DFT_N_COH_PRED][STEREO_DFT_COH_PRED_COEFFS] { 0.202543f, 0.048819f, 0.263407f, 0.023538f, 0.092021f, 0.395655f, 0.013064f, -0.011127f, 0.035466f, 0.976055f, 0.009968f, 0.162957f, 0.383185f, -0.365493f, 2.534677f}, { 1.393664f, -0.131401f, 0.989429f, 0.738330f, 0.683865f, 0.001677f, -0.225448f, -0.012158f, 1.084608f, -0.115464f, 0.022371f, -0.045560f, -0.336230f, 0.422742f, 0.499163f} }; #ifdef IVAS_FLOAT_FIXED const Word16 dft_cng_coh_pred_fx[STEREO_DFT_N_COH_PRED][STEREO_DFT_COH_PRED_COEFFS] /*Q-13*/= { { 4926, -827, 10396, 696, 2285, 5488, 668, 1547, -1416, 2633, 76, -690, 2967, -3495, 6212 }, { 7007, 3446, 3385, -76, -3274, 11352, 101, -125, 1281, 4238, 1312, -2487, 3913, -4593, 11326 }, { 1659, 399, 2157, 192, 753, 3241, 107, -91, 290, 7995, 81, 1334, 3139, -2994, 20764 }, { 11416, -1076, 8105, 6048, 5602, 13, -1846, -99, 8885, -945, 183, -373, -2754, 3463, 4089 } }; #endif // IVAS_FLOAT_FIXED const int16_t dft_cng_coh_u2i[9] = { 4, 5, 3, 6, 2, 7, 1, 8, 0 }; /* Coherence unary codeword -> residual codeword conversion table */ const int16_t dft_cng_coh_i2u[9] = { 8, 6, 4, 2, 0, 1, 3, 5, 7 }; /* Coherence residual codeword -> unary codeword conversion table */ const int16_t dft_cng_coh_alpha_start[STEREO_DFT_N_COH_ALPHA_STEPS - 1] = { 15, 16, 17, 18 }; #ifdef IVAS_FLOAT_FIXED const Word16 dft_cng_alpha_bits_fx[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS]/*Q-15*/ = { { 3277/*0.1f*/, 19661/*0.6f*/ }, { 3277/*0.1f*/, 19661/*0.6f*/ }, { 3277/*0.1f*/, 22938/*0.7f*/ }, { 3277/*0.1f*/, 29491/*0.9f*/ }, { 6554/*0.2f*/, 29491/*0.9f*/ } }; #endif // IVAS_FLOAT_FIXED const float dft_cng_alpha_bits[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS] = { Loading lib_com/ivas_rom_com.h +4 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,10 @@ extern const float dft_cng_coh_pred[][STEREO_DFT_COH_PRED_COEFFS]; extern const int16_t dft_cng_coh_u2i[9]; extern const int16_t dft_cng_coh_i2u[9]; extern const float dft_cng_alpha_bits[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS]; #ifdef IVAS_FLOAT_FIXED extern const Word16 dft_cng_alpha_bits_fx[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS]; extern const Word16 dft_cng_coh_pred_fx[][STEREO_DFT_COH_PRED_COEFFS]; #endif // IVAS_FLOAT_FIXED extern const int16_t dft_cng_coh_alpha_start[STEREO_DFT_N_COH_ALPHA_STEPS - 1]; /*----------------------------------------------------------------------------------* Loading lib_dec/ivas_cpe_dec_fx.c +27 −0 Original line number Diff line number Diff line Loading @@ -288,7 +288,34 @@ ivas_error ivas_cpe_dec_fx( } } #ifdef IVAS_FLOAT_FIXED #if 1 Word16 Q_coh = 13, Q_res_buf = 8; // Q_res_buf = Q_factor_arrL( res_buf, STEREO_DFT_N_8k ); floatToFixed_arr(hCPE->hStereoCng->coh, hCPE->hStereoCng->coh_fx, Q_coh, 14 ); floatToFixed_arrL( res_buf, res_buf_fx, Q_res_buf, STEREO_DFT_N_8k ); floatToFixed_arrL(hCPE->hStereoDft->side_gain, hCPE->hStereoDft->side_gain_fx, 31, 39 ); floatToFixed_arrL(hCPE->hStereoDft->res_pred_gain, hCPE->hStereoDft->res_pred_gain_fx, 31, 39 ); floatToFixed_arrL(hCPE->hStereoDft->itd, hCPE->hStereoDft->itd_fx, Q15, 3 ); floatToFixed_arrL( hCPE->hStereoDft->gipd, hCPE->hStereoDft->gipd_fx, Q13, 3 ); hCPE->hStereoDft->itd_xfade_target_fx = floatToFixed( hCPE->hStereoDft->itd_xfade_target, 15 ); hCPE->hStereoDft->ipd_xfade_target_fx = floatToFixed( hCPE->hStereoDft->ipd_xfade_target, 13 ); floatToFixed_arrL( &hCPE->hStereoDft->res_gains_ind[0][0], &hCPE->hStereoDft->res_gains_ind_fx[0][0], Q26, 2 * 26 ); #endif stereo_dft_dec_read_BS_fx( ivas_total_brate, hCPE->element_brate, &sts[0]->total_brate, sts[1], hCPE->hStereoDft, sts[0]->bwidth, output_frame, res_buf_fx, &nb_bits, hCPE->hStereoCng->coh_fx, st_ivas->ivas_format ); #if 1 /*Fixed To Float changes*/ fixedToFloat_arr( hCPE->hStereoCng->coh_fx, hCPE->hStereoCng->coh, Q_coh, 14 ); /*Q-13*/ fixedToFloat_arrL( hCPE->hStereoDft->itd_fx, hCPE->hStereoDft->itd, Q15, 3 ); fixedToFloat_arrL( hCPE->hStereoDft->gipd_fx, hCPE->hStereoDft->gipd, Q13, 3 ); fixedToFloat_arrL( hCPE->hStereoDft->side_gain_fx, hCPE->hStereoDft->side_gain, 31, 39 ); fixedToFloat_arrL( hCPE->hStereoDft->res_pred_gain_fx, hCPE->hStereoDft->res_pred_gain, 31, 39 ); fixedToFloat_arrL( &hCPE->hStereoDft->res_gains_ind_fx[0][0], &hCPE->hStereoDft->res_gains_ind[0][0], Q26, 2 * 26 ); hCPE->hStereoDft->res_global_gain = ( (float) hCPE->hStereoDft->res_global_gain_fx / ONE_IN_Q15 ); fixedToFloat_arrL( res_buf_fx, res_buf, Q_res_buf, STEREO_DFT_N_8k ); #endif #else stereo_dft_dec_read_BS( ivas_total_brate, hCPE->element_brate, &sts[0]->total_brate, sts[1], hCPE->hStereoDft, sts[0]->bwidth, output_frame, res_buf, &nb_bits, hCPE->hStereoCng->coh, st_ivas->ivas_format ); #endif } /* subtract metadata bitbudget */ Loading lib_dec/ivas_stat_dec.h +2 −0 Original line number Diff line number Diff line Loading @@ -215,6 +215,7 @@ typedef struct stereo_dft_dec_data_struct Word16 q_ip_mem; Word16 q_smoothed_nrg; Word16 q_DFT_past_DMX_fx[STEREO_DFT_PAST_MAX]; Word32 res_global_gain_fx; #endif // IVAS_FLOAT_FIXED float res_cod_mem[STEREO_DFT_OVL_8k]; float buff_LBTCX_mem[NS2SA( 16000, STEREO_DFT32MS_OVL_NS )]; Loading Loading @@ -356,6 +357,7 @@ typedef struct stereo_dec_cng float cm[STEREO_DFT_BAND_MAX]; /* cm */ #ifdef IVAS_FLOAT_FIXED Word16 cm_fx[STEREO_DFT_BAND_MAX]; /* cm */ Word16 coh_fx[STEREO_DFT_BAND_MAX + 1]; /* coherence */ #endif int16_t first_SID; /* first SID indicator */ int16_t first_SID_after_TD; /* first SID after TD-stereo indicator */ Loading Loading
lib_com/ivas_prot.h +30 −0 Original line number Diff line number Diff line Loading @@ -1406,6 +1406,13 @@ void stereo_dft_quantize_res_gains( int16_t *ig, int16_t *ir ); #ifdef IVAS_FLOAT_FIXED void stereo_dft_dequantize_itd_fx( Word16 *ind, Word32 *out, const Word32 output_Fs ); #endif // IVAS_FLOAT_FIXED void stereo_dft_dequantize_itd( int16_t *ind, Loading @@ -1428,6 +1435,14 @@ void stereo_dft_enc_sid_coh( int16_t *nb_bits, /* i/o: number of bits written */ float *cohBand /* i/o: Coherence per band */ ); #ifdef IVAS_FLOAT_FIXED void stereo_dft_dec_sid_coh_fx( Decoder_State *st, /* i/o: decoder state structure */ const Word16 nbands, /* i : number of DFT stereo bands */ Word16 *coh, /* i/o: coherence */ Word16 *nb_bits /* i/o: number of bits read */ ); #endif // IVAS_FLOAT_FIXED void stereo_dft_dec_sid_coh( Decoder_State *st, /* i/o: decoder state structure */ Loading Loading @@ -1559,6 +1574,21 @@ void bpf_pitch_coherence( Decoder_State *st, /* i/o: decoder state structure */ const float pitch_buf[] /* i : pitch for each subframe [0,1,2,3] */ ); #ifdef IVAS_FLOAT_FIXED void stereo_dft_dec_read_BS_fx( const Word32 ivas_total_brate, /* i : IVAS total bitrate */ const Word32 element_brate, /* i : element bitrate */ Word32 *total_brate, /* o : total bitrate */ Decoder_State *st, /* i/o: decoder state structure */ STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder stereo handle */ const Word16 bwidth, /* i : bandwidth */ const Word16 output_frame, /* i : output frame length */ Word32 res_buf[STEREO_DFT_N_8k], /* o : residual buffer */ Word16 *nb_bits, /* o : number of bits read */ Word16 *coh, /* i/o: Coherence */ const Word16 ivas_format /* i : ivas format */ ); #endif // IVAS_FLOAT_FIXED void stereo_dft_dec_read_BS( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ Loading
lib_com/ivas_rom_com.c +18 −0 Original line number Diff line number Diff line Loading @@ -930,12 +930,30 @@ const float dft_cng_coh_pred[STEREO_DFT_N_COH_PRED][STEREO_DFT_COH_PRED_COEFFS] { 0.202543f, 0.048819f, 0.263407f, 0.023538f, 0.092021f, 0.395655f, 0.013064f, -0.011127f, 0.035466f, 0.976055f, 0.009968f, 0.162957f, 0.383185f, -0.365493f, 2.534677f}, { 1.393664f, -0.131401f, 0.989429f, 0.738330f, 0.683865f, 0.001677f, -0.225448f, -0.012158f, 1.084608f, -0.115464f, 0.022371f, -0.045560f, -0.336230f, 0.422742f, 0.499163f} }; #ifdef IVAS_FLOAT_FIXED const Word16 dft_cng_coh_pred_fx[STEREO_DFT_N_COH_PRED][STEREO_DFT_COH_PRED_COEFFS] /*Q-13*/= { { 4926, -827, 10396, 696, 2285, 5488, 668, 1547, -1416, 2633, 76, -690, 2967, -3495, 6212 }, { 7007, 3446, 3385, -76, -3274, 11352, 101, -125, 1281, 4238, 1312, -2487, 3913, -4593, 11326 }, { 1659, 399, 2157, 192, 753, 3241, 107, -91, 290, 7995, 81, 1334, 3139, -2994, 20764 }, { 11416, -1076, 8105, 6048, 5602, 13, -1846, -99, 8885, -945, 183, -373, -2754, 3463, 4089 } }; #endif // IVAS_FLOAT_FIXED const int16_t dft_cng_coh_u2i[9] = { 4, 5, 3, 6, 2, 7, 1, 8, 0 }; /* Coherence unary codeword -> residual codeword conversion table */ const int16_t dft_cng_coh_i2u[9] = { 8, 6, 4, 2, 0, 1, 3, 5, 7 }; /* Coherence residual codeword -> unary codeword conversion table */ const int16_t dft_cng_coh_alpha_start[STEREO_DFT_N_COH_ALPHA_STEPS - 1] = { 15, 16, 17, 18 }; #ifdef IVAS_FLOAT_FIXED const Word16 dft_cng_alpha_bits_fx[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS]/*Q-15*/ = { { 3277/*0.1f*/, 19661/*0.6f*/ }, { 3277/*0.1f*/, 19661/*0.6f*/ }, { 3277/*0.1f*/, 22938/*0.7f*/ }, { 3277/*0.1f*/, 29491/*0.9f*/ }, { 6554/*0.2f*/, 29491/*0.9f*/ } }; #endif // IVAS_FLOAT_FIXED const float dft_cng_alpha_bits[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS] = { Loading
lib_com/ivas_rom_com.h +4 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,10 @@ extern const float dft_cng_coh_pred[][STEREO_DFT_COH_PRED_COEFFS]; extern const int16_t dft_cng_coh_u2i[9]; extern const int16_t dft_cng_coh_i2u[9]; extern const float dft_cng_alpha_bits[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS]; #ifdef IVAS_FLOAT_FIXED extern const Word16 dft_cng_alpha_bits_fx[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS]; extern const Word16 dft_cng_coh_pred_fx[][STEREO_DFT_COH_PRED_COEFFS]; #endif // IVAS_FLOAT_FIXED extern const int16_t dft_cng_coh_alpha_start[STEREO_DFT_N_COH_ALPHA_STEPS - 1]; /*----------------------------------------------------------------------------------* Loading
lib_dec/ivas_cpe_dec_fx.c +27 −0 Original line number Diff line number Diff line Loading @@ -288,7 +288,34 @@ ivas_error ivas_cpe_dec_fx( } } #ifdef IVAS_FLOAT_FIXED #if 1 Word16 Q_coh = 13, Q_res_buf = 8; // Q_res_buf = Q_factor_arrL( res_buf, STEREO_DFT_N_8k ); floatToFixed_arr(hCPE->hStereoCng->coh, hCPE->hStereoCng->coh_fx, Q_coh, 14 ); floatToFixed_arrL( res_buf, res_buf_fx, Q_res_buf, STEREO_DFT_N_8k ); floatToFixed_arrL(hCPE->hStereoDft->side_gain, hCPE->hStereoDft->side_gain_fx, 31, 39 ); floatToFixed_arrL(hCPE->hStereoDft->res_pred_gain, hCPE->hStereoDft->res_pred_gain_fx, 31, 39 ); floatToFixed_arrL(hCPE->hStereoDft->itd, hCPE->hStereoDft->itd_fx, Q15, 3 ); floatToFixed_arrL( hCPE->hStereoDft->gipd, hCPE->hStereoDft->gipd_fx, Q13, 3 ); hCPE->hStereoDft->itd_xfade_target_fx = floatToFixed( hCPE->hStereoDft->itd_xfade_target, 15 ); hCPE->hStereoDft->ipd_xfade_target_fx = floatToFixed( hCPE->hStereoDft->ipd_xfade_target, 13 ); floatToFixed_arrL( &hCPE->hStereoDft->res_gains_ind[0][0], &hCPE->hStereoDft->res_gains_ind_fx[0][0], Q26, 2 * 26 ); #endif stereo_dft_dec_read_BS_fx( ivas_total_brate, hCPE->element_brate, &sts[0]->total_brate, sts[1], hCPE->hStereoDft, sts[0]->bwidth, output_frame, res_buf_fx, &nb_bits, hCPE->hStereoCng->coh_fx, st_ivas->ivas_format ); #if 1 /*Fixed To Float changes*/ fixedToFloat_arr( hCPE->hStereoCng->coh_fx, hCPE->hStereoCng->coh, Q_coh, 14 ); /*Q-13*/ fixedToFloat_arrL( hCPE->hStereoDft->itd_fx, hCPE->hStereoDft->itd, Q15, 3 ); fixedToFloat_arrL( hCPE->hStereoDft->gipd_fx, hCPE->hStereoDft->gipd, Q13, 3 ); fixedToFloat_arrL( hCPE->hStereoDft->side_gain_fx, hCPE->hStereoDft->side_gain, 31, 39 ); fixedToFloat_arrL( hCPE->hStereoDft->res_pred_gain_fx, hCPE->hStereoDft->res_pred_gain, 31, 39 ); fixedToFloat_arrL( &hCPE->hStereoDft->res_gains_ind_fx[0][0], &hCPE->hStereoDft->res_gains_ind[0][0], Q26, 2 * 26 ); hCPE->hStereoDft->res_global_gain = ( (float) hCPE->hStereoDft->res_global_gain_fx / ONE_IN_Q15 ); fixedToFloat_arrL( res_buf_fx, res_buf, Q_res_buf, STEREO_DFT_N_8k ); #endif #else stereo_dft_dec_read_BS( ivas_total_brate, hCPE->element_brate, &sts[0]->total_brate, sts[1], hCPE->hStereoDft, sts[0]->bwidth, output_frame, res_buf, &nb_bits, hCPE->hStereoCng->coh, st_ivas->ivas_format ); #endif } /* subtract metadata bitbudget */ Loading
lib_dec/ivas_stat_dec.h +2 −0 Original line number Diff line number Diff line Loading @@ -215,6 +215,7 @@ typedef struct stereo_dft_dec_data_struct Word16 q_ip_mem; Word16 q_smoothed_nrg; Word16 q_DFT_past_DMX_fx[STEREO_DFT_PAST_MAX]; Word32 res_global_gain_fx; #endif // IVAS_FLOAT_FIXED float res_cod_mem[STEREO_DFT_OVL_8k]; float buff_LBTCX_mem[NS2SA( 16000, STEREO_DFT32MS_OVL_NS )]; Loading Loading @@ -356,6 +357,7 @@ typedef struct stereo_dec_cng float cm[STEREO_DFT_BAND_MAX]; /* cm */ #ifdef IVAS_FLOAT_FIXED Word16 cm_fx[STEREO_DFT_BAND_MAX]; /* cm */ Word16 coh_fx[STEREO_DFT_BAND_MAX + 1]; /* coherence */ #endif int16_t first_SID; /* first SID indicator */ int16_t first_SID_after_TD; /* first SID after TD-stereo indicator */ Loading