Commit 617fa295 authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

change type of hDownmix->inputEnergy and hDownmix->protoEnergy from a float...

change type of hDownmix->inputEnergy and hDownmix->protoEnergy from a float array to one float value
parent 85c3369f
Loading
Loading
Loading
Loading
Loading
+24 −3
Original line number Diff line number Diff line
@@ -68,9 +68,13 @@ ivas_error ivas_mono_dmx_renderer_open(
        return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for downmixing\n" ) );
    }

#ifdef NONBE_FIX_774_OSBA_MONO_DEC_CRASH
    hDownmix->inputEnergy = 0;
    hDownmix->protoEnergy = 0;
#else
	set_zero( hDownmix->inputEnergy, CLDFB_NO_CHANNELS_MAX );
    set_zero( hDownmix->protoEnergy, CLDFB_NO_CHANNELS_MAX );

#endif
    st_ivas->hMonoDmxRenderer = hDownmix;

    return IVAS_ERR_OK;
@@ -121,19 +125,36 @@ void ivas_mono_downmix_render_passive(
    }

    /* compute the input energy, proto energy after smoothing */
#ifdef NONBE_FIX_774_OSBA_MONO_DEC_CRASH
    hDownmix->inputEnergy *= DOWNMIX_ALPHA;
    hDownmix->protoEnergy *= DOWNMIX_ALPHA;
#else
	hDownmix->inputEnergy[0] *= DOWNMIX_ALPHA;
    hDownmix->protoEnergy[0] *= DOWNMIX_ALPHA;
#endif
    for ( i = 0; i < output_frame; i++ )
    {
#ifdef NONBE_FIX_774_OSBA_MONO_DEC_CRASH
        hDownmix->protoEnergy += proto_signal[i] * proto_signal[i];
#else
        hDownmix->protoEnergy[0] += proto_signal[i] * proto_signal[i];
#endif
        for ( j = 0; j < numInputChannels; j++ )
        {
#ifdef NONBE_FIX_774_OSBA_MONO_DEC_CRASH
            hDownmix->inputEnergy += ( output_f[j][i] * output_f[j][i] );
#else
            hDownmix->inputEnergy[0] += ( output_f[j][i] * output_f[j][i] );
#endif
        }
    }

    /* compute the eq factor */
#ifdef NONBE_FIX_774_OSBA_MONO_DEC_CRASH
    eq = min( DOWNMIX_MAX_GAIN, sqrtf( hDownmix->inputEnergy / ( EPSILON + hDownmix->protoEnergy ) ) );
#else
    eq = min( DOWNMIX_MAX_GAIN, sqrtf( hDownmix->inputEnergy[0] / ( EPSILON + hDownmix->protoEnergy[0] ) ) );
#endif

    /* equalize the downmix */
    v_multc( proto_signal, eq, output_f[0], output_frame );
+5 −0
Original line number Diff line number Diff line
@@ -1539,8 +1539,13 @@ typedef struct ivas_LS_setupconversion_mapping

typedef struct ivas_mono_downmix_renderer_struct
{
#ifdef NONBE_FIX_774_OSBA_MONO_DEC_CRASH
    float inputEnergy;
    float protoEnergy;
#else
    float inputEnergy[CLDFB_NO_CHANNELS_MAX];
    float protoEnergy[CLDFB_NO_CHANNELS_MAX];
#endif

} MONO_DOWNMIX_RENDERER_STRUCT, *MONO_DOWNMIX_RENDERER_HANDLE;