Commit dbe73573 authored by fotopoulou's avatar fotopoulou
Browse files

Merge branch '2097-unused-function-getattackfortcxdecision_fx' into 'main'

Resolve "Unused function GetAttackForTCXDecision_fx()"

Closes #2097

See merge request !2366
parents c2cded69 6af4c1a0
Loading
Loading
Loading
Loading
+0 −8
Original line number Original line Diff line number Diff line
@@ -7631,14 +7631,6 @@ void HQ_nbfec_init_fx(
    HQ_NBFEC_HANDLE hHQ_nbfec /* i/o: HQ NB FEC data handle  */
    HQ_NBFEC_HANDLE hHQ_nbfec /* i/o: HQ NB FEC data handle  */
);
);
void GetAttackForTCXDecision_fx(
    Word32 const *pSubblockNrg,
    Word32 const *pAccSubblockNrg,
    Word16 nSubblocks,
    Word16 nPastSubblocks,
    Word16 attackRatioThreshold,
    Word16 *pbIsAttackPresent,
    Word16 *pAttackIndex );
void hq_ecu_fx(
void hq_ecu_fx(
    const Word16 *prevsynth, /* i   : buffer of previously synthesized signal     */
    const Word16 *prevsynth, /* i   : buffer of previously synthesized signal     */
+0 −82
Original line number Original line Diff line number Diff line
@@ -259,88 +259,6 @@ static void GetAttackForTCXDecision_ivas_fx(
}
}




void GetAttackForTCXDecision_fx(
    Word32 const *pSubblockNrg,
    Word32 const *pAccSubblockNrg,
    Word16 nSubblocks,
    Word16 nPastSubblocks,
    Word16 attackRatioThreshold,
    Word16 *pbIsAttackPresent,
    Word16 *pAttackIndex )
{
    Word16 i;
    Word16 bIsAttackPresent, attackIndex;
    Word16 attackRatioThreshold_1_5;

    assert( nSubblocks >= NSUBBLOCKS );
    assert( nPastSubblocks >= 2 );

    /* attackRatioThreshold_1_5 = attackRatioThreshold * 1.5, exponent is ATTACKTHRESHOLD_E+1 */
    attackRatioThreshold_1_5 = add( shr( attackRatioThreshold, 2 ), shr( attackRatioThreshold, 1 ) );

    move16();
    move16();
    bIsAttackPresent = FALSE;
    attackIndex = 0;
    /* Search for the last attack in the subblocks */
    if ( s_or( (Word16) GT_32( L_shr( pSubblockNrg[-1], ATTACKTHRESHOLD_E ), Mpy_32_16_1( pAccSubblockNrg[-1], attackRatioThreshold ) ),
               L_sub( L_shr( pSubblockNrg[-2], ATTACKTHRESHOLD_E ), Mpy_32_16_1( pAccSubblockNrg[-2], attackRatioThreshold ) ) > 0 ) )
    {
        move16();
        bIsAttackPresent = TRUE;
    }

    FOR( i = 0; i < NSUBBLOCKS; i++ )
    {
        IF( GT_32( L_shr( pSubblockNrg[i], ATTACKTHRESHOLD_E ), Mpy_32_16_1( pAccSubblockNrg[i], attackRatioThreshold ) ) )
        {
            if ( i < 6 )
            {
                move16();
                bIsAttackPresent = TRUE;
            }

            if ( s_and( (Word16) NE_16( attackIndex, 2 ), (Word16) NE_16( attackIndex, 6 ) ) )
            {
                move16();
                attackIndex = i;
            }
        }
        ELSE /* no attack, but set index anyway in case of strong energy increase */
        {
            IF( s_and( ( (Word16) GT_32( L_shr( pSubblockNrg[i], 1 + ATTACKTHRESHOLD_E ), Mpy_32_16_1( pSubblockNrg[sub( i, 1 )], attackRatioThreshold_1_5 ) ) ),
                       ( L_sub( L_shr( pSubblockNrg[i], 1 + ATTACKTHRESHOLD_E ), Mpy_32_16_1( pSubblockNrg[sub( i, 2 )], attackRatioThreshold_1_5 ) ) > 0 ) ) )
            {

                if ( s_and( (Word16) NE_16( attackIndex, 2 ), (Word16) NE_16( attackIndex, 6 ) ) )
                {
                    move16();
                    attackIndex = i;
                }
            }
        }
    }
    /* avoid post-echos on click sounds (very short transients) due to TNS aliasing */
    if ( EQ_16( attackIndex, 4 ) )
    {
        move16();
        attackIndex = 7;
    }
    if ( EQ_16( attackIndex, 5 ) )
    {
        move16();
        attackIndex = 6;
    }

    move16();
    move16();
    *pAttackIndex = attackIndex;
    *pbIsAttackPresent = bIsAttackPresent;

    return;
}


/** Initialize TCX transient detector.
/** Initialize TCX transient detector.
 * See InitTransientDetector_fx for definition of parameters.
 * See InitTransientDetector_fx for definition of parameters.
 */
 */