From c629edc318b56ce70135b5392835d4da41c5c9dc Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 20 Feb 2024 15:03:03 +0530 Subject: [PATCH] Fix for issue 684 [x] Increasing Synthesis_STFT_fx guard bits for crash issue [x] get_next_index_4_by_15 table value supports Word16. Last entry changed from 32768 to 32767. [x] coherence_flt value updation logic changed. --- lib_dec/fd_cng_dec.c | 2 +- lib_dec/ivas_decision_matrix_dec.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 812356c56..fe0e21b35 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -1244,7 +1244,7 @@ void generate_comfort_noise_dec_flt( SynthesisSTFT_flt( fftBuffer, timeDomainOutput, hFdCngCom->olapBufferSynth_flt, hFdCngCom->olapWinSyn_flt, tcx_transition, hFdCngCom, st->element_mode, nchan_out ); #else Word32 fftBuffer_fx[FFTLEN], timeDomainBuffer_fx[L_FRAME16k]; - Word16 exp = Q15; + Word16 exp = Q14; for ( i = 0; i < hFdCngCom->fftlen; i++ ) { fftBuffer_fx[i] = float_to_fix( fftBuffer[i], exp ); diff --git a/lib_dec/ivas_decision_matrix_dec.c b/lib_dec/ivas_decision_matrix_dec.c index 1a309f9b8..c90f6c1a3 100644 --- a/lib_dec/ivas_decision_matrix_dec.c +++ b/lib_dec/ivas_decision_matrix_dec.c @@ -50,7 +50,7 @@ #ifdef IVAS_FLOAT_FIXED static Word16 get_next_index_4_by_15[16] = { - 0, 2184, 4369, 6553, 8738, 10922, 13107, 15291, 17476, 19660, 21845, 24029, 26214, 28398, 30583, 32768 + 0, 2184, 4369, 6553, 8738, 10922, 13107, 15291, 17476, 19660, 21845, 24029, 26214, 28398, 30583, 32767 }; #endif @@ -547,7 +547,7 @@ void ivas_decision_matrix_dec_fx( st->hFdCngDec->hFdCngCom->coherence_fx = get_next_index_4_by_15[index]; /* TODO: remove floating point dependency */ - st->hFdCngDec->hFdCngCom->coherence_flt = get_next_index_4_by_15[index] / ( 1 << 15 ); + st->hFdCngDec->hFdCngCom->coherence_flt = ( (float) get_next_index_4_by_15[index] ) / ( ( 1 << 15 ) - 1 ); /* read flag for no side noise shape */ st->hFdCngDec->hFdCngCom->no_side_flag = get_next_indice( st, 1 ); -- GitLab