diff --git a/lib_com/options.h b/lib_com/options.h index 53de4ed72965fe97c06e5b6a4bf201d3464a4b49..b0ab3881aa047b4b035a74ef6e2cb2dd806cb202 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -181,6 +181,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 old mode 100644 new mode 100755 index 7012165c850d3b10e0091b37f3331e4e2f6a1e16..f6d58c693a676f8ba2bd66604ce447f83dbc6718 --- 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 old mode 100644 new mode 100755 index d340362e3ff8902b470c28f0aa7e9c0106c0847b..adaf112cddfbd76a336af30ad397ddacbf9c286f --- 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 );