Commit 4a7062d5 authored by Arash Azizi's avatar Arash Azizi
Browse files

issue: 2481 Applying the same commits for shrink_frm_fx(). The two pairs were...

issue: 2481 Applying the same commits for shrink_frm_fx(). The two pairs were mostly different in the same places
parent e7fd7c44
Loading
Loading
Loading
Loading
+60 −12
Original line number Diff line number Diff line
@@ -149,18 +149,20 @@ static Word16 find_synch_fx( apa_state_t *ps, const Word16 *in, Word16 l_in, Wor

static bool copy_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], UWord16 *l_frm_out );

#ifndef HARMONIZE_2481_EXTEND_SHRINK

static bool shrink_frm_fx( apa_state_t *ps, const Word16 frm_in[], UWord16 maxScaling, Word16 frm_out[], UWord16 *l_frm_out );

static bool shrink_frm_ivas_fx( apa_state_t *ps, const Word16 frm_in[], UWord16 maxScaling, Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out );

#ifndef HARMONIZE_2481_EXTEND_SHRINK

static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], UWord16 *l_frm_out );

static bool extend_frm_ivas_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out );

#else

static bool shrink_frm_fx(apa_state_t* ps, const Word16 frm_in[], UWord16 maxScaling, Word16 frm_out[], Word16 Q_frm_in, UWord16* l_frm_out, Word16 leg_flag);

static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out, Word16 leg_flag );

#endif // !HARMONIZE_2481_EXTEND_SHRINK
@@ -798,7 +800,13 @@ UWord8 apa_exec_fx(
        /* shrink */
        ELSE IF( LT_32( ps->scale, 100 ) )
        {   

#ifndef HARMONIZE_2481_EXTEND_SHRINK
            shrink_frm_fx(ps, frm_in, maxScaling, a_out, &l_frm_out);
#else
            shrink_frm_fx(ps, frm_in, maxScaling, a_out, 0 ,&l_frm_out, (Word16) 1);
#endif // !HARMONIZE_2481_EXTEND_SHRINK
            
        }
        /* extend */
        ELSE
@@ -1037,7 +1045,11 @@ UWord8 apa_exec_ivas_fx(
            /* shrink */
            IF( LT_32( ps->scale, 100 ) )
            {
#ifndef HARMONIZE_2481_EXTEND_SHRINK
                shrink_frm_ivas_fx(ps, frm_in, maxScaling, a_tmp, Q_a_out, &l_frm_out);
#else
                shrink_frm_fx(ps, frm_in, maxScaling, a_tmp, Q_a_out, &l_frm_out, (Word16) 0);
#endif // !HARMONIZE_2481_EXTEND_SHRINK
            }
            /* extend */
            ELSE
@@ -1606,6 +1618,8 @@ static bool copy_frm_fx(
*
********************************************************************************
*/
#ifndef HARMONIZE_2481_EXTEND_SHRINK

static bool shrink_frm_fx(
    apa_state_t *ps,
    const Word16 frm_in_fx[], // Qx
@@ -1774,6 +1788,9 @@ static bool shrink_frm_fx(
    return 0;
}

#endif // !HARMONIZE_2481_EXTEND_SHRINK

#ifndef HARMONIZE_2481_EXTEND_SHRINK
static bool shrink_frm_ivas_fx(
    apa_state_t* ps,
    const Word16 frm_in_fx[], // Qx
@@ -1781,6 +1798,16 @@ static bool shrink_frm_ivas_fx(
    Word16 frm_out_fx[], // Qx
    Word16 Q_frm_in,
    UWord16* l_frm_out )
#else
static bool shrink_frm_fx(
    apa_state_t* ps,
    const Word16 frm_in_fx[], // Qx
    UWord16 maxScaling,
    Word16 frm_out_fx[], // Qx
    Word16 Q_frm_in,
    UWord16* l_frm_out,
    Word16 leg_flag)
#endif // !HARMONIZE_2481_EXTEND_SHRINK
{
    bool findSynchResult = 0;
    move16();
@@ -1815,7 +1842,11 @@ static bool shrink_frm_ivas_fx(
    }

    /* calculate overlap position */
#ifndef HARMONIZE_2481_EXTEND_SHRINK
    IF(isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10))
#else
    IF((isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10) && (!leg_flag)) || (isSilence_fx(frm_in_fx, l_seg, 10) && leg_flag))
#endif // !HARMONIZE_2481_EXTEND_SHRINK
    {
        /* maximum scaling */
        energy_fx = -65 * ( 1 << 8 ); // Q8
@@ -1856,11 +1887,24 @@ static bool shrink_frm_ivas_fx(
    {
        /* find synch */
        scaleSignal16( frm_in_fx, ps->frmInScaled, l_frm, ps->signalScaleForCorrelation );
#ifndef HARMONIZE_2481_EXTEND_SHRINK
        ps->signalScaleForCorrelation = sub(ps->signalScaleForCorrelation, Q_frm_in);
        move16();
        findSynchResult = find_synch_fx(ps, ps->frmInScaled, l_frm, s_start, (UWord16)(sub(s_end, s_start)), 0, l_seg, 0, &energy_fx, &quality_fx, &xtract);
        ps->signalScaleForCorrelation = add(ps->signalScaleForCorrelation, Q_frm_in);
        move16();
#else
    IF(leg_flag) {
        findSynchResult = find_synch_fx(ps, ps->frmInScaled, l_frm, s_start, (UWord16)(sub(s_end, s_start)), 0, l_seg, 0, &energy_fx, &quality_fx, &xtract);
    }
    ELSE{
        ps->signalScaleForCorrelation = sub(ps->signalScaleForCorrelation, Q_frm_in);
        move16();
        findSynchResult = find_synch_fx(ps, ps->frmInScaled, l_frm, s_start, (UWord16)(sub(s_end, s_start)), 0, l_seg, 0, &energy_fx, &quality_fx, &xtract);
        ps->signalScaleForCorrelation = add(ps->signalScaleForCorrelation, Q_frm_in);
        move16();
    }
#endif // !HARMONIZE_2481_EXTEND_SHRINK 
    }

    /* assert synch_pos is cleanly divisible by number of channels */
@@ -1892,7 +1936,11 @@ static bool shrink_frm_ivas_fx(
    ELSE
    {
        /* sufficient quality */
#ifndef HARMONIZE_2481_EXTEND_SHRINK
        IF(ps->bad_frame_count > 0)
#else
        IF(GT_32(ps->bad_frame_count, 0))
#endif // !HARMONIZE_2481_EXTEND_SHRINK
        {
            ps->bad_frame_count = u_extract_l( UL_subNsD( ps->bad_frame_count, 1 ) );
            move16();