Commit bc3120e8 authored by Fabian Bauer's avatar Fabian Bauer
Browse files

more cleanup

parent 362851f9
Loading
Loading
Loading
Loading
+12 −25
Original line number Diff line number Diff line
@@ -1941,14 +1941,15 @@ void perform_noise_estimation_enc_ivas_fx(
 * Generate a bitstream out of the partition levels
 *-------------------------------------------------------------------*/
#ifdef FIX_2489_HARMONIZE_FdCng_encodeSID
#define FIX_2489_HARMONIZE_FdCng_encodeSID_IVASHP /* FhG: check FdCng_encodeSID higher precision in IVAS case - development  */
void FdCng_encodeSID_fx(
    Encoder_State *corest /* i/o: encoder state structure     */
)
{
    Word16 i, index, N;
    Word16 normFacGain, normShiftGain, normFacN, normShiftN, E_Exp;
    Word16 E_Exp;
    Word16 indices[32];
    Word32 temp, gain_fx, e_fx, E_ExpLd64;
    Word32 temp, gain_fx, e_fx;
    Word32 v_fx[32];
    Word32 *E_fx;
    Word16 element_mode = corest->element_mode;
@@ -1960,14 +1961,6 @@ void FdCng_encodeSID_fx(
    HANDLE_FD_CNG_ENC hFdCngEnc = corest->hFdCngEnc;
    HANDLE_FD_CNG_COM hFdCngCom = hFdCngEnc->hFdCngCom;

    if( element_mode > 0 )
    {
        (void) normFacN;
        (void) normShiftN;
        (void) normFacGain;
        (void) normShiftGain;
        (void) E_ExpLd64;
    }

    /* Init */

@@ -1976,26 +1969,14 @@ void FdCng_encodeSID_fx(
    move16();
    E_Exp = hFdCngEnc->msNoiseEst_fx_exp;
    move16();
    IF( element_mode == 0 )
    {
        E_ExpLd64 = L_shl( E_Exp, WORD32_BITS - 1 - LD_DATA_SCALE );

        normFacN = getNormReciprocalWord16( N );
        normShiftN = BASOP_util_norm_s_bands2shift( N );

        normFacGain = getNormReciprocalWord16( N_GAIN_MAX - N_GAIN_MIN );
        normShiftGain = BASOP_util_norm_s_bands2shift( N_GAIN_MAX - N_GAIN_MIN );
    }
    ELSE
    {
        set_zero_fx( v_fx, FDCNG_VQ_MAX_LEN );
    }


    /* Convert to LOG */
    e_fx = L_deposit_l( 0 );
    IF( element_mode == 0 )
    {
        Word16 normShiftN = BASOP_util_norm_s_bands2shift( N );
        Word16 normFacN = getNormReciprocalWord16( N );
        Word32 E_ExpLd64 = L_shl( E_Exp, WORD32_BITS - 1 - LD_DATA_SCALE );
        /* e: Q14.23 format, v_fx: Q9.23 format */
        temp = Mpy_32_32_r( L_shl( 1, sub( 31, E_Exp ) ), 214748 ); /* 1e-4f, Q31-E_Exp */
        FOR( i = 0; i < N; i++ )
@@ -2010,6 +1991,7 @@ void FdCng_encodeSID_fx(
    }
    ELSE
    {
        set_zero_fx( v_fx, FDCNG_VQ_MAX_LEN );
        FOR( i = 0; i < N; i++ )
        {
            IF( E_fx[i] == 0 )
@@ -2033,6 +2015,8 @@ void FdCng_encodeSID_fx(
    move32();
    IF( element_mode == 0 )
    {
        Word16 normFacGain = getNormReciprocalWord16( N_GAIN_MAX - N_GAIN_MIN );
        Word16 normShiftGain = BASOP_util_norm_s_bands2shift( N_GAIN_MAX - N_GAIN_MIN );
        /* gain: Q9.23 format */
        FOR( i = N_GAIN_MIN; i < N_GAIN_MAX; i++ )
        {
@@ -2116,6 +2100,8 @@ void FdCng_encodeSID_fx(
    /* Compute gain */
    IF( element_mode == 0 )
    {
        Word16 normShiftN = BASOP_util_norm_s_bands2shift( N );
        Word16 normFacN = getNormReciprocalWord16( N );
        /*Q9.23 format */
        gain_fx = 0;
        FOR( i = 0; i < N; i++ )
@@ -2176,6 +2162,7 @@ void FdCng_encodeSID_fx(
    /* Apply gain and undo log */
    IF( element_mode == 0 )
    {
        Word32 E_ExpLd64;
        /* gain Q14.23 format */
        gain_fx = L_shl( L_deposit_l( index ), WORD32_BITS - 1 - 8 );
        gain_fx = L_sub( gain_fx, 503316480l /*60.0 Q23*/ );