Commit da23a911 authored by bayers's avatar bayers
Browse files

fix energy correction for ParamISM JBM rendering (#591)

parent 5ff2c140
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -171,6 +171,7 @@
#define FIX_264_AUDIO_CHANNELS_TO_HEAP                  /* VA: issue 243: Move audio channels memory from stack to heap */
#define FIX_691_OSBA_CRASH                              /* FhG: Fix for issue 691: Crash for OSBA Stereo out */
#define FIX_694_OMASA_EXTREME                           /* Nokia: fix for crash in OMASA on extreme sample */
#define FIX_591_PARAMISM_JBM_ENER_CORRECTION            /* FhG: fix energy correction in ParamISM rendering */


/* ################## End BE DEVELOPMENT switches ######################### */
+14 −2
Original line number Diff line number Diff line
@@ -1124,6 +1124,9 @@ void ivas_param_ism_dec_digest_tc(
    float direct_response[MAX_NUM_OBJECTS][PARAM_ISM_MAX_CHAN];
    DIRAC_DEC_HANDLE hDirAC;
    SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom;
#ifdef FIX_591_PARAMISM_JBM_ENER_CORRECTION
    int16_t fade_len;
#endif

    /* Initialization */
    hDirAC = st_ivas->hDirAC;
@@ -1133,7 +1136,12 @@ void ivas_param_ism_dec_digest_tc(
    ene_tc = 0.0f;
    ene_sum = 0.0f;
    last_gain = st_ivas->hDirAC->hParamIsm->last_dmx_gain;
#ifdef FIX_591_PARAMISM_JBM_ENER_CORRECTION
    fade_len = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( 2 * FRAMES_PER_SEC ) );
    output_frame = nCldfbSlots * hSpatParamRendCom->num_freq_bands;
#else
    output_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC );
#endif

    nchan_transport = st_ivas->nchan_transport;
    ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
@@ -1238,9 +1246,13 @@ void ivas_param_ism_dec_digest_tc(
    {
        /* Smoothing */
        gain = 0.75f * gain + 0.25f * last_gain;
        /* 10ms ramp */
#ifdef FIX_591_PARAMISM_JBM_ENER_CORRECTION
        grad = ( gain - last_gain ) / (float) fade_len; /* slope between two consecutive gains, 480 samples length */
        for ( i = 0; i < fade_len; i++ )
#else
        grad = ( gain - last_gain ) * 2.0f / (float) output_frame; /* slope between two consecutive gains, 480 samples length */
        for ( i = 0; i < ( output_frame / 2 ); i++ )
        for ( i = 0; i < output_frame / 2; i++ )
#endif
        {
            transport_channels_f[0][i] *= ( last_gain + i * grad );
            transport_channels_f[1][i] *= ( last_gain + i * grad );