Commit cace261c authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

move constants for mono detection to ivas_cnst.h

parent 6c06bd90
Loading
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1018,6 +1018,13 @@ typedef enum
#define DIRAC_SLOT_NS                           1250000L                    /* time duration of a time slot, 1.25ms (==DELAY_RENERER_NS/MAX_PARAM_SPATIAL_SUBFRAMES) */
#define DIRAC_SLOT_ENC_NS                       5000000L

#define DIRAC_MONO_THRESH_SILENCE				3e4f
#define DIRAC_MONO_NORM_FACTOR					1e13f
#define DIRAC_MONO_ONE_ON_NORM_FACTOR			(1.f / 1e13f)
#define DIRAC_MONO_MAX_THRESH					1e6f
#define DIRAC_MONO_MIN_THRESH					1e2f
#define DIRAC_MONO_FRAME_THRESH					15 /* 30ms */

typedef enum
{
    DIRAC_OPEN,                                 /* initialize to default value              */
+8 −15
Original line number Diff line number Diff line
@@ -434,13 +434,6 @@ static int16_t ivas_dirac_get_mono_flag(
    float W_band_power_norm;
    float threshold = 0;

    static const float THRESH_SILENCE = 3e4f;
    static const float NORM_FACTOR = 1e13f;
    static const float ONE_ON_NORM_FACTOR = 1 / 1e13f;
    static const float MAX_THRESH = 1e6f;
    static const float MIN_THRESH = 1e2f;
    static const float MONO_FRAME_THRESH = ( 15 ); /* 30ms */

    /* Banded Power Calculations */
    for ( i = 0; i < DIRAC_MAX_NBANDS; i++ )
    {
@@ -467,17 +460,17 @@ static int16_t ivas_dirac_get_mono_flag(
        }
        if ( other_ch_band_power < EPSILON )
        {
            if ( W_band_power > THRESH_SILENCE )
            if ( W_band_power > DIRAC_MONO_THRESH_SILENCE )
            {
                any_mono_band = 1;
            }
        }
        else
        {
            if ( ( W_band_power > THRESH_SILENCE ) || ( other_ch_band_power > THRESH_SILENCE ) )
            if ( ( W_band_power > DIRAC_MONO_THRESH_SILENCE ) || ( other_ch_band_power > DIRAC_MONO_THRESH_SILENCE ) )
            {
                W_band_power_norm = min( W_band_power, NORM_FACTOR ) * ONE_ON_NORM_FACTOR;
                threshold = max( W_band_power_norm * MAX_THRESH, MIN_THRESH );
                W_band_power_norm = min( W_band_power, DIRAC_MONO_NORM_FACTOR ) * DIRAC_MONO_ONE_ON_NORM_FACTOR;
                threshold = max( W_band_power_norm * DIRAC_MONO_MAX_THRESH, DIRAC_MONO_MIN_THRESH );
                if ( W_band_power / other_ch_band_power > threshold )
                {
                    any_mono_band = 1;
@@ -502,10 +495,10 @@ static int16_t ivas_dirac_get_mono_flag(
            local_mono_flag = 1;
        }
    }
    /* Hysteresis - only after MONO_FRAME_THRESH frames on mono will the actual mono flag be set */
    /* Hysteresis - only after DIRAC_MONO_FRAME_THRESH frames on mono will the actual mono flag be set */
    if ( local_mono_flag )
    {
        if ( *mono_frame_count < MONO_FRAME_THRESH )
        if ( *mono_frame_count < DIRAC_MONO_FRAME_THRESH )
        {
            ( *mono_frame_count )++;
        }
@@ -519,8 +512,8 @@ static int16_t ivas_dirac_get_mono_flag(
        }
    }

    /* Final check if there has been mono for MONO_FRAME_THRESH number of frames than the content is declared mono */
    if ( *mono_frame_count == MONO_FRAME_THRESH )
    /* Final check if there has been mono for DIRAC_MONO_FRAME_THRESH number of frames than the content is declared mono */
    if ( *mono_frame_count == DIRAC_MONO_FRAME_THRESH )
    {
        return 1;
    }
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@


#define MAX_BAND_SMOOTH    ( 1 )
#define SMOOTH_NORM_FACTOR ( 5.0f )
#define SMOOTH_DIRAC_MONO_NORM_FACTOR ( 5.0f )

static void ivas_calc_mat_det_2by2_complex( float in_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
                                            float in_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS],