From ee981fa75055b1fc7274f08bf17b7db0e352146f Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 25 Sep 2023 10:54:25 +0200 Subject: [PATCH 1/3] replace floor() by floorf(), log() by logf() --- lib_dec/ivas_mct_dec.c | 4 ++-- lib_enc/ivas_mct_enc.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 7012165c85..6b652b46af 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -432,7 +432,7 @@ ivas_error create_mct_dec( hMCT->currBlockDataCnt = 0; /*Initialize bits required to signal channel-pair index*/ - hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floor( ( log( hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) / log( 2. ) ) ) + 1 ) ); + hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); set_s( hMCT->chBitRatios, 0, MCT_MAX_CHANNELS ); set_s( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); @@ -593,7 +593,7 @@ ivas_error mct_dec_reconfigure( hMCT->currBlockDataCnt = 0; /*Initialize bits required to signal channel-pair index*/ - hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floor( ( log( hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) / log( 2. ) ) ) + 1 ) ); + hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); set_s( hMCT->chBitRatios, 0, MCT_MAX_CHANNELS ); set_s( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index d340362e3f..24e08e97cf 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -71,7 +71,7 @@ static void set_mct_enc_params( hMCT->currBlockDataCnt = 0; /*Initialize bits required to signal channel-pair index*/ - hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floor( ( log( hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) / log( 2. ) ) ) + 1 ) ); + hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); set_s( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); -- GitLab From df8b20d13b5b2975c723a096b4cc3aad06ca5eb1 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 25 Sep 2023 13:59:26 +0200 Subject: [PATCH 2/3] fix compiler warnings for VS --- lib_dec/ivas_mct_dec.c | 4 ++-- lib_enc/ivas_mct_enc.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) mode change 100644 => 100755 lib_dec/ivas_mct_dec.c mode change 100644 => 100755 lib_enc/ivas_mct_enc.c diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c old mode 100644 new mode 100755 index 6b652b46af..aabe0f253c --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -432,7 +432,7 @@ ivas_error create_mct_dec( hMCT->currBlockDataCnt = 0; /*Initialize bits required to signal channel-pair index*/ - hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); + hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( (float) hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); set_s( hMCT->chBitRatios, 0, MCT_MAX_CHANNELS ); set_s( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); @@ -593,7 +593,7 @@ ivas_error mct_dec_reconfigure( hMCT->currBlockDataCnt = 0; /*Initialize bits required to signal channel-pair index*/ - hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); + hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( (float) hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); set_s( hMCT->chBitRatios, 0, MCT_MAX_CHANNELS ); set_s( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c old mode 100644 new mode 100755 index 24e08e97cf..3080f5405b --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -71,7 +71,7 @@ static void set_mct_enc_params( hMCT->currBlockDataCnt = 0; /*Initialize bits required to signal channel-pair index*/ - hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); + hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( (float) hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); set_s( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); -- GitLab From 91f22b2b89638fc0aba4d0d97a161e8299950281 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 25 Sep 2023 17:47:24 +0200 Subject: [PATCH 3/3] forgot switches --- lib_com/options.h | 1 + lib_dec/ivas_mct_dec.c | 8 ++++++++ lib_enc/ivas_mct_enc.c | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 942b28011d..c72a7edb0b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -180,6 +180,7 @@ #define FIX_796_MCT_MODE_DIFF_JBM /* FhG: Issue 796: fix differences between JBM and non-JBM fOR MC */ #define LIB_REND_FIX_HRTFPARAMBIN_MEMLEAK /* fix 755 */ #define FIX_803_SCE_MD_HANDLE /* VA: issue 803: Resolve "MD handle needed only for one SCE" */ +#define FIX_812_DOUBLE_PREC_MCT /* FhG: Issue 812: Avoid double precision in MCT */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index aabe0f253c..f6d58c693a 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -432,7 +432,11 @@ ivas_error create_mct_dec( hMCT->currBlockDataCnt = 0; /*Initialize bits required to signal channel-pair index*/ +#ifdef FIX_812_DOUBLE_PREC_MCT hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( (float) hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); +#else + hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floor( ( log( hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) / log( 2. ) ) ) + 1 ) ); +#endif set_s( hMCT->chBitRatios, 0, MCT_MAX_CHANNELS ); set_s( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); @@ -593,7 +597,11 @@ ivas_error mct_dec_reconfigure( hMCT->currBlockDataCnt = 0; /*Initialize bits required to signal channel-pair index*/ +#ifdef FIX_812_DOUBLE_PREC_MCT hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( (float) hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); +#else + hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floor( ( log( hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) / log( 2. ) ) ) + 1 ) ); +#endif set_s( hMCT->chBitRatios, 0, MCT_MAX_CHANNELS ); set_s( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 3080f5405b..adaf112cdd 100755 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -71,7 +71,11 @@ static void set_mct_enc_params( hMCT->currBlockDataCnt = 0; /*Initialize bits required to signal channel-pair index*/ +#ifdef FIX_812_DOUBLE_PREC_MCT hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( (float) hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); +#else + hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floor( ( log( hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) / log( 2. ) ) ) + 1 ) ); +#endif set_s( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); -- GitLab