From 81c06eb80a46d05587104561824b316ff85cf91f Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 16 Jan 2024 21:40:21 +0530 Subject: [PATCH] EVS BE issue fix [x] Few changes in an MR caused EVS bitexactness issue. This has been addressed in this commit. --- lib_com/prot_fx2.h | 12 +++++++- lib_dec/dec_prm_fx.c | 2 +- lib_dec/tns_base_dec_fx.c | 62 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 73 insertions(+), 3 deletions(-) diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index f76c37783..71f5be36b 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -7340,7 +7340,6 @@ void tcx_hm_modify_envelope( ); //tns_base_dec_fx.c -#define IVAS_CODE #ifdef IVAS_CODE void #else @@ -7351,6 +7350,17 @@ ReadTnsData(STnsConfig const * pTnsConfig, Word16 * pnBits, Word16 * stream, Word16 * pnSize); +#define IVAS_CODE +#ifdef IVAS_CODE +void +#else +Word16 +#endif +ReadTnsData_ivas_fx(STnsConfig const * pTnsConfig, + Decoder_State *st, + Word16 * pnBits, + Word16 * stream, + Word16 * pnSize); #undef IVAS_CODE Word16 DecodeTnsData(STnsConfig const * pTnsConfig, diff --git a/lib_dec/dec_prm_fx.c b/lib_dec/dec_prm_fx.c index 1c2b5eba1..44b8b606b 100644 --- a/lib_dec/dec_prm_fx.c +++ b/lib_dec/dec_prm_fx.c @@ -327,7 +327,7 @@ void getTCXparam( } ELSE { - ReadTnsData( st->hTcxCfg->pCurrentTnsConfig, st0, &nTnsBits, prm + j, &nTnsParams ); + ReadTnsData_ivas_fx( st->hTcxCfg->pCurrentTnsConfig, st0, &nTnsBits, prm + j, &nTnsParams ); } hTcxDec->tnsActive[k] = 0; IF( prm[j] != 0 ) diff --git a/lib_dec/tns_base_dec_fx.c b/lib_dec/tns_base_dec_fx.c index 6ca2e7752..7aa47ecbd 100644 --- a/lib_dec/tns_base_dec_fx.c +++ b/lib_dec/tns_base_dec_fx.c @@ -27,14 +27,74 @@ typedef Word32 (* TLinearPredictionFilter)(Word16 order, Word16 const parCoeff[] * * *---------------------------------------------------------------------*/ +#ifdef IVAS_CODE +void +#else +Word16 +#endif +ReadTnsData( + STnsConfig const *pTnsConfig, + Decoder_State *st, + Word16 *pnBits, + Word16 *stream, + Word16 *pnSize ) +{ + Word16 start_bit_pos; + + + move16(); + start_bit_pos = st->next_bit_pos; + + IF( GT_16( pTnsConfig->nMaxFilters, 1 ) ) + { +#ifdef IVAS_CODE + IF( pTnsConfig->allowTnsOnWhite ) + { + IF( LT_16( pTnsConfig->iFilterBorders[0], 512 ) ) + { + ReadFromBitstream( &tnsEnabledOnWhiteSWBTCX10BitMap, 1, st, &stream, pnSize ); + } + ELSE + { + ReadFromBitstream( &tnsEnabledOnWhiteSWBTCX20BitMap, 1, st, &stream, pnSize ); + } + } + ELSE +#endif + { + + IF( LT_16( pTnsConfig->iFilterBorders[0], 512 ) ) + { + ReadFromBitstream( &tnsEnabledSWBTCX10BitMap, 1, st, &stream, pnSize ); + } + ELSE + { + ReadFromBitstream( &tnsEnabledSWBTCX20BitMap, 1, st, &stream, pnSize ); + } + } + } + ELSE + { + ReadFromBitstream( &tnsEnabledWBTCX20BitMap, 1, st, &stream, pnSize ); + } + + move16(); + *pnBits = sub( st->next_bit_pos, start_bit_pos ); + +#ifdef IVAS_CODE + return; +#else + return TNS_NO_ERROR; +#endif +} #define IVAS_CODE #ifdef IVAS_CODE void #else Word16 #endif - ReadTnsData( + ReadTnsData_ivas_fx( STnsConfig const * pTnsConfig, Decoder_State *st, Word16 * pnBits, -- GitLab