Commit 73e27ddd authored by vaillancour's avatar vaillancour
Browse files

harmonisation of signal_clas

parent cf7f073c
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@
#define FIX_2391_INIT_HQ_GENERIC_OFFSET                 /* FhG/Eri: basop issue 2391: make sure hq_generic_offset is initialized inside hq_hr_dec_fx() */
#define FIX_2397_COPY_AQ_MDCT_CORE_BFI                  /* FhG: prevent copying of uninit memory in MDCT stereo core if bfi is set */
#define HARMONIZE_TBE                                   /* VA: harmonize core-coder TBE function duplications */

#define FIX_2404_HARM_SIGNAL_CLAS                       /* VA: basop-2404, harmonize signal_clas and signa_ivas_clas */
/* #################### End BE switches ################################## */

/* #################### Start NON-BE switches ############################ */
+4 −0
Original line number Diff line number Diff line
@@ -1258,7 +1258,11 @@ void pre_proc_front_ivas_fx(
     * TC frame selection
     *-----------------------------------------------------------------*/

#ifndef FIX_2404_HARM_SIGNAL_CLAS
    st->clas = signal_clas_ivas_fx( st, inp_12k8_fx, ee_fx, *relE_fx, L_look, tdm_SM_last_clas ); /* Q0 */
#else
    st->clas = signal_clas_fx( st, inp_12k8_fx, ee_fx, *relE_fx, L_look, tdm_SM_last_clas ); /* Q0 */
#endif
    move16();

    select_TC_fx( MODE1, st->tc_cnt, &st->coder_type, st->localVAD );
+2 −2
Original line number Diff line number Diff line
@@ -510,7 +510,7 @@ Word16 signal_clas_fx(
    const Word16 L_look,  /* i  : look-ahead                                        */
    Word16 *uc_clas       /* o  : temporary classification used in music/speech class*/
);

#ifndef FIX_2404_HARM_SIGNAL_CLAS
/* o  : classification for current frames  */
Word16 signal_clas_ivas_fx(
    Encoder_State *st,    /* i/o: encoder state structure                           */
@@ -520,7 +520,7 @@ Word16 signal_clas_ivas_fx(
    const Word16 L_look,  /* i  : look-ahead                                        */
    Word16 *uc_clas       /* o  : temporary classification used in music/speech class*/
);

#endif
void speech_music_classif_fx(
    Encoder_State *st,            /* i/o: state structure                                   */
    const Word16 *new_inp,        /* i  : new input signal                                  */
+56 −24
Original line number Diff line number Diff line
@@ -55,6 +55,9 @@ Word16 signal_clas_fx( /* o : classification for current
    Word16 i, clas, pc, zc, lo, lo2, hi, hi2, exp_ee, frac_ee;
    Word16 tmp16, tmpS;
    const Word16 *pt1;
#ifdef FIX_2404_HARM_SIGNAL_CLAS
    Word64 tmp64;
#endif
    Flag Overflow = 0;
    move32();

@@ -69,6 +72,33 @@ Word16 signal_clas_fx( /* o : classification for current
    Ltmp = L_mult( st->voicing_fx[1], 16384 ); /* Q15*Q14->Q30 */
    mean_voi2 = mac_r( Ltmp, st->voicing_fx[2], 16384 );


#ifdef FIX_2404_HARM_SIGNAL_CLAS    
    IF( st->element_mode != EVS_MONO )
    {
        tmp64 = W_mult0_32_32( ee[0], ee[1] );
        exp_ee = W_norm( tmp64 );
        Ltmp = W_extract_h( W_shl( tmp64, exp_ee ) ); // Q = Q6+Q6 + exp_ee - 32
        exp_ee = sub( 31, sub( add( Q12, exp_ee ), 32 ) );
        IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( Ltmp, exp_ee, ONE_IN_Q31, 0 ), -1 ) )
        {
            een = 0;
            move16();
        }
        ELSE
        {
            /* mean_ee2 = 0.5f * 20.0f * (float)log10( tmp ); */
            /* een = K_EE_ENC * mean_ee2 + C_EE_ENC; */
            Ltmp = BASOP_Util_Log10( Ltmp, exp_ee );                            // Q25
            Ltmp = Mpy_32_32( Ltmp, 671088640 /*20.f in Q25*/ );                // Q25 + Q25 -Q31 = Q19 * 0.5 = Q20
            een = extract_l( L_shl( Mpy_32_16_1( Ltmp, K_EE_FX ), Q9 - Q20 ) ); // Q9

            een = s_min( s_max( een, 0 ), 512 );
        }
    }
#endif
    {

        /* average spectral tilt in dB */
        lo = L_Extract_lc( ee[0], &hi );
        lo2 = L_Extract_lc( ee[1], &hi2 );
@@ -97,6 +127,7 @@ Word16 signal_clas_fx( /* o : classification for current
            een = round_fx( L_shl( Ltmp, 16 - 5 ) );   /* Q14 -> Q9 */
            een = mac_r( C_EE_FX, een, K_EE_FX );
        }
    }
    /* compute zero crossing rate */
    pt1 = speech + sub( L_look, 1 );
    tmpS = shr( *pt1, 15 ); /* sets 'tmpS to -1 if *pt1 < 0 */
@@ -268,7 +299,7 @@ Word16 signal_clas_fx( /* o : classification for current
    }
    return clas;
}

#ifndef FIX_2404_HARM_SIGNAL_CLAS
Word16 signal_clas_ivas_fx(                       /* o  : classification for current frames              */
                            Encoder_State *st,    /* i/o: encoder state structure                           */
                            const Word16 *speech, /* i  : pointer to speech signal for E computation in Qx */
@@ -498,6 +529,7 @@ Word16 signal_clas_ivas_fx( /* o : classification for cur
    }
    return clas;
}
#endif

/*-------------------------------------------------------------------*
 * select_TC_fx()