diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 57101b4de1136f27631f598ab9ae3833cd8d2081..6489dadb4c1f43cffb5a4fc5dfdde17717420832 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -4598,6 +4598,23 @@ void ivas_dec_prepare_renderer_fx( move16(); } +#ifdef NONBE_1399_1400_FIX_OBJ_EDIT_ISSUES + test(); + test(); + IF( st_ivas->hDecoderConfig->Opt_tsm && EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) ) + { + /* Gain MASA part, if edited */ + IF( st_ivas->hMasaIsmData->masa_gain_is_edited ) + { + FOR( n = 0; n < CPE_CHANNELS; n++ ) + { + v_multc_fx_16( st_ivas->hTcBuffer->tc_fx[n], st_ivas->hMasaIsmData->gain_masa_edited_fx, st_ivas->hTcBuffer->tc_fx[n], st_ivas->hTcBuffer->n_samples_available ); + Scale_sig32( st_ivas->hTcBuffer->tc_fx[n], st_ivas->hTcBuffer->n_samples_available, Q3 ); // Q8 -> Q11 + } + } + } +#endif + FOR( n = 0; n < nchan_transport_ism; n++ ) { test(); diff --git a/lib_dec/ivas_omasa_dec_fx.c b/lib_dec/ivas_omasa_dec_fx.c index c8da321a9131e66a73c0158f77c9a07a50a0c510..b1435fe775f87c518fa881796d9a36bbe79615a6 100644 --- a/lib_dec/ivas_omasa_dec_fx.c +++ b/lib_dec/ivas_omasa_dec_fx.c @@ -1120,10 +1120,14 @@ void ivas_omasa_dirac_rend_jbm_fx( { Copy32( &output_fx[CPE_CHANNELS][st_ivas->hTcBuffer->n_samples_rendered], data_separated_objects[0], *nSamplesRendered ); +#ifdef NONBE_1399_1400_FIX_OBJ_EDIT_ISSUES + IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) +#else #ifdef FIX_1330_JBM_MEMORY - IF( !st_ivas->hDecoderConfig->Opt_tsm && EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) + IF( !st_ivas->hDecoderConfig->Opt_tsm && EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) #else IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) +#endif #endif { /* Gain separated object, if edited */ @@ -1145,10 +1149,14 @@ void ivas_omasa_dirac_rend_jbm_fx( Copy32( &output_fx[n + CPE_CHANNELS][st_ivas->hTcBuffer->n_samples_rendered], data_separated_objects[n], *nSamplesRendered ); /* Gain discrete objects, if edited */ +#ifdef NONBE_1399_1400_FIX_OBJ_EDIT_ISSUES + IF( st_ivas->hMasaIsmData->ism_gain_is_edited[n] ) +#else #ifdef FIX_1330_JBM_MEMORY - IF( !st_ivas->hDecoderConfig->Opt_tsm && st_ivas->hMasaIsmData->ism_gain_is_edited[n] ) + IF( !st_ivas->hDecoderConfig->Opt_tsm && st_ivas->hMasaIsmData->ism_gain_is_edited[n] ) #else IF( st_ivas->hMasaIsmData->ism_gain_is_edited[n] ) +#endif #endif { v_multc_fx_16( data_separated_objects[n], st_ivas->hMasaIsmData->gain_ism_edited_fx[n], data_separated_objects[n], *nSamplesRendered ); // Q = 8 @@ -1156,14 +1164,14 @@ void ivas_omasa_dirac_rend_jbm_fx( } } - /* Gain MASA part, if edited */ + /* Gain MASA part, if edited in G192. MASA gaining with VOIP is done in ivas_dec_prepare_renderer() */ #ifdef FIX_1330_JBM_MEMORY IF( !st_ivas->hDecoderConfig->Opt_tsm && st_ivas->hMasaIsmData->masa_gain_is_edited ) #else IF( st_ivas->hMasaIsmData->masa_gain_is_edited ) #endif { - FOR( n = 0; n < 2; n++ ) + FOR( n = 0; n < CPE_CHANNELS; n++ ) { v_multc_fx_16( output_fx[n], st_ivas->hMasaIsmData->gain_masa_edited_fx, output_fx[n], *nSamplesRendered ); // Q = 8 Scale_sig32( output_fx[n], *nSamplesRendered, Q3 ); // Q = 11 diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 46494667d4e481d34a056d81bddcfffe0a16524c..3211b0e46fcb0b5844447e2e1ec4d87fa18b6bcf 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -5387,7 +5387,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( } /* MASA gaining */ - FOR( ch = 0; ch < 2; ch++ ) + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { IF( masaGainEdited ) { @@ -5424,7 +5424,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( move16(); /* Use diagonal mixing matrix as the instant mixing matrix, to slowly fade away the editing during dtx */ - FOR( ch = 0; ch < 2; ch++ ) + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { ismPreprocMtxNew[ch][ch] = ONE_IN_Q28; move32(); @@ -5466,7 +5466,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( move16(); FOR( slot = 0; slot < nSlots; slot++ ) { - FOR( ch = 0; ch < 2; ch++ ) + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { FOR( bin = bin_lo; bin < bin_hi; bin++ ) { @@ -5485,9 +5485,9 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( } /* Get increment value for temporal interpolation */ - FOR( inCh = 0; inCh < 2; inCh++ ) + FOR( inCh = 0; inCh < BINAURAL_CHANNELS; inCh++ ) { - FOR( outCh = 0; outCh < 2; outCh++ ) + FOR( outCh = 0; outCh < BINAURAL_CHANNELS; outCh++ ) { temp = L_sub( ismPreprocMtxNew[outCh][inCh], hMasaIsmData->ismPreprocMatrix_fx[outCh][inCh][band_idx] ); // Q28 ismPreprocMtxIncrement[outCh][inCh] = L_shr( temp, 2 ); // Divide by 4 @@ -5505,11 +5505,11 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( hMasaIsmData->preprocEneTarget_fx[band_idx] = BASOP_Util_Add_Mant32Exp( hMasaIsmData->preprocEneTarget_fx[band_idx], hMasaIsmData->preprocEneTarget_e[band_idx], totalTargetEne, totalTargetEne_e, &hMasaIsmData->preprocEneTarget_e[band_idx] ); // Q = 31-preprocEneTarget_e move32(); - FOR( outCh = 0; outCh < 2; outCh++ ) + FOR( outCh = 0; outCh < BINAURAL_CHANNELS; outCh++ ) { FOR( slot = 0; slot < nSlots; slot++ ) { - FOR( inCh = 0; inCh < 2; inCh++ ) + FOR( inCh = 0; inCh < BINAURAL_CHANNELS; inCh++ ) { hMasaIsmData->ismPreprocMatrix_fx[outCh][inCh][band_idx] = L_add( hMasaIsmData->ismPreprocMatrix_fx[outCh][inCh][band_idx], ismPreprocMtxIncrement[outCh][inCh] ); // Q28 @@ -5568,7 +5568,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( move32(); } - FOR( ch = 0; ch < 2; ch++ ) + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { FOR( slot = 0; slot < nSlots; slot++ ) { @@ -5670,7 +5670,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( ELSE { /* When not edited, input and output pan gains are the same */ - FOR( ch = 0; ch < 2; ch++ ) + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { panGainsOut[ismDirIndex][ch] = panGainsIn[ismDirIndex][ch]; move16(); @@ -5678,7 +5678,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( } /* Determine pan enes */ - FOR( ch = 0; ch < 2; ch++ ) + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { panEnesOut[ismDirIndex][ch] = mult( panGainsOut[ismDirIndex][ch], panGainsOut[ismDirIndex][ch] ); // Q15 move16(); @@ -5708,14 +5708,14 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( } /* Init out array */ - FOR( Word16 k = 0; k < nSlots; k++ ) + FOR( slot = 0; slot < nSlots; slot++ ) { FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - set_zero_fx( outSlotRe[ch][k], CLDFB_NO_CHANNELS_MAX ); - set_zero_fx( outSlotIm[ch][k], CLDFB_NO_CHANNELS_MAX ); + set_zero_fx( outSlotRe[ch][slot], CLDFB_NO_CHANNELS_MAX ); + set_zero_fx( outSlotIm[ch][slot], CLDFB_NO_CHANNELS_MAX ); - norm = s_min( L_norm_arr( inRe_fx[ch][k], nBins ), L_norm_arr( inIm_fx[ch][k], nBins ) ); + norm = s_min( L_norm_arr( inRe_fx[ch][slot], nBins ), L_norm_arr( inIm_fx[ch][slot], nBins ) ); shift = s_min( norm, shift ); } } @@ -5766,7 +5766,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( move16(); /* Determine transport normalized energies and subframe energy */ - FOR( ch = 0; ch < 2; ch++ ) + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { FOR( slot = 0; slot < nSlots; slot++ ) { @@ -5989,7 +5989,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( /* Calculate MASA target energies and add to total target energy estimation */ - FOR( ch = 0; ch < 2; ch++ ) + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { /* MASA original energy per channel */ masaEneThisCh[ch] = L_max( masaEneThisCh[ch], 0 ); // Q5 @@ -6171,7 +6171,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( } } - FOR( ch = 0; ch < 2; ch++ ) + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { eneMoveThis = s_max( 0, sub( panEnesIn[ismDirIndex][ch], panEnesOut[ismDirIndex][ch] ) ); // Q15 move16(); @@ -6201,7 +6201,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( remainderNormEne = L_max( 0, temp ); // Q25 /* Normalize */ - FOR( ch = 0; ch < 2; ch++ ) + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { temp = L_shr( remainderNormEne, 1 ); // Division by 2, Q25 temp = L_add( normEnes[ch], temp ); // Q25 @@ -6237,7 +6237,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( /* Temporally average energy moving and preserving, and generate the transport signal preprocessing matrix for * gaining objects and moving objects between left and right */ - FOR( ch = 0; ch < 2; ch++ ) + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { hMasaIsmData->eneMoveIIR_fx[ch][band_idx] = Mpy_32_16_1( hMasaIsmData->eneMoveIIR_fx[ch][band_idx], STEREO_PREPROCESS_IIR_FACTOR_Q15 ); // Q = Enemove_Q + 15 + 1 -16 = Enemove_Q move32(); @@ -6324,9 +6324,9 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( } /* Get increment value for temporal interpolation */ - FOR( inCh = 0; inCh < 2; inCh++ ) + FOR( inCh = 0; inCh < BINAURAL_CHANNELS; inCh++ ) { - FOR( outCh = 0; outCh < 2; outCh++ ) + FOR( outCh = 0; outCh < BINAURAL_CHANNELS; outCh++ ) { temp = L_sub( ismPreprocMtxNew[outCh][inCh], hMasaIsmData->ismPreprocMatrix_fx[outCh][inCh][band_idx] ); // Q28 ismPreprocMtxIncrement[outCh][inCh] = L_shr( temp, 2 ); // Divide by 4 @@ -6344,11 +6344,11 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( hMasaIsmData->preprocEneTarget_fx[band_idx] = BASOP_Util_Add_Mant32Exp( hMasaIsmData->preprocEneTarget_fx[band_idx], hMasaIsmData->preprocEneTarget_e[band_idx], totalTargetEne, sub( Q31, subQ ), &hMasaIsmData->preprocEneTarget_e[band_idx] ); // Q = 31-preprocEneTarget_e move32(); - FOR( outCh = 0; outCh < 2; outCh++ ) + FOR( outCh = 0; outCh < BINAURAL_CHANNELS; outCh++ ) { FOR( slot = 0; slot < nSlots; slot++ ) { - FOR( inCh = 0; inCh < 2; inCh++ ) + FOR( inCh = 0; inCh < BINAURAL_CHANNELS; inCh++ ) { hMasaIsmData->ismPreprocMatrix_fx[outCh][inCh][band_idx] = L_add( hMasaIsmData->ismPreprocMatrix_fx[outCh][inCh][band_idx], ismPreprocMtxIncrement[outCh][inCh] ); // Q28 move32(); @@ -6411,7 +6411,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( move32(); } - FOR( ch = 0; ch < 2; ch++ ) + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { FOR( slot = 0; slot < nSlots; slot++ ) {