From 4caa42d04839b5c2607962961cb3bc6c8dd051cb Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Fri, 24 Oct 2025 13:08:36 +0300 Subject: [PATCH] Port changes from float MR 2197 to BASOP main. --- apps/renderer.c | 26 ++++++++++++++++++++++++++ lib_com/options.h | 1 + 2 files changed, 27 insertions(+) diff --git a/apps/renderer.c b/apps/renderer.c index 0bc511dc8..92430a353 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -74,6 +74,11 @@ #define IVAS_MIN16B_FLT ( -32768.0f ) #define IVAS_MAX16B_FX 32767 #define IVAS_MIN16B_FX ( -32768 ) + +#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS +#define OMASA_TDREND_MATCHING_GAIN_DB ( -2.0f ) +#endif + #if !defined( DEBUGGING ) && !defined( WMOPS ) static #endif @@ -1262,20 +1267,41 @@ 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 Word32 var1 = (Word32) ( args.syncMdDelay ); IF( ( error = IVAS_REND_SetIsmMetadataDelay( hIvasRend, var1 ) ) != 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 53c55e725..952294970 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -117,6 +117,7 @@ #define FIX_RENDERER_STACK /* VA: issue 1322: reduction of renderers' buffers size */ #define FIX_1370_EXTERNAL_ORIENTATION_CHECK /* Nokia: add sanity check for Euler angles for external orientations */ #define NONBE_FIX_1197_OMASA_META_BUFFER /* Nokia: OMASA ISM_MASA_MODE_PARAM_ONE_OBJ history zero in rateswitching - port 251 */ +#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 #define TMP_FIX_SPLIT_REND // temporary fix to split-rendering (it follows the later state of the framework but it is needed now because of current test-conditions) -- GitLab