Loading apps/renderer.c +17 −0 Original line number Diff line number Diff line Loading @@ -2461,6 +2461,9 @@ static void convertOutputBuffer( int16_t *intBuffer ) { int16_t chnl, smpl, i; #ifdef FIX_REND_ROUNDING float temp; #endif i = 0; Loading @@ -2468,7 +2471,21 @@ static void convertOutputBuffer( { for ( chnl = 0; chnl < numChannels; ++chnl ) { #ifdef FIX_REND_ROUNDING temp = floatBuffer[chnl * numSamplesPerChannel + smpl]; temp = (float) floor( temp + 0.5f ); if ( temp > MAX16B_FLT ) { temp = MAX16B_FLT; } else if ( temp < MIN16B_FLT ) { temp = MIN16B_FLT; } intBuffer[i] = (int16_t) temp; #else intBuffer[i] = (int16_t) roundf( floatBuffer[chnl * numSamplesPerChannel + smpl] ); #endif ++i; } Loading lib_com/options.h +2 −0 Original line number Diff line number Diff line Loading @@ -175,6 +175,8 @@ #define FIX_GET_DELAY_RETURN /* Issue 223: change return data type in function get_delay() */ #define NTT_REDUC_COMP_POC /* NTT Contribution 10: Complexity reduction of phase spectrum in stereo downmix*/ #define FIX_ISM_DECODER_PRINTOUT /* Issue 229: fix ISM decoder printout */ #define FIX_REND_ROUNDING /* Issue 195: Align float to int16 conversion in renderer with decoder */ #define FIX_REND_MONO_DMX /* Issue 195: Fix mono downmix coefficients in decoder and renderer */ /* ################## End DEVELOPMENT switches ######################### */ Loading lib_rend/ivas_rom_rend.c +15 −0 Original line number Diff line number Diff line Loading @@ -362,6 +362,20 @@ const uint32_t ls_LFE_last_idx_CICP19[12] = { 0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, const float ls_conversion_cicpX_mono[12][1] = { #ifdef EXT_RENDERER #ifdef FIX_REND_MONO_DMX {1.00000000f}, {1.00000000f}, {1.00000000f}, {1.00000000f}, {0.79999995f}, {0.79999995f}, {0.79999995f}, {0.79999995f}, {0.849999964f}, {0.849999964f}, {0.849999964f}, {0.849999964f} #else /* FIX_REND_MONO_DMX */ {1.00000000f}, {1.00000000f}, {1.00000000f}, Loading @@ -374,6 +388,7 @@ const float ls_conversion_cicpX_mono[12][1] = {1.00000000f}, {1.00000000f}, {1.00000000f}, #endif /* FIX_REND_MONO_DMX */ #else {1.00000000f}, {1.00000000f}, Loading lib_rend/lib_rend.c +44 −7 Original line number Diff line number Diff line Loading @@ -1203,6 +1203,11 @@ static ivas_error initMcPanGainsWithMonoOut( { int16_t i; int16_t numInChannels; #ifdef FIX_REND_MONO_DMX int16_t readIdx; int16_t writeIdx; bool skipSideSpeakers; #endif ivas_error error; if ( ( error = getRendInputNumChannels( inputMc, &numInChannels ) ) != IVAS_ERR_OK ) Loading @@ -1210,12 +1215,44 @@ static ivas_error initMcPanGainsWithMonoOut( return error; } #ifdef FIX_REND_MONO_DMX if ( inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { for ( i = 0; i < numInChannels; ++i ) { /* It's OK to also set gain 1 for LFE input channels here. * Correct LFE handling will be applied within updateMcPanGains() */ inputMc->panGains[i][0] = 1.f; } } else { /* ls_conversion_cicpX_stereo contains gains for side speakers. * These should be skipped with 5.1+X inputs. */ skipSideSpeakers = false; if ( inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_5_1_2 || inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_5_1_4 ) { skipSideSpeakers = true; } for ( readIdx = 0, writeIdx = 0; writeIdx < numInChannels; ++readIdx, ++writeIdx ) { if ( skipSideSpeakers && readIdx == 4 ) { /* Skip gains for side speakers in lookup table */ readIdx += 2; } inputMc->panGains[writeIdx][0] = ls_conversion_cicpX_mono[readIdx][0]; } } #else for ( i = 0; i < numInChannels; ++i ) { /* It's OK to also set gain 1 for LFE input channels here. * Correct LFE handling will be applied within updateMcPanGains() */ inputMc->panGains[i][0] = 1.f; } #endif return IVAS_ERR_OK; } Loading Loading @@ -1323,13 +1360,13 @@ static ivas_error updateMcPanGainsForMcOut( /* "if" conditions below realize the following mapping: If in == out, use identity matrix, otherwise follow the table: +-----------+----------+---------------+-----------+--------------------+ +-----------+-------------+---------------+-----------+--------------------+ | in\out | MONO | STEREO | custom LS | other | +-----------+----------+---------------+-----------+--------------------+ +-----------+-------------+---------------+-----------+--------------------+ | MONO | mono out | EFAP | EFAP | EFAP | | custom LS | mono out | EFAP | EFAP | EFAP | | other | mono out | stereo lookup | EFAP | conversion mapping | +-----------+----------+---------------+-----------+--------------------+ | other | mono lookup | stereo lookup | EFAP | conversion mapping | +-----------+-------------+---------------+-----------+--------------------+ */ if ( configsAreEqual( inputMc->base.inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ) ) Loading scripts/pyaudio3dtools/constants.py +8 −8 Original line number Diff line number Diff line Loading @@ -37,14 +37,14 @@ IVAS_CICPX_TO_MONO = np.array( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.79999995, 0.79999995, 0.79999995, 0.79999995, 0.849999964, 0.849999964, 0.849999964, 0.849999964, ] ] ).T Loading Loading
apps/renderer.c +17 −0 Original line number Diff line number Diff line Loading @@ -2461,6 +2461,9 @@ static void convertOutputBuffer( int16_t *intBuffer ) { int16_t chnl, smpl, i; #ifdef FIX_REND_ROUNDING float temp; #endif i = 0; Loading @@ -2468,7 +2471,21 @@ static void convertOutputBuffer( { for ( chnl = 0; chnl < numChannels; ++chnl ) { #ifdef FIX_REND_ROUNDING temp = floatBuffer[chnl * numSamplesPerChannel + smpl]; temp = (float) floor( temp + 0.5f ); if ( temp > MAX16B_FLT ) { temp = MAX16B_FLT; } else if ( temp < MIN16B_FLT ) { temp = MIN16B_FLT; } intBuffer[i] = (int16_t) temp; #else intBuffer[i] = (int16_t) roundf( floatBuffer[chnl * numSamplesPerChannel + smpl] ); #endif ++i; } Loading
lib_com/options.h +2 −0 Original line number Diff line number Diff line Loading @@ -175,6 +175,8 @@ #define FIX_GET_DELAY_RETURN /* Issue 223: change return data type in function get_delay() */ #define NTT_REDUC_COMP_POC /* NTT Contribution 10: Complexity reduction of phase spectrum in stereo downmix*/ #define FIX_ISM_DECODER_PRINTOUT /* Issue 229: fix ISM decoder printout */ #define FIX_REND_ROUNDING /* Issue 195: Align float to int16 conversion in renderer with decoder */ #define FIX_REND_MONO_DMX /* Issue 195: Fix mono downmix coefficients in decoder and renderer */ /* ################## End DEVELOPMENT switches ######################### */ Loading
lib_rend/ivas_rom_rend.c +15 −0 Original line number Diff line number Diff line Loading @@ -362,6 +362,20 @@ const uint32_t ls_LFE_last_idx_CICP19[12] = { 0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, const float ls_conversion_cicpX_mono[12][1] = { #ifdef EXT_RENDERER #ifdef FIX_REND_MONO_DMX {1.00000000f}, {1.00000000f}, {1.00000000f}, {1.00000000f}, {0.79999995f}, {0.79999995f}, {0.79999995f}, {0.79999995f}, {0.849999964f}, {0.849999964f}, {0.849999964f}, {0.849999964f} #else /* FIX_REND_MONO_DMX */ {1.00000000f}, {1.00000000f}, {1.00000000f}, Loading @@ -374,6 +388,7 @@ const float ls_conversion_cicpX_mono[12][1] = {1.00000000f}, {1.00000000f}, {1.00000000f}, #endif /* FIX_REND_MONO_DMX */ #else {1.00000000f}, {1.00000000f}, Loading
lib_rend/lib_rend.c +44 −7 Original line number Diff line number Diff line Loading @@ -1203,6 +1203,11 @@ static ivas_error initMcPanGainsWithMonoOut( { int16_t i; int16_t numInChannels; #ifdef FIX_REND_MONO_DMX int16_t readIdx; int16_t writeIdx; bool skipSideSpeakers; #endif ivas_error error; if ( ( error = getRendInputNumChannels( inputMc, &numInChannels ) ) != IVAS_ERR_OK ) Loading @@ -1210,12 +1215,44 @@ static ivas_error initMcPanGainsWithMonoOut( return error; } #ifdef FIX_REND_MONO_DMX if ( inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { for ( i = 0; i < numInChannels; ++i ) { /* It's OK to also set gain 1 for LFE input channels here. * Correct LFE handling will be applied within updateMcPanGains() */ inputMc->panGains[i][0] = 1.f; } } else { /* ls_conversion_cicpX_stereo contains gains for side speakers. * These should be skipped with 5.1+X inputs. */ skipSideSpeakers = false; if ( inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_5_1_2 || inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_5_1_4 ) { skipSideSpeakers = true; } for ( readIdx = 0, writeIdx = 0; writeIdx < numInChannels; ++readIdx, ++writeIdx ) { if ( skipSideSpeakers && readIdx == 4 ) { /* Skip gains for side speakers in lookup table */ readIdx += 2; } inputMc->panGains[writeIdx][0] = ls_conversion_cicpX_mono[readIdx][0]; } } #else for ( i = 0; i < numInChannels; ++i ) { /* It's OK to also set gain 1 for LFE input channels here. * Correct LFE handling will be applied within updateMcPanGains() */ inputMc->panGains[i][0] = 1.f; } #endif return IVAS_ERR_OK; } Loading Loading @@ -1323,13 +1360,13 @@ static ivas_error updateMcPanGainsForMcOut( /* "if" conditions below realize the following mapping: If in == out, use identity matrix, otherwise follow the table: +-----------+----------+---------------+-----------+--------------------+ +-----------+-------------+---------------+-----------+--------------------+ | in\out | MONO | STEREO | custom LS | other | +-----------+----------+---------------+-----------+--------------------+ +-----------+-------------+---------------+-----------+--------------------+ | MONO | mono out | EFAP | EFAP | EFAP | | custom LS | mono out | EFAP | EFAP | EFAP | | other | mono out | stereo lookup | EFAP | conversion mapping | +-----------+----------+---------------+-----------+--------------------+ | other | mono lookup | stereo lookup | EFAP | conversion mapping | +-----------+-------------+---------------+-----------+--------------------+ */ if ( configsAreEqual( inputMc->base.inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ) ) Loading
scripts/pyaudio3dtools/constants.py +8 −8 Original line number Diff line number Diff line Loading @@ -37,14 +37,14 @@ IVAS_CICPX_TO_MONO = np.array( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.79999995, 0.79999995, 0.79999995, 0.79999995, 0.849999964, 0.849999964, 0.849999964, 0.849999964, ] ] ).T Loading