Commit 338a77ad authored by Fabian Bauer's avatar Fabian Bauer
Browse files

added macro ISSUE_1799_replace_L_shr_o and replaced one single critical L_shr_o for testing

parent f802b4b7
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@
#define ISSUE_1751_replace_shl_ro               /*FhG: replace shl_ro by overflow-free alternatives*/
#define ISSUE_1770_replace_shr_ro               /* FhG: replace by non-overflow-alternative - BE */
#define ISSUE_1772_replace_shr_o                /* FhG: replace by non-overflow-alternative - BE */
#define ISSUE_1799_replace_L_shr_o              /* FhG: replace by non-overflow-alternative - BE */

#define FIX_1735_W_SHL_SAT_L                    /* FhG: Usage of W_shl_sat_l() */

+9 −0
Original line number Diff line number Diff line
@@ -173,7 +173,16 @@ static Word16 GetSubbandCorrIndex2_har_fx( /* o :
            corr_sq_hi_fx = extract_h( L_corr_sq );

            L_corr_sq = L_mult_o( corr_sq_hi_fx, corr_sq_hi_fx, &Overflow );              /* (((Qhi:Qsh+exp_norm_hi-16)+Qss+1)+exp_norm-16)*2+1 */
#ifdef ISSUE_1799_replace_L_shr_o
            L_corr_sq = L_shr_sat( L_corr_sq, s_min( shl( exp_norm, 1 ), 31 ) ); /* (QCorr-16)*2+1 */
            /*  Catching an Overflow: solve MAX_32 = x / 2^y for integers x < 2^31 and y :
                x has to be MAX_32 and y has to be 0 
                So, a saturated overflow has occured if the result is MAX_32 and y is != 0 
                THe case MIN_32 with negative x is not valid since x is calculated by square */
            Overflow = ( ( L_corr_sq == MAX_32 ) && (  exp_norm != 0 ) ) ? 1 : 0;
#else
            L_corr_sq = L_shr_o( L_corr_sq, s_min( shl( exp_norm, 1 ), 31 ), &Overflow ); /* (QCorr-16)*2+1 */
#endif
            IF( Overflow != 0 )
            {
                L_corr_sq = 0x0L;