diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 97602e73d793860897b917d5aa373d7cc68c5c99..cb52138f674bb581471686c343147949d0a27a08 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1318,6 +1318,9 @@ enum #define MASA_BIT_REDUCT_PARAM 10 #define MASA_MAXIMUM_TWO_DIR_BANDS 24 #define NBITS_HR_COH 4 +#ifdef NONBE_FIX_982_OMASA_DELAY_COMP_5MS +#define OMASA_TDREND_MATCHING_GAIN_FX 26026 +#endif #define MASA_INV_ANGLE_AT_EQUATOR_DEG_Q30 (1453366656l) diff --git a/lib_com/options.h b/lib_com/options.h index 2a87c540b8ba45b698d3c2baf853780645b4ec4e..97065fb0e0967078563fc7dad7c1ce3db7450a2b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -118,6 +118,8 @@ #define NONBE_FIX_974_OSBA_JBM_MONO_RS_USAN /* FhG : issue #974: usan in mono and stereo output in OSBA JBM RS */ +#define NONBE_FIX_982_OMASA_DELAY_COMP_5MS /* FhG : issue #982 : 5ms and 20ms output different for OMASA */ + /* #################### End BASOP porting switches ############################ */ #endif diff --git a/lib_dec/ivas_ism_renderer_fx.c b/lib_dec/ivas_ism_renderer_fx.c index 1a3fc4164ab48b4b509c0f6c856f570d005c2e76..c3904d1368a4ef147b8739819f9ba8705aba2a95 100644 --- a/lib_dec/ivas_ism_renderer_fx.c +++ b/lib_dec/ivas_ism_renderer_fx.c @@ -611,6 +611,7 @@ void ivas_omasa_separate_object_render_jbm_fx( FOR( obj = 0; obj < num_objects; obj++ ) { /* Delay the signal to match CLDFB delay. Delay the whole buffer with the first rendering call of the stretched buffer. */ +#ifndef NONBE_FIX_982_OMASA_DELAY_COMP_5MS IF( slots_rendered == 0 ) { Word16 tcBufferSize; @@ -618,6 +619,7 @@ void ivas_omasa_separate_object_render_jbm_fx( tcBufferSize = i_mult( hSpatParamRendCom->num_slots, hSpatParamRendCom->slot_size ); delay_signal32_fx( input_fx[obj], tcBufferSize, st_ivas->hMasaIsmData->delayBuffer_fx[obj], st_ivas->hMasaIsmData->delayBuffer_size ); } +#endif offsetSamples = 0; move16(); diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 9038dfb4beb675a2ebd41bc4a768658338371280..c85e36d8e815317c0c3143f67d1d452c68695e19 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -1728,6 +1728,32 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx( { ivas_ism_dec_digest_tc_fx( st_ivas ); } + +#ifdef NONBE_FIX_982_OMASA_DELAY_COMP_5MS + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_DIRAC ) + { + int16_t num_objects; + + /* Delay the signal to match CLDFB delay. Delay the whole buffer. */ + num_objects = 0; + IF( ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC ) + { + num_objects = 1; + } + ELSE IF( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) + { + num_objects = st_ivas->nchan_ism; + } + FOR( n = 0; n < num_objects; n++ ) + { + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) + { + v_multc_fixed_16( st_ivas->hTcBuffer->tc_fx[CPE_CHANNELS + n], OMASA_TDREND_MATCHING_GAIN_FX, st_ivas->hTcBuffer->tc_fx[CPE_CHANNELS + n], st_ivas->hTcBuffer->n_samples_available ); + } + delay_signal32_fx( st_ivas->hTcBuffer->tc_fx[CPE_CHANNELS + n], st_ivas->hTcBuffer->n_samples_available, st_ivas->hMasaIsmData->delayBuffer_fx[n], st_ivas->hMasaIsmData->delayBuffer_size ); + } + } +#endif } ELSE IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) ) { diff --git a/lib_dec/ivas_omasa_dec_fx.c b/lib_dec/ivas_omasa_dec_fx.c index 2e7d5e47b54055e1d71515e3a2b4b0b8590a42ea..4bfc6e13e9bb0fc14031049d7b6b814419266855 100644 --- a/lib_dec/ivas_omasa_dec_fx.c +++ b/lib_dec/ivas_omasa_dec_fx.c @@ -45,7 +45,9 @@ * Local constants *------------------------------------------------------------------------*/ +#ifndef NONBE_FIX_982_OMASA_DELAY_COMP_5MS #define OMASA_TDREND_MATCHING_GAIN_FX 26026 +#endif /*-------------------------------------------------------------------* * ivas_omasa_data_open() @@ -700,18 +702,39 @@ void ivas_omasa_dirac_rend_jbm_fx( Word16 n; Word32 data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; +#ifdef NONBE_FIX_982_OMASA_DELAY_COMP_5MS test(); - IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) + if ( !st_ivas->hDecoderConfig->Opt_tsm ) { + *nSamplesRendered = min( nSamplesAsked, st_ivas->hTcBuffer->n_samples_available ); +#endif + + + test(); + IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) + { +#ifdef NONBE_FIX_982_OMASA_DELAY_COMP_5MS + Copy32( &output_f[CPE_CHANNELS][st_ivas->hTcBuffer->n_samples_rendered], data_separated_objects[0], *nSamplesRendered ); +#else Copy32( output_f[CPE_CHANNELS], data_separated_objects[0], nSamplesAsked ); - } - ELSE - { - FOR( n = 0; n < st_ivas->nchan_ism; n++ ) +#endif + } + ELSE { + FOR( n = 0; n < st_ivas->nchan_ism; n++ ) + { +#ifdef NONBE_FIX_982_OMASA_DELAY_COMP_5MS + Copy32( &output_f[n + CPE_CHANNELS][st_ivas->hTcBuffer->n_samples_rendered], data_separated_objects[n], *nSamplesRendered ); +#else Copy32( output_f[n + CPE_CHANNELS], data_separated_objects[n], nSamplesAsked ); +#endif + } } + +#ifdef NONBE_FIX_982_OMASA_DELAY_COMP_5MS } +#endif + subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; move16(); @@ -751,10 +774,14 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm_fx( ) { Word16 n; +#ifndef NONBE_FIX_982_OMASA_DELAY_COMP_5MS Word16 gain_fx = OMASA_TDREND_MATCHING_GAIN_FX; // Q15 +#endif move16(); ivas_error error; +#ifndef NONBE_FIX_982_OMASA_DELAY_COMP_5MS Word32 *tc_local_fx[MAX_TRANSPORT_CHANNELS]; +#endif Word32 *p_sepobj_fx[MAX_NUM_OBJECTS]; // Q11 Word32 data_separated_objects_fx[MAX_NUM_OBJECTS][L_FRAME48k]; move16(); @@ -771,6 +798,7 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm_fx( } /* Delay the object signals to match the CLDFB delay. Delay the whole buffer with the first rendering call of the stretched buffer. */ +#ifndef NONBE_FIX_982_OMASA_DELAY_COMP_5MS IF( st_ivas->hSpatParamRendCom->slots_rendered == 0 ) { Word16 tcBufferSize; @@ -785,6 +813,7 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm_fx( delay_signal32_fx( tc_local_fx[n], tcBufferSize, st_ivas->hMasaIsmData->delayBuffer_fx[n], st_ivas->hMasaIsmData->delayBuffer_size ); } } +#endif ivas_dirac_dec_binaural_render_fx( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailable, nchan_transport, output_fx ); diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 408f1cb1bca306d57a57056c283c27d8947caa02..3f24bfd85b98f3a9b63e3633e6c2333b9734b720 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -3262,7 +3262,12 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx( q_tmp_sq = sub( 31, exp ); IF( EQ_16( ivas_format, MASA_ISM_FORMAT ) ) { +#ifdef NONBE_FIX_982_OMASA_DELAY_COMP_5MS + Word32 gainfactor_fx = L_shl( (Word32) OMASA_TDREND_MATCHING_GAIN_FX, Q16 ); // constant in Q31 as Word32 + gainFactor_fx = Mpy_32_32( gainfactor_fx, tmp1 ); // 1705746262 = 0.7943f in Q31 +#else gainFactor_fx = Mpy_32_32( 1705746262, tmp1 ); // 1705746262 = 0.7943f in Q31 +#endif } ELSE {