Commit 01dd7613 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Merge remote-tracking branch 'origin/main' into...

Merge remote-tracking branch 'origin/main' into 2055-basop-PortMr2186-from-float-memory-reduction-for-audio-channels-in-jbm-decoder
parents 0bed2b83 ba2aad75
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -216,7 +216,7 @@ target_link_libraries(ISAR_post_rend lib_basop lib_isar lib_util lib_com)
target_include_directories(ISAR_post_rend PRIVATE lib_basop lib_isar)

add_executable(ambi_converter apps/ambi_converter.c)
target_link_libraries(ambi_converter lib_util lib_com lib_basop)
target_link_libraries(ambi_converter lib_util lib_com lib_basop lib_debug)
if(UNIX)
  target_link_libraries(ambi_converter m)
endif()
+26 −0
Original line number Diff line number Diff line
@@ -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;
+6 −0
Original line number Diff line number Diff line
@@ -83,7 +83,9 @@
#define FIX_2164_ASSERT_IN_OMASA_PREPROC_FOR_EDIT            /* Nokia: Issue 2164: Prevent overflow when calculating equalization coefficient for editing before clamping to safe range */
#define FIX_BASOP_ASSERT_IN_TONAL_MDCT_PLC                   /* FhG: fix for issue 2165 - using saturating addition in tonal MDCT PLC function */
#define OPT_2146_BASOP_UTIL_ADD_MANT32EXP                    /* Dlb: optimized version of BASOP_Util_Add_Mant32Exp() */
#define FIX_2166_ASSERT_OSBA_PLC_STEREO_OUT                  /* FhG: fix for issue 2166 - add missing averaging factor 0.5 in for the sum of energies in function stereo_dft_dmx_swb_nrg_fx()*/

#define FIX_1793_DEC_MC_TO_MONO_SCALING_ISSUE                /* FhG: Use dynamic Q factor for synth_fx and synthFB_fx to prevent overflow */
/* ################### End FIXES switches ########################### */

/* #################### Start BASOP porting switches ############################ */
@@ -111,9 +113,13 @@
#define FIX_NCHAN_BUFFERS                               /* VA: issue 1322: Correct the number of float buffers (channels) at the decoder */
#define FIX_RENDERER_STACK                              /* VA: issue 1322: reduction of renderers' buffers size */
#define JBM_MEMORY_OPT                                  /* VA: issue 916: optimization of RAM in the JBM decoder */
/*#define NONBE_1324_TC_BUFFER_MEMOERY_KEEP*/           /* VA: issue 1324: do not reset TSM memory in JBM bitrate switching */
#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. */
#define NONBE_1362_FIX_OMASA_TO_MASA1_RENDERING         /* Nokia: Fix OMASA to MASA1 rendering in IVAS_rend */
#define FIX_1383_HEAD_TRACK_SANITIZER                   /* Nok: issue 1383: Fix head tracking struc values reading in renderer */
#define FIX_1330_JBM_MEMORY                             /* VA: issue 1330: memory savings in the JBM decoder */

// object-editing feature porting
+3 −0
Original line number Diff line number Diff line
@@ -9101,6 +9101,9 @@ void decoder_tcx_ivas_fx(
    Word16 Aind[],
    Word16 synth_fx[],
    Word16 synthFB_fx[],
#ifdef FIX_1793_DEC_MC_TO_MONO_SCALING_ISSUE
    Word16 *synth_q,
#endif
    const Word16 bfi,
    const Word16 frame_cnt,
    const Word16 sba_dirac_stereo_flag );
+20 −3
Original line number Diff line number Diff line
@@ -3972,8 +3972,14 @@ void decoder_tcx_ivas_fx(
    Word16 prm[],
    Word16 A_fx[], // Q: 14 - norm_s(A_fx[0])
    Word16 Aind[], // Q: 14 - norm_s(Aind[0])
#ifdef FIX_1793_DEC_MC_TO_MONO_SCALING_ISSUE
    Word16 synth_fx[],
    Word16 synthFB_fx[],
    Word16 *synth_q,
#else
    Word16 synth_fx[],   // Q_syn
    Word16 synthFB_fx[], // Q_syn
#endif
    const Word16 bfi,
    const Word16 frame_cnt,
    const Word16 sba_dirac_stereo_flag )
@@ -4063,8 +4069,9 @@ void decoder_tcx_ivas_fx(
    move16();
    q_winFB = st->Q_syn;
    move16();

#ifndef FIX_1793_DEC_MC_TO_MONO_SCALING_ISSUE
    assert( q_win == 0 );
#endif

    Scale_sig( synth_fx, L_frame_glob, sub( q_win, st->Q_syn ) );        // Scaling to Q_syn
    Scale_sig( synthFB_fx, L_frameTCX_glob, sub( q_winFB, st->Q_syn ) ); // Scaling to Q_syn
@@ -4073,8 +4080,18 @@ void decoder_tcx_ivas_fx(
                          fUseTns, &synth_fx[0], &synthFB_fx[0], bfi, frame_cnt, sba_dirac_stereo_flag );

    /* Scaling up again */
#ifdef FIX_1793_DEC_MC_TO_MONO_SCALING_ISSUE
    Word16 q_min = s_min( add( q_win, getScaleFactor16( synth_fx, L_frame_glob ) ),
                          add( q_winFB, getScaleFactor16( synthFB_fx, L_frameTCX_glob ) ) );
    q_min = s_min( q_min, st->Q_syn );
    Scale_sig( synth_fx, L_frame_glob, sub( q_min, q_win ) );
    Scale_sig( synthFB_fx, L_frameTCX_glob, sub( q_min, q_winFB ) );
    *synth_q = q_min;
#else
    Scale_sig( synth_fx, L_frame_glob, sub( st->Q_syn, q_win ) );
    Scale_sig( synthFB_fx, L_frameTCX_glob, sub( st->Q_syn, q_winFB ) );
#endif

    // Scale_sig( st->hTcxDec->syn_Overl, L_FRAME32k / 2, 1 );

    Scale_sig( st->hTcxDec->old_syn_Overl, 320, ( -2 - st->hTcxDec->Q_old_syn_Overl ) ); // Scaling to Q-2
Loading