Commit 4a973cc4 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Float code cleanup, Instrumentation and BASOP addition

parent 23c07bf8
Loading
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -134,8 +134,10 @@ static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg );
static void usage_dec( void );
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec );
#if 0
void run_fft_unit_test( void );
void run_mdct_unit_test( void );
#endif

/*------------------------------------------------------------------------------------------*
 * main()
@@ -163,7 +165,9 @@ int main(
    RenderConfigReader *renderConfigReader = NULL;
    int16_t *pcmBuf = NULL;
    IVAS_RENDER_FRAMESIZE asked_frame_size;
#if 0
    int16_t run_unit_tests = 0;
#endif

#ifdef WMOPS
    reset_wmops();
@@ -176,6 +180,7 @@ int main(

    IVAS_DEC_PrintDisclaimer();

#if 0
    if ( run_unit_tests )
    {
        run_fft_unit_test();
@@ -183,6 +188,8 @@ int main(
        return 0;
    }

#endif

    if ( !parseCmdlIVAS_dec( (int16_t) argc, argv, &arg ) )
    {
        /* Error printout done in parseCmdlIVAS_dec() */
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ Word16 get_next_coeff_mapped_ivas(
    UWord32 p;

    p = s_and( sub( ii[1], hm_cfg->numPeakIndices ), sub( hm_cfg->indexBuffer[ii[1]], hm_cfg->indexBuffer[ii[0]] ) );
    p >>= sub( sizeof( p ) * 8, 1 );
    p = UL_lshr( p, sub( sizeof( p ) * 8, 1 ) );
    *pp = p;
    move32();
    *idx = ii[p];
+21 −18
Original line number Diff line number Diff line
@@ -289,13 +289,13 @@ Word16 CountIndexBits_fx(
 *
 *-------------------------------------------------------------------*/

int16_t tcx_hm_render_ivas(
    const int16_t lag,       /* i  : pitch lag                             */
    const int16_t fract_res, /* i  : fractional resolution of the lag      */
Word16 tcx_hm_render_ivas(
    const Word16 lag,       /* i  : pitch lag                             */
    const Word16 fract_res, /* i  : fractional resolution of the lag      */
    Word16 p[]              /* o  : harmonic model (Q13)                  */
)
{
    int16_t k;
    Word16 k;
    Word32 f0, tmp32;
    Word16 height, PeakDeviation, tmp;

@@ -327,13 +327,14 @@ int16_t tcx_hm_render_ivas(

    /* Render the prototype peak */
    p[kTcxHmParabolaHalfWidth] = height;
    move16();

    for ( k = 1; k <= kTcxHmParabolaHalfWidth; ++k )
    FOR( k = 1; k <= kTcxHmParabolaHalfWidth; ++k )
    {
        p[kTcxHmParabolaHalfWidth + k] = round_fx( Mpy_32_16_1( BASOP_Util_InvLog2( L_shl( L_mult0( mult0( negate( k ), k ), tmp ), 10 ) ), height ) );
    }
    /* Mirror */
    for ( k = -kTcxHmParabolaHalfWidth; k < 0; ++k )
    FOR( k = -kTcxHmParabolaHalfWidth; k < 0; ++k )
    {
        p[kTcxHmParabolaHalfWidth + k] = p[kTcxHmParabolaHalfWidth - k];
    }
@@ -405,14 +406,14 @@ Word32 tcx_hm_render_fx(

void tcx_hm_modify_envelope_ivas(
    const Word16 gain, /* i  : HM gain (Q11)                         */
    const int16_t lag,
    const int16_t fract_res,
    const Word16 lag,
    const Word16 fract_res,
    const Word16 p[],    /* i  : harmonic model (Q13)                  */
    Word32 env[],        /* i/o: envelope (Q16)                        */
    const int16_t L_frame /* i  : number of spectral lines              */
    const Word16 L_frame /* i  : number of spectral lines              */
)
{
    int16_t k, h, x;
    Word16 k, h, x;
    Word16 inv_shape[2 * kTcxHmParabolaHalfWidth + 1]; /* Q15 */

    if ( gain == 0 )
@@ -420,23 +421,25 @@ void tcx_hm_modify_envelope_ivas(
        return;
    }

    for ( k = 0; k < 2 * kTcxHmParabolaHalfWidth + 1; ++k )
    FOR( k = 0; k < 2 * kTcxHmParabolaHalfWidth + 1; ++k )
    {
        inv_shape[k] = div_s( 512, add( 512, round_fx( L_mult( gain, p[k] ) ) ) );
        move16();
    }

    h = 1;
    k = lag >> fract_res;
    k = shr( lag, fract_res );

    while ( k <= L_frame + kTcxHmParabolaHalfWidth - 1 )
    WHILE( k <= L_frame + kTcxHmParabolaHalfWidth - 1 )
    {

        for ( x = max( 0, k - kTcxHmParabolaHalfWidth ); x <= min( k + kTcxHmParabolaHalfWidth, L_frame - 1 ); ++x )
        FOR( x = max( 0, k - kTcxHmParabolaHalfWidth ); x <= min( k + kTcxHmParabolaHalfWidth, L_frame - 1 ); ++x )
        {
            env[x] = Mpy_32_16_1( env[x], inv_shape[x - k + kTcxHmParabolaHalfWidth] );
            move32();
        }
        ++h;
        k = ( h * lag ) >> fract_res;
        k = extract_l( L_shr( L_mult0( h, lag ), fract_res ) );
    }

    return;
+2 −1
Original line number Diff line number Diff line
@@ -945,8 +945,9 @@ Word16 BASOP_Util_Divide3232_uu_1616_Scale( Word32 x, Word32 y, Word16 *s )

Word32 div_w( Word32 L_num, Word32 L_den )
{
    Word32 L_var_out = (Word32) 0;
    Word32 L_var_out = 0;
    Word16 iteration;
    move32();


    IF( L_den == 0 )
+10 −10
Original line number Diff line number Diff line
@@ -762,14 +762,14 @@ ivas_error config_acelp1(
    core_brate = brate_intermed_tbl[i];
    move32();

    if ( element_mode > EVS_MONO )
    if ( GT_16( element_mode, EVS_MONO ) )
    {
        flag_hardcoded = 0; /* use automatic and flexible ACELP bit-budget allocation */
        move16();
    }

    test();
    if ( core != ACELP_CORE && element_mode == EVS_MONO ) /* needed for mode1 core switching in EVS mono */
    if ( NE_16( core, ACELP_CORE ) && EQ_16( element_mode, EVS_MONO ) ) /* needed for mode1 core switching in EVS mono */
    {
        flag_hardcoded = 1;
        move16();
@@ -1109,7 +1109,7 @@ ivas_error config_acelp1(
        {
            IF( EQ_16( tc_subfr, TC_0_0 ) )
            {
                if ( enc_dec == ENC )
                if ( EQ_16( enc_dec, ENC ) )
                {
                    bits = sub( bits, 1 ); /* TC signalling */
                }
@@ -1121,7 +1121,7 @@ ivas_error config_acelp1(
            }
            ELSE IF( EQ_16( tc_subfr, TC_0_64 ) )
            {
                if ( enc_dec == ENC )
                if ( EQ_16( enc_dec, ENC ) )
                {
                    bits = sub( bits, 4 ); /* TC signalling */
                }
@@ -1133,7 +1133,7 @@ ivas_error config_acelp1(
            }
            ELSE IF( EQ_16( tc_subfr, TC_0_128 ) )
            {
                if ( enc_dec == ENC )
                if ( EQ_16( enc_dec, ENC ) )
                {
                    bits = sub( bits, 4 ); /* TC signalling */
                }
@@ -1145,7 +1145,7 @@ ivas_error config_acelp1(
            }
            ELSE IF( EQ_16( tc_subfr, TC_0_192 ) )
            {
                if ( enc_dec == ENC )
                if ( EQ_16( enc_dec, ENC ) )
                {
                    bits = sub( bits, 3 ); /* TC signalling */
                }
@@ -1157,7 +1157,7 @@ ivas_error config_acelp1(
            }
            ELSE IF( EQ_16( tc_subfr, L_SUBFR ) )
            {
                if ( enc_dec == ENC )
                if ( EQ_16( enc_dec, ENC ) )
                {
                    bits = sub( bits, 3 ); /* TC signalling */
                }
@@ -1169,7 +1169,7 @@ ivas_error config_acelp1(
            }
            ELSE
            {
                if ( enc_dec == ENC )
                if ( EQ_16( enc_dec, ENC ) )
                {
                    bits = sub( bits, 4 ); /* TC signalling */
                }
@@ -1182,7 +1182,7 @@ ivas_error config_acelp1(
        }
        ELSE /* L_frame == L_FRAME16k */
        {
            IF( enc_dec == ENC )
            IF( EQ_16( enc_dec, ENC ) )
            {
                IF( LE_16( tc_subfr, 2 * L_SUBFR ) )
                {
@@ -1223,7 +1223,7 @@ ivas_error config_acelp1(
    test();
    test();
    test();
    IF( EQ_16( element_mode, IVAS_CPE_TD ) && EQ_16( tdm_low_rate_mode, 1 ) && coder_type != INACTIVE && NE_16( coder_type, UNVOICED ) ) /* GENERIC low rate mode for secondary channel */
    IF( EQ_16( element_mode, IVAS_CPE_TD ) && EQ_16( tdm_low_rate_mode, 1 ) && NE_16( coder_type, INACTIVE ) && NE_16( coder_type, UNVOICED ) ) /* GENERIC low rate mode for secondary channel */
    {
        set16_fx( acelp_cfg->pitch_bits, 0, NB_SUBFR16k );
        set16_fx( acelp_cfg->gains_mode, 0, NB_SUBFR16k );
Loading