Commit 98f09f30 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch '3gpp_issue_1511_fix' into 'main'

[non-BE][allow regression] Fix for 1511 - Stereo downmix EVS - Bad mode selection based on ITD. 

See merge request !1572
parents c615e278 9671e929
Loading
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -54,12 +54,12 @@

#define SUPPORT_JBM_TRACEFILE                   /* Support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */

/*#define WMOPS*/                                   /* Activate complexity and memory counters */
#define WMOPS                                   /* Activate complexity and memory counters */
#ifdef WMOPS
/*#define WMOPS_PER_FRAME*/                     /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */
/*#define WMOPS_DETAIL*/                        /* Output detailed complexity printout for every function. Increases runtime overhead */
/*#define WMOPS_WC_FRAME_ANALYSIS*/             /* Output detailed complexity analysis for the worst-case frame */
/*#define MEM_COUNT_DETAILS*/                   /* Output detailed memory analysis for the worst-case frame (writes to the file "mem_analysis.csv") */
#define WMOPS_PER_FRAME                   /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */
#define WMOPS_DETAIL                       /* Output detailed complexity printout for every function. Increases runtime overhead */
#define WMOPS_WC_FRAME_ANALYSIS             /* Output detailed complexity analysis for the worst-case frame */
/*define MEM_COUNT_DETAILS*/                   /* Output detailed memory analysis for the worst-case frame (writes to the file "mem_analysis.csv") */
#endif

/* #################### End DEBUGGING switches ############################ */
@@ -100,6 +100,7 @@
#define FIX_1481_HARDCODE_DIV                          /* FhG: hardcode division results in stereo_dmx_evs_init_encoder_fx() */
#define VEC_ARITH_OPT_v1
#define FIX_1486_IND_SHB_RES                   /* VA: Fix for issue 1486: align the usage of IND_SHB_RES_GS indices with float code */
#define FIX_1511_POC_RENORM                    /* NTT: Fix for issue 1511: Renorm for POC. */

#define TEST_HR
#define REMOVE_EVS_DUPLICATES                   /* remove core-coder duplicated functions, ACELP low-band decoder */
+27 −25
Original line number Diff line number Diff line
@@ -1095,7 +1095,9 @@ void incrIf( const char *func_name );
#ifndef WMOPS
#define ELSE else
#else /* ifndef WMOPS */
#define ELSE else if ( incrElse( __func__ ), 0 ); else
#define ELSE                             \
    else if ( incrElse( __func__ ), 0 ); \
    else
void incrElse( const char *func_name );
#endif /* ifndef WMOPS */

+65 −0
Original line number Diff line number Diff line
@@ -98,6 +98,11 @@

#define STEREO_DMX_EVS_TRNS_EGY_FORGETTING_Q15 24576

#ifdef FIX_1511_POC_RENORM
#define STEREO_DMX_EVS_POC_RENORM_TH    33554432 // 65536 << 9
#define STEREO_DMX_EVS_POC_RENORM_SHIFT 3
#endif

const Word32 ipd_ff_Q31[STEREO_DMX_EVS_NB_SUBBAND_MAX] = {
    2027355264, 2027355264, 2027355264, 2027355264, 2027355264, 2027355264, 2027355264, 2027355264, 2027355264, 2027355264,
    2027355264, 2027355264, 2027355264, 2027355264, 2027355264, 2027355264, 2027355264, 2027355264, 2027355264, 2027355264,
@@ -412,6 +417,19 @@ static void calc_poc_fx(
            Rr = L_add( L_add( specRr[i], Mpy_32_32_r( specLr[i], eps_cos ) ), Mpy_32_32_r( specLi[i], eps_sin ) );
            Ri = L_add( L_sub( specRi[i], Mpy_32_32_r( specLr[i], eps_sin ) ), Mpy_32_32_r( specLi[i], eps_cos ) );

#ifdef FIX_1511_POC_RENORM
            IF( ( LT_32( L_abs( Lr ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
                ( LT_32( L_abs( Li ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
                ( LT_32( L_abs( Rr ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
                ( LT_32( L_abs( Ri ), STEREO_DMX_EVS_POC_RENORM_TH ) ) )
            {
                Lr = L_shl( Lr, STEREO_DMX_EVS_POC_RENORM_SHIFT );
                Li = L_shl( Li, STEREO_DMX_EVS_POC_RENORM_SHIFT );
                Rr = L_shl( Rr, STEREO_DMX_EVS_POC_RENORM_SHIFT );
                Ri = L_shl( Ri, STEREO_DMX_EVS_POC_RENORM_SHIFT );
            }
#endif

            specPOr[i] = L_add( Mpy_32_32_r( Lr, Rr ), Mpy_32_32_r( Li, Ri ) ); // 2*spec_e
            move32();
            specPOi[i] = L_sub( Mpy_32_32_r( Lr, Ri ), Mpy_32_32_r( Li, Rr ) ); // 2*spec_e
@@ -424,6 +442,19 @@ static void calc_poc_fx(
                Rr = L_add( L_sub( specRr[j], Mpy_32_32_r( specLr[j], eps_cos ) ), Mpy_32_32_r( specLi[j], eps_sin ) );
                Ri = L_sub( L_sub( specRi[j], Mpy_32_32_r( specLr[j], eps_sin ) ), Mpy_32_32_r( specLi[j], eps_cos ) );

#ifdef FIX_1511_POC_RENORM
                IF( ( LT_32( L_abs( Lr ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
                    ( LT_32( L_abs( Li ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
                    ( LT_32( L_abs( Rr ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
                    ( LT_32( L_abs( Ri ), STEREO_DMX_EVS_POC_RENORM_TH ) ) )
                {
                    Lr = L_shl( Lr, STEREO_DMX_EVS_POC_RENORM_SHIFT );
                    Li = L_shl( Li, STEREO_DMX_EVS_POC_RENORM_SHIFT );
                    Rr = L_shl( Rr, STEREO_DMX_EVS_POC_RENORM_SHIFT );
                    Ri = L_shl( Ri, STEREO_DMX_EVS_POC_RENORM_SHIFT );
                }
#endif

                specPOr[j] = L_add( Mpy_32_32_r( Lr, Rr ), Mpy_32_32_r( Li, Ri ) ); // 2*spec_e
                move32();
                specPOi[j] = L_sub( Mpy_32_32_r( Lr, Ri ), Mpy_32_32_r( Li, Rr ) ); // 2*spec_e
@@ -444,6 +475,20 @@ static void calc_poc_fx(
            Li = L_add( L_sub( specLi[i], Mpy_32_32_r( specRr[i], eps_sin ) ), Mpy_32_32_r( specRi[i], eps_cos ) );
            Rr = L_add( L_add( specRr[i], Mpy_32_32_r( specLr[i], eps_cos ) ), Mpy_32_32_r( specLi[i], eps_sin ) );
            Ri = L_add( L_sub( specRi[i], Mpy_32_32_r( specLr[i], eps_sin ) ), Mpy_32_32_r( specLi[i], eps_cos ) );

#ifdef FIX_1511_POC_RENORM
            IF( ( LT_32( L_abs( Lr ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
                ( LT_32( L_abs( Li ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
                ( LT_32( L_abs( Rr ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
                ( LT_32( L_abs( Ri ), STEREO_DMX_EVS_POC_RENORM_TH ) ) )
            {
                Lr = L_shl( Lr, STEREO_DMX_EVS_POC_RENORM_SHIFT );
                Li = L_shl( Li, STEREO_DMX_EVS_POC_RENORM_SHIFT );
                Rr = L_shl( Rr, STEREO_DMX_EVS_POC_RENORM_SHIFT );
                Ri = L_shl( Ri, STEREO_DMX_EVS_POC_RENORM_SHIFT );
            }
#endif

            specPOr[i] = L_add( Mpy_32_32_r( Lr, Rr ), Mpy_32_32_r( Li, Ri ) ); // 2*spec_e
            move32();
            specPOi[i] = L_sub( Mpy_32_32_r( Lr, Ri ), Mpy_32_32_r( Li, Rr ) ); // 2*spec_e
@@ -454,6 +499,20 @@ static void calc_poc_fx(
            Li = L_sub( L_sub( specLi[j], Mpy_32_32_r( specRr[j], eps_sin ) ), Mpy_32_32_r( specRi[j], eps_cos ) );
            Rr = L_add( L_sub( specRr[j], Mpy_32_32_r( specLr[j], eps_cos ) ), Mpy_32_32_r( specLi[j], eps_sin ) );
            Ri = L_sub( L_sub( specRi[j], Mpy_32_32_r( specLr[j], eps_sin ) ), Mpy_32_32_r( specLi[j], eps_cos ) );

#ifdef FIX_1511_POC_RENORM
            IF( ( LT_32( L_abs( Lr ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
                ( LT_32( L_abs( Li ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
                ( LT_32( L_abs( Rr ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
                ( LT_32( L_abs( Ri ), STEREO_DMX_EVS_POC_RENORM_TH ) ) )
            {
                Lr = L_shl( Lr, STEREO_DMX_EVS_POC_RENORM_SHIFT );
                Li = L_shl( Li, STEREO_DMX_EVS_POC_RENORM_SHIFT );
                Rr = L_shl( Rr, STEREO_DMX_EVS_POC_RENORM_SHIFT );
                Ri = L_shl( Ri, STEREO_DMX_EVS_POC_RENORM_SHIFT );
            }
#endif

            specPOr[j] = L_add( Mpy_32_32_r( Lr, Rr ), Mpy_32_32_r( Li, Ri ) ); // 2*spec_e
            move32();
            specPOi[j] = L_sub( Mpy_32_32_r( Lr, Ri ), Mpy_32_32_r( Li, Rr ) ); // 2*spec_e
@@ -1144,6 +1203,7 @@ static Word32 find_poc_peak_fx(
    Word16 itd_cand[CPE_CHANNELS], i, n, cnt[CPE_CHANNELS], Lh, peak_range, *on, *itdLR, prev_off[CPE_CHANNELS], eps_fx;
    Word32 Q_fx[CPE_CHANNELS], aQ_fx[CPE_CHANNELS], cQ_fx[CPE_CHANNELS], width_fx, *peak_width_fx, *peakQ_fx, cconfidence_fx, *P_fx, tmpf_fx, eps2_fx;
    Word16 tmpf_e = 0, eps2_e = 0, Q_e[CPE_CHANNELS], eps_e = 15, peakQ_e[CPE_CHANNELS];

    move16();
    move16();
    move16();
@@ -1535,6 +1595,7 @@ static void weighted_ave_fx(
{
    Word16 i, len;
    Word32 gain_tmp_fx = 0, gain_sub_fx;

    move32();
    len = shr( input_frame, 4 );
    gain_sub_fx = L_sub( gain_fx, old_gain_fx );
@@ -1569,6 +1630,7 @@ static void calc_energy_fx(
    Word32 E_32_fx, wnd_fx, wnd_diff_fx;
    Word16 i, adaptlen;
    Word64 E_fx;

    /* Initialization */
    E_fx = 0;
    move32();
@@ -1630,6 +1692,7 @@ static void calc_energy_fx(
    // *energy = *energy * ratio_float + ( E / (float) input_frame ) * ( 1.0f - ratio_float );
    *energy_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_32( *energy_fx, ratio_float_fx ), *energy_fx_e, Mpy_32_32( temp32, L_sub( MAX_32, ratio_float_fx ) ), sub( 31, q_temp32 ), energy_fx_e );
    move32();

    return;
}

@@ -1696,6 +1759,7 @@ static void create_M_signal_fx(
    Word32 temp32_1, temp32_2;
    Word16 temp_e;
    Word16 temp_e_1, temp_e_2;

    /* Initialization */
    eps_fx = 1024; // 1024.0f in Q0
    move32();
@@ -2150,6 +2214,7 @@ void stereo_dmx_evs_enc_fx(
    }

    Copy_Scale_sig32_16( p_dmx_data, data, n_samples, 5 ); // Q26->Q15

    pop_wmops();

    return;
+1 −1

File changed.

Contains only whitespace changes.

+4 −4

File changed.

Contains only whitespace changes.