Commit 73056b47 authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_BASOP_2457_HARM_GEN

parent 2d8cbe5e
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -84,7 +84,6 @@
#define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR      /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define HARM_HQ_CORE_KEEP_BE                            /* hack to keep all BE after HQ core functions harmonization; pending resolving issues #2450, #2451, #2452 */
#define FIX_BASOP_2457_HARM_GEN                         /* FhG: harmonization of function generate_comfort_noise_dec_hf_ivas_fx()*/
#define FIX_BASOP_2478_HARM_ENC_PRM_HM                  /* FhG: basop issue 2478: harmonize enc_prm_hm() and enc_prm_hm_ivas_fx() */
#define FIX_2455_HARMONIZE_generate_comfort_noise_enc   /* FhG: harmonize generate_comfort_noise_enc and generate_comfort_noise_enc_ivas */
#define FIX_2455_HARMONIZE_configureFdCngEnc            /* FhG: harmonize generate_comfort_noise_enc and generate_comfort_noise_enc_ivas */
+0 −9
Original line number Diff line number Diff line
@@ -6620,15 +6620,6 @@ void generate_comfort_noise_dec_ivas_fx(
    const Word16 nchan_out /* i  : number of output channels     */
);

#ifndef FIX_BASOP_2457_HARM_GEN
void generate_comfort_noise_dec_hf_ivas_fx(
    Word32 **bufferReal,         /* o   : matrix to real part of input bands   bufferScale*/
    Word32 **bufferImag,         /* o   : matrix to imaginary part of input bands  bufferScale*/
    Word16 *bufferScale,         /* o   : pointer to scalefactor for real and imaginary part of input bands */
    HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables  */
    const Word16 cng_coh_flag    /* i  : CNG Flag for coherence handling                        Q0*/
);
#endif

void generate_comfort_noise_dec_hf_fx(
    Word32 **bufferReal, /* o   : matrix to real part of input bands   bufferScale*/
+0 −4
Original line number Diff line number Diff line
@@ -1985,11 +1985,7 @@ ivas_error acelp_core_dec_fx(
                {
                    Word16 tmpBufferScale = 0;
                    move16();
#ifndef FIX_BASOP_2457_HARM_GEN
                    generate_comfort_noise_dec_hf_ivas_fx( realBuffer_fx, imagBuffer_fx, /*realBuffer, imagBuffer,*/ &tmpBufferScale, st->hFdCngDec->hFdCngCom, st->cng_ism_flag );
#else
                    generate_comfort_noise_dec_hf_fx( realBuffer_fx, imagBuffer_fx, /*realBuffer, imagBuffer,*/ &tmpBufferScale, st );
#endif // !FIX_BASOP_2457_HARM_GEN


                    FOR( i = 0; i < st->hFdCngDec->hFdCngCom->numSlots; i++ )
+0 −105
Original line number Diff line number Diff line
@@ -3431,93 +3431,12 @@ void generate_comfort_noise_dec_ivas_fx(
    return;
}

#ifndef FIX_BASOP_2457_HARM_GEN
void generate_comfort_noise_dec_hf_fx(
    Word32 **bufferReal, /* o   : matrix to real part of input bands  bufferScale*/
    Word32 **bufferImag, /* o   : matrix to imaginary part of input bands  bufferScale*/
    Word16 *bufferScale, /* o   : pointer to scalefactor for real and imaginary part of input bands */
    Decoder_State *st )
{
    Word16 i, j, s, sc, sn;
    Word16 scaleCLDFB;
    Word32 sqrtNoiseLevel;
    Word16 randGaussExp;
    Word16 cngNoiseLevelExp;
    Word16 *seed;
    Word32 *cngNoiseLevel;
    Word32 *ptr_level;
    HANDLE_FD_CNG_COM hFdCngCom = st->hFdCngDec->hFdCngCom;

    cngNoiseLevel = hFdCngCom->cngNoiseLevel + sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); /*Q31 - hFdCngCom->cngNoiseLevelExp*/
    cngNoiseLevelExp = hFdCngCom->cngNoiseLevelExp;
    move16();
    ptr_level = cngNoiseLevel; /*Q31 - hFdCngCom->cngNoiseLevelExp*/
    seed = &( hFdCngCom->seed );

    /* scaleCLDFB: CLDFBinvScalingFactor_EXP + 1 */
    scaleCLDFB = mult( hFdCngCom->invScalingFactor, CLDFB_SCALING ); /*CLDFBinvScalingFactor_EXP + 1*/

    sn = 0;
    move16();
    IF( s_and( cngNoiseLevelExp, 1 ) != 0 )
    {
        sn = add( sn, 1 );
        cngNoiseLevelExp = add( cngNoiseLevelExp, sn );
    }

    randGaussExp = CNG_RAND_GAUSS_SHIFT;
    move16();

    IF( LT_16( hFdCngCom->numCoreBands, hFdCngCom->regularStopBand ) )
    {

        sc = add( shr( add( cngNoiseLevelExp, CLDFBinvScalingFactor_EXP + 1 - 1 ), 1 ), randGaussExp );
        move16();
        assert( ( ( cngNoiseLevelExp + CLDFBinvScalingFactor_EXP + 1 - 1 ) & 1 ) == 0 );

        FOR( j = hFdCngCom->numCoreBands; j < hFdCngCom->regularStopBand; j++ )
        {
            /* scaleCLDFB:  CLDFBinvScalingFactor_EXP + 1 */
            s = 0;
            move16();
            sqrtNoiseLevel = Sqrt32( L_shr( Mpy_32_16_1( *ptr_level, scaleCLDFB ), sn ), &s ); /*Q31 - s*/

            FOR( i = 0; i < hFdCngCom->numSlots; i++ )
            {
                /* Real part in CLDFB band */
                bufferReal[i][j] = L_shl( Mpy_32_32( rand_gauss( seed ), sqrtNoiseLevel ), s ); /*bufferScale*/
                move32();
                /*fprintf(pFile,"%13.10f\n",WORD322FL_SCALE(bufferReal[i][j],sc));*/

                /* Imaginary part in CLDFB band */
                bufferImag[i][j] = L_shl( Mpy_32_32( rand_gauss( seed ), sqrtNoiseLevel ), s ); /*bufferScale*/
                move32();
                /*fprintf(pFile,"%13.10f\n",WORD322FL_SCALE(bufferImag[i][j],sc));*/
            }
            ptr_level = ptr_level + 1; /*Q31 - hFdCngCom->cngNoiseLevelExp*/
        }
        *bufferScale = sub( sc, 15 );
        move16();
    }
}

#endif // !FIX_BASOP_2457_HARM_GEN

#ifndef FIX_BASOP_2457_HARM_GEN
void generate_comfort_noise_dec_hf_ivas_fx(
    Word32 **bufferReal,         /* o   : matrix to real part of input bands   bufferScale*/
    Word32 **bufferImag,         /* o   : matrix to imaginary part of input bands  bufferScale*/
    Word16 *bufferScale,         /* o   : pointer to scalefactor for real and imaginary part of input bands */
    HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables  */
    const Word16 cng_coh_flag    /* i  : CNG Flag for coherence handling                        Q0*/
)
#else
void generate_comfort_noise_dec_hf_fx(
    Word32 **bufferReal, /* o   : matrix to real part of input bands   bufferScale*/
    Word32 **bufferImag, /* o   : matrix to imaginary part of input bands  bufferScale*/
    Word16 *bufferScale, /* o   : pointer to scalefactor for real and imaginary part of input bands */
    Decoder_State *st )
#endif
{
    Word16 i, j, s, sc, sn;
    Word16 scaleCLDFB;
@@ -3530,10 +3449,8 @@ void generate_comfort_noise_dec_hf_fx(
    Word32 *ptr_level;
    Word32 *cngNoiseLevel;
    Word32 tmp1, tmp2;
#ifdef FIX_BASOP_2457_HARM_GEN
    HANDLE_FD_CNG_COM hFdCngCom = st->hFdCngDec->hFdCngCom;
    Word16 cng_coh_flag = st->cng_ism_flag;
#endif // FIX_BASOP_2457_HARM_GEN

    cngNoiseLevel = hFdCngCom->cngNoiseLevel + sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); /*Q31 - hFdCngCom->cngNoiseLevelExp*/
    cngNoiseLevelExp = hFdCngCom->cngNoiseLevelExp;
@@ -3578,9 +3495,6 @@ void generate_comfort_noise_dec_hf_fx(
        cngNoiseLevelExp = add( cngNoiseLevelExp, sn );
        move16();
    }
#ifndef FIX_BASOP_2457_HARM_GEN
    randGaussExp = CNG_RAND_GAUSS_SHIFT + 1;
#else
    IF( EQ_16( st->element_mode, EVS_MONO ) )
    {
        randGaussExp = CNG_RAND_GAUSS_SHIFT;
@@ -3589,7 +3503,6 @@ void generate_comfort_noise_dec_hf_fx(
    {
        randGaussExp = CNG_RAND_GAUSS_SHIFT + 1;
    }
#endif // !FIX_BASOP_2457_HARM_GEN

    move16();

@@ -3605,20 +3518,12 @@ void generate_comfort_noise_dec_hf_fx(

        FOR( j = hFdCngCom->numCoreBands; j < hFdCngCom->regularStopBand; j++ )
        {
#ifdef FIX_BASOP_2457_HARM_GEN
            /* scaleCLDFB:  CLDFBinvScalingFactor_EXP + 1 */
            s = 0;
            move16();
            sqrtNoiseLevel = Sqrt32( L_shr( Mpy_32_16_1( *ptr_level, scaleCLDFB ), sn ), &s ); /*Q31 - s*/
#endif                                                                                         // FIX_BASOP_2457_HARM_GEN
            FOR( i = 0; i < hFdCngCom->numSlots; i++ )
            {
#ifndef FIX_BASOP_2457_HARM_GEN
                /* scaleCLDFB:  CLDFBinvScalingFactor_EXP + 1 */
                s = 0;
                move16();
                sqrtNoiseLevel = Sqrt32( L_shr( Mpy_32_16_1( *ptr_level, scaleCLDFB ), sn ), &s ); /*Q31 - s*/
#endif                                                                                             // FIX_BASOP_2457_HARM_GEN


                IF( cng_coh_flag )
@@ -3641,15 +3546,6 @@ void generate_comfort_noise_dec_hf_fx(
                }
                ELSE
                {
#ifndef FIX_BASOP_2457_HARM_GEN
                    /* Real part in CLDFB band */
                    bufferReal[i][j] = L_shl( Mpy_32_32( L_shr( rand_gauss( seed ), 1 ), sqrtNoiseLevel ), s ); /*bufferScale*/
                    move32();

                    /* Imaginary part in CLDFB band */
                    bufferImag[i][j] = L_shl( Mpy_32_32( L_shr( rand_gauss( seed ), 1 ), sqrtNoiseLevel ), s ); /*bufferScale*/
                    move32();
#else
                    IF( EQ_16( st->element_mode, EVS_MONO ) )
                    {
                        /* Real part in CLDFB band */
@@ -3672,7 +3568,6 @@ void generate_comfort_noise_dec_hf_fx(
                        bufferImag[i][j] = L_shl( Mpy_32_32( L_shr( rand_gauss( seed ), 1 ), sqrtNoiseLevel ), s ); /*bufferScale*/
                        move32();
                    }
#endif // !FIX_BASOP_2457_HARM_GEN
                }
            }
            ptr_level = ptr_level + 1; /*Q31 - hFdCngCom->cngNoiseLevelExp*/