diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index ad03fab6669cc8c00c172f75adb7de9214c41b71..641f87213395214c1b1f564f2eb329531c8cdc30 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5617,6 +5617,17 @@ ivas_error ivas_osba_render_sf( float *output_f[] /* o : rendered time signal */ ); +#ifdef NONBE_1894_OSBA_SCALING +void ivas_osba_stereo_add_channels( + float *tc_f[], /* i : transport channels */ + float *output_f[], /* i/o: output channels */ + const float gain, /* i : gain bed value */ + const int16_t nchan_out, /* i : number of output channels */ + const int16_t nchan_ism, /* i : number of ISM channels */ + const int16_t n_samples_to_render /* i : output frame length per channel */ +); +#endif + void ivas_osba_data_close( SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ ); diff --git a/lib_com/options.h b/lib_com/options.h index 218c6a4ab35e7ef0a390012fe5e50b9495d1d220..4b02b35f8bd21e106d9f232dbf1dbacbc8265a0f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -206,6 +206,8 @@ #define NONBE_FIX_1174_MCMASA_LBR_LOOP_ERROR /* Nokia: Fix issue 1174 by removing the unnecessary inner loop causing problems. */ #define NONBE_FIX_1052_SBA_EXT_FIX /* VA: SBA external output support fix - do not overwrite "output_config" parameter */ +#define NONBE_1894_OSBA_SCALING /* FhG: port OSBA scaling MRs (298,355,360) jointly */ + /* #################### End BASOP porting switches ############################ */ /* clang-format on */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 1a916d7fdc875950eb7326fd037f3be421ecae04..09117ace582dbd3eb574b776f7fa92313886f57f 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1238,10 +1238,14 @@ ivas_error ivas_jbm_dec_render( ivas_ism_render_sf( st_ivas, st_ivas->renderer_type, p_output, *nSamplesRendered ); /* add already rendered SBA part */ +#ifdef NONBE_1894_OSBA_SCALING + ivas_osba_stereo_add_channels( p_tc, p_output, 1.0f, nchan_out, st_ivas->nchan_ism, *nSamplesRendered ); +#else for ( n = 0; n < nchan_out; n++ ) { v_add( p_output[n], p_tc[n + st_ivas->nchan_ism], p_output[n], *nSamplesRendered ); } +#endif } else if ( st_ivas->renderer_type == RENDERER_OSBA_AMBI || st_ivas->renderer_type == RENDERER_OSBA_LS || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { @@ -1273,6 +1277,12 @@ ivas_error ivas_jbm_dec_render( else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { ivas_dirac_dec_binaural_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output ); +#ifdef NONBE_1894_OSBA_SCALING + for ( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) + { + v_multc( p_output[n], 2.0f, p_output[n], *nSamplesRendered ); + } +#endif } else { @@ -1295,6 +1305,12 @@ ivas_error ivas_jbm_dec_render( set_zero( p_output[n], *nSamplesRendered ); } } +#ifdef NONBE_1894_OSBA_SCALING + for ( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) + { + v_multc( p_output[n], 2.0f, p_output[n], *nSamplesRendered ); + } +#endif } } else if ( st_ivas->ivas_format == MC_FORMAT ) diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 535f1edb211d9e8ee2f194acfed001bbd8466f7a..c9e9e2e93773ab6e8145ff484bafa47c9f1b9dbc 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -184,12 +184,20 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( for ( b = 0; b < num_cldfb_bands; b++ ) { st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] = +#ifndef NONBE_1894_OSBA_SCALING ( 0.5f * st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + ( 0.5f * Cldfb_RealBuffer[b] ); +#else + st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] + Cldfb_RealBuffer[b]; +#endif st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] = +#ifndef NONBE_1894_OSBA_SCALING ( 0.5f * st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + ( 0.5f * Cldfb_ImagBuffer[b] ); +#else + st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] + Cldfb_ImagBuffer[b]; +#endif } } } @@ -206,7 +214,11 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( int16_t i; for ( i = 0; i < nSamplesAsked; i++ ) { +#ifndef NONBE_1894_OSBA_SCALING output_f[n][i] = 0.5f * output_f[channel_offset + n][i] + 0.5f * p_sepobj[n][i]; +#else + output_f[n][i] = output_f[channel_offset + n][i] + p_sepobj[n][i]; +#endif } } } @@ -296,9 +308,58 @@ ivas_error ivas_osba_render_sf( { v_add( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered ); } - +#ifndef NONBE_1894_OSBA_SCALING v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); +#endif } return IVAS_ERR_OK; } + +#ifdef NONBE_1894_OSBA_SCALING +/*-------------------------------------------------------------------------* + * ivas_osba_stereo_add_channels() + * + * + *-------------------------------------------------------------------------*/ + +void ivas_osba_stereo_add_channels( + float *tc_f[], /* i : transport channels */ + float *output_f[], /* i/o: output channels */ + const float gain, /* i : gain bed value */ + const int16_t nchan_out, /* i : number of output channels */ + const int16_t nchan_ism, /* i : number of ISM channels */ + const int16_t n_samples_to_render /* i : output frame length per channel */ +) +{ + int16_t n; + +#if 0 + if ( ism_mode == ISM_SBA_MODE_DISC ) + { +#endif + if ( gain != 1.0f ) + { + assert( 0 && "Object editing is not implemented in this branch!" ); + } + else + { + for ( n = 0; n < nchan_out; n++ ) + { + v_add( output_f[n], tc_f[n + nchan_ism], output_f[n], n_samples_to_render ); + } + } +#if 0 + } + else + { + for ( n = 0; n < nchan_out; n++ ) + { + v_add( output_f[n], tc_f[n + nchan_ism], output_f[n], n_samples_to_render ); + } + } +#endif + + return; +} +#endif