Commit 0342dccc authored by Mohammadreza Naghibzadeh's avatar Mohammadreza Naghibzadeh
Browse files

Handle negative shr in hp20_fx_32_opt()

parent 6ec12b76
Loading
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -331,8 +331,10 @@ void hp20_fx_32_opt(
    move32();
    move32();
    move32();
#ifndef FIX_2086_ENABLE_HP20_OPT_FOR_ENC
    mem_fx[4] = L_deposit_l( prescale_current_frame );
    move32();
#endif

    IF( EQ_32( Fs, 8000 ) )
    {
@@ -405,7 +407,36 @@ void hp20_fx_32_opt(
    signal_fx[1] = W_round64_L( W_shl( W_y1, prescale ) );
    move32();

#ifdef FIX_2086_ENABLE_HP20_OPT_FOR_ENC
    Word16 scf_min = 63;
    move16();
    IF( GT_32( prescale, prescale_current_frame ) )
    {
        if ( NE_64( W_y1, 0 ) )
            scf_min = s_min( scf_min, W_norm( W_y1 ) );
        if ( NE_64( W_y2, 0 ) )
            scf_min = s_min( scf_min, W_norm( W_y1 ) );
        if ( NE_32( x1, 0 ) )
            scf_min = s_min( scf_min, norm_l( x1 ) );
        if ( NE_32( x2, 0 ) )
            scf_min = s_min( scf_min, norm_l( x2 ) );
        diff = sub( prescale_current_frame, prescale );
        diff = s_max( negate( scf_min ), diff );
        prescale_current_frame = add( prescale, diff );
        //prescale_current_frame = prescale;
        //diff = 0;
        //move16();
    }
    ELSE
    {
        diff = sub( prescale_current_frame, prescale );
    }
    mem_fx[4] = L_deposit_l( prescale_current_frame );
    move32();
#else
    diff = sub( prescale_current_frame, prescale );
#endif

    W_y1 = W_shr( W_y1, diff );
    W_y2 = W_shr( W_y2, diff );
    x2 = L_shr( x2, diff );