diff --git a/apps/renderer.c b/apps/renderer.c index d9e20dc3e685e512b7a6a17bcf9d06d972177977..e57df6db7883c6ca05b2416781b2d37c4b5dce6a 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -70,6 +70,10 @@ #define IVAS_MAX16B_FLT 32767.0f #define IVAS_MIN16B_FLT ( -32768.0f ) +#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS +#define OMASA_TDREND_MATCHING_GAIN_DB ( -2.0f ) +#endif + #if !defined( DEBUGGING ) && !defined( WMOPS ) static #endif @@ -1170,20 +1174,39 @@ int main( } } +#ifndef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS /* Set the total number of objects */ +#endif if ( args.inConfig.numAudioObjects > 0 ) { +#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS + /* Set the total number of objects */ +#endif if ( ( error = IVAS_REND_SetTotalNumberOfObjects( hIvasRend, args.inConfig.numAudioObjects ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_SetTotalNumberOfObjects(): %s\n", ivas_error_to_string( error ) ); goto cleanup; } +#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS + /* Set the metadata delay for objects */ +#endif if ( ( error = IVAS_REND_SetIsmMetadataDelay( hIvasRend, args.syncMdDelay ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_SetIsmMetadataDelay(): %s\n", ivas_error_to_string( error ) ); goto cleanup; } +#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS + + /* For OMASA input and BINAURAL output, apply a gain to objects to match the loudness with MASA part */ + if ( args.inConfig.numMasaBuses > 0 && args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL ) + { + for ( i = 0; i < args.inConfig.numAudioObjects; ++i ) + { + args.inConfig.audioObjects[i].gain_dB += OMASA_TDREND_MATCHING_GAIN_DB; + } + } +#endif } IVAS_REND_LfePanMtx lfePanMatrix; diff --git a/lib_com/options.h b/lib_com/options.h index 13e6a86960393e0056f85a16500bf0b692afb00a..292e6e0c80a49aabffc5babceaee11f37455782e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -189,6 +189,7 @@ #define FIX_1370_EXTERNAL_ORIENTATION_CHECK /* Nokia: add sanity check for Euler angles for external orientations */ #define FIX_1413_IGF_INIT_PRINTOUT /* FhG: use correct variable for IGF initiliazation */ #define CODE_IMPROVEMENTS +#define NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS /* Nokia: issue 1339: Apply scaling to the object-part of OMASA for binaural rendering in IVAS_rend. */ // object-editing feature porting