Commit 9460d05a authored by norvell's avatar norvell Committed by Sandesh Venkatesh
Browse files

Added FIX_732, still work in progress

parent 07f95b5e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@
#ifndef BASOP_NOGLOB_DEV_USE_GLOBALS
#define BASOP_NOGLOB_DECLARE_LOCAL
#endif
#define FIX_732                                 /* Eri: Fix for precision issue in CNG generation -- still work in progress */

#define FIX_867_CLDFB_NRG_SCALE

+24 −1
Original line number Diff line number Diff line
@@ -1117,8 +1117,11 @@ Word16 ApplyFdCng_fx(
                        *cngNoiseLevel_exp = hFdCngCom->sidNoiseEstExp;
                        move16();
                    }

#ifdef FIX_732
                    s2 = ( sub( WORD32_BITS, 1 ) );
#else
                    s2 = -( ( WORD32_BITS - 1 ) );
#endif
                    move16();
                    /* Shape the SID noise levels in each FFT bin */
                    j = 0;
@@ -1158,7 +1161,11 @@ Word16 ApplyFdCng_fx(
                            facTabExp[k] = -( ( WORD32_BITS - 1 ) );
                            move16();
                        }
#ifdef FIX_732
                        s2 = s_min( s2, facTabExp[k] );
#else
                        s2 = s_max( s2, facTabExp[k] );
#endif
                    }
                    if ( EQ_16( s2, -31 ) )
                    {
@@ -1171,7 +1178,11 @@ Word16 ApplyFdCng_fx(
                        s = s_max( s_min( s, ( WORD32_BITS - 1 ) ), -( ( WORD32_BITS - 1 ) ) );
                        FOR( ; j <= hFdCngCom->part[k]; j++ )
                        {
#ifdef FIX_732
                            cngNoiseLevel[j] = L_shl_sat( Mpy_32_16_1( hFdCngDec->bandNoiseShape[j], facTab[k] ), s ); /*Q31 - hFdCngDec->bandNoiseShape_exp*/
#else
                            cngNoiseLevel[j] = L_shl( Mpy_32_16_1( hFdCngDec->bandNoiseShape[j], facTab[k] ), s ); /*Q31 - hFdCngDec->bandNoiseShape_exp*/
#endif
                            move32();
                        }
                    }
@@ -1209,7 +1220,11 @@ Word16 ApplyFdCng_fx(
            {
                IF( !( LT_16( hFdCngCom->msFrCnt_init_counter, hFdCngCom->msFrCnt_init_thresh ) ) )
                {
#ifdef FIX_732
                    s2 = ( sub( WORD32_BITS, 1 ) );
#else
                    s2 = -( ( WORD32_BITS - 1 ) );
#endif
                    /* Shape the SID noise levels in each FFT bin */
                    j = 0;
                    move16();
@@ -1248,7 +1263,11 @@ Word16 ApplyFdCng_fx(
                            facTabExp[k] = -( WORD32_BITS - 1 );
                            move16();
                        }
#ifdef FIX_732
                        s2 = s_min( s2, facTabExp[k] );
#else
                        s2 = s_max( s2, facTabExp[k] );
#endif
                    }
                    IF( EQ_16( s2, -31 ) )
                    {
@@ -1261,7 +1280,11 @@ Word16 ApplyFdCng_fx(
                        s = s_max( s_min( s, sub( WORD32_BITS, 1 ) ), negate( sub( WORD32_BITS, 1 ) ) );
                        FOR( ; j <= hFdCngCom->part[k]; j++ )
                        {
#ifdef FIX_732
                            cngNoiseLevel[j] = L_shl_sat( Mpy_32_16_1( hFdCngDec->bandNoiseShape[j], facTab[k] ), s ); /*Q31 - hFdCngDec->bandNoiseShape_exp*/
#else
                            cngNoiseLevel[j] = L_shl( Mpy_32_16_1( hFdCngDec->bandNoiseShape[j], facTab[k] ), s ); /*Q31 - hFdCngDec->bandNoiseShape_exp*/
#endif
                            move32();
                        }
                    }