Commit edcb1ede authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Division and modulus operator optimizations - 1

[x] Replaced get_next_indice_1, get_next_indice and sr2fscale with get_next_indice_1_fx, get_next_indice_fx and sr2fscale_fx respectively
parent 573fdff5
Loading
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -1121,7 +1121,7 @@ void dec_prm_core( Decoder_State *st )
        }

        /* Get bandwidth mode */
        st->bwidth = get_next_indice( st, FrameSizeConfig[frame_size_index].bandwidth_bits );
        st->bwidth = get_next_indice_fx( st, FrameSizeConfig[frame_size_index].bandwidth_bits );
        move16();

        st->bwidth = add( st->bwidth, FrameSizeConfig[frame_size_index].bandwidth_min );
@@ -1147,11 +1147,11 @@ void dec_prm_core( Decoder_State *st )
        /* Skip reserved bit */
        get_next_indice_tmp_fx( st, FrameSizeConfig[frame_size_index].reserved_bits );

        IF( get_next_indice_1( st ) != 0 ) /* TCX */
        IF( get_next_indice_1_fx( st ) != 0 ) /* TCX */
        {
            st->core = TCX_20_CORE;
            move16();
            if ( get_next_indice_1( st ) != 0 )
            if ( get_next_indice_1_fx( st ) != 0 )
            {
                st->core = HQ_CORE;
                move16();
@@ -1214,7 +1214,7 @@ void decision_matrix_core_dec(
    ELSE IF( GE_32( st->total_brate, ACELP_24k40 ) && LE_32( st->total_brate, ACELP_64k ) )
    {
        /* read the ACELP/HQ core selection bit */
        st->core = imult1616( get_next_indice( st, 1 ), HQ_CORE );
        st->core = imult1616( get_next_indice_fx( st, 1 ), HQ_CORE );
        move16();
    }
    ELSE
@@ -1245,7 +1245,7 @@ void decision_matrix_core_dec(
        start_idx = add( start_idx, 1 );

        /* retrieve the signalling indice */
        ind = acelp_sig_tbl[add( start_idx, get_next_indice( st, nBits ) )];
        ind = acelp_sig_tbl[add( start_idx, get_next_indice_fx( st, nBits ) )];
        st->bwidth = extract_l( L_and( L_shr( ind, 3 ), 0x7 ) );
        move16();

@@ -1265,7 +1265,7 @@ void decision_matrix_core_dec(
    IF( EQ_16( st->core, HQ_CORE ) )
    {
        /* read the HQ/TCX core switching flag */
        if ( get_next_indice( st, 1 ) != 0 )
        if ( get_next_indice_fx( st, 1 ) != 0 )
        {
            st->core = TCX_20_CORE;
            move16();
@@ -1275,7 +1275,7 @@ void decision_matrix_core_dec(
        test();
        IF( EQ_16( st->core, TCX_20_CORE ) && GT_32( st->total_brate, ACELP_16k40 ) )
        {
            ind = get_next_indice( st, 2 );
            ind = get_next_indice_fx( st, 2 );

            IF( ind == 0 )
            {
+2 −2
Original line number Diff line number Diff line
@@ -1892,7 +1892,7 @@ Word16 get_nor_delta_hf_fx(
    move16();
    IF( GE_16( core_sfm, num_env_bands ) )
    {
        bitsforDelta = (Word16) get_next_indice( st, 2 );
        bitsforDelta = (Word16) get_next_indice_fx( st, 2 );
        bitsforDelta = add( bitsforDelta, 2 );
        add_bits_denv = add( add_bits_denv, 2 );

@@ -1900,7 +1900,7 @@ Word16 get_nor_delta_hf_fx(
        {
            IF( Rsubband[i] != 0 )
            {
                delta = (Word16) get_next_indice( st, bitsforDelta );
                delta = (Word16) get_next_indice_fx( st, bitsforDelta );
                ynrm[i] = add( ynrm[i], sub( delta, ( shl( 1, sub( bitsforDelta, 1 ) ) ) ) );
                move16();

+17 −17
Original line number Diff line number Diff line
@@ -67,15 +67,15 @@ void isf_dec_amr_wb_fx(
    IF( EQ_32( st->core_brate, SID_1k75 ) )
    {

        indice[0] = (Word16) get_next_indice( st, 6 );
        indice[0] = (Word16) get_next_indice_fx( st, 6 );
        move16();
        indice[1] = (Word16) get_next_indice( st, 6 );
        indice[1] = (Word16) get_next_indice_fx( st, 6 );
        move16();
        indice[2] = (Word16) get_next_indice( st, 6 );
        indice[2] = (Word16) get_next_indice_fx( st, 6 );
        move16();
        indice[3] = (Word16) get_next_indice( st, 5 );
        indice[3] = (Word16) get_next_indice_fx( st, 5 );
        move16();
        indice[4] = (Word16) get_next_indice( st, 5 );
        indice[4] = (Word16) get_next_indice_fx( st, 5 );
        move16();

        disf_ns_28b_fx( indice, isf_new );
@@ -93,34 +93,34 @@ void isf_dec_amr_wb_fx(

    IF( EQ_32( st->core_brate, ACELP_6k60 ) )
    {
        indice[0] = (Word16) get_next_indice( st, 8 );
        indice[0] = (Word16) get_next_indice_fx( st, 8 );
        move16();
        indice[1] = (Word16) get_next_indice( st, 8 );
        indice[1] = (Word16) get_next_indice_fx( st, 8 );
        move16();
        indice[2] = (Word16) get_next_indice( st, 7 );
        indice[2] = (Word16) get_next_indice_fx( st, 7 );
        move16();
        indice[3] = (Word16) get_next_indice( st, 7 );
        indice[3] = (Word16) get_next_indice_fx( st, 7 );
        move16();
        indice[4] = (Word16) get_next_indice( st, 6 );
        indice[4] = (Word16) get_next_indice_fx( st, 6 );
        move16();

        disf_2s_36b_fx( indice, isf_new, st->mem_AR_fx, st->mem_MA_fx, 1 );
    }
    ELSE
    {
        indice[0] = (Word16) get_next_indice( st, 8 );
        indice[0] = (Word16) get_next_indice_fx( st, 8 );
        move16();
        indice[1] = (Word16) get_next_indice( st, 8 );
        indice[1] = (Word16) get_next_indice_fx( st, 8 );
        move16();
        indice[2] = (Word16) get_next_indice( st, 6 );
        indice[2] = (Word16) get_next_indice_fx( st, 6 );
        move16();
        indice[3] = (Word16) get_next_indice( st, 7 );
        indice[3] = (Word16) get_next_indice_fx( st, 7 );
        move16();
        indice[4] = (Word16) get_next_indice( st, 7 );
        indice[4] = (Word16) get_next_indice_fx( st, 7 );
        move16();
        indice[5] = (Word16) get_next_indice( st, 5 );
        indice[5] = (Word16) get_next_indice_fx( st, 5 );
        move16();
        indice[6] = (Word16) get_next_indice( st, 5 );
        indice[6] = (Word16) get_next_indice_fx( st, 5 );
        move16();

        disf_2s_46b_fx( indice, isf_new, st->mem_AR_fx, st->mem_MA_fx, 1 );
+4 −3
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include "wmc_auto.h"
#include "prot.h"
#include "ivas_prot.h"
#include "prot_fx.h"
#include "ivas_prot_fx.h"
#include "stat_dec.h"

@@ -56,13 +57,13 @@ void ivas_ari_start_decoding_14bits_ext_1_lfe(

    IF( GE_16( st->bits_frame, add( st->next_bit_pos, cbitsnew ) ) )
    {
        val = get_next_indice( st, cbitsnew );
        val = get_next_indice_fx( st, cbitsnew );
    }
    ELSE
    {
        Word16 rem_bits;
        rem_bits = sub( st->bits_frame, st->next_bit_pos );
        val = get_next_indice( st, rem_bits );
        val = get_next_indice_fx( st, rem_bits );
        val = L_shl( val, sub( cbitsnew, rem_bits ) );
        *extra_bits_read = add( *extra_bits_read, sub( cbitsnew, rem_bits ) );
        move16();
@@ -217,7 +218,7 @@ UWord16 ivas_ari_decode_14bits_bit_ext_1_lfe(
        }
        ELSE
        {
            value = UL_or( UL_lshl( value, 1 ), get_next_indice_1( st ) );
            value = UL_or( UL_lshl( value, 1 ), get_next_indice_1_fx( st ) );
        }
    }

+2 −0
Original line number Diff line number Diff line
@@ -155,6 +155,7 @@ void get_max_pulses(
    return;
}

#ifndef IVAS_FLOAT_FIXED
/*--------------------------------------------------------------------------*
 * fine_gain_dec()
 *
@@ -190,3 +191,4 @@ void fine_gain_dec(

    return;
}
#endif
Loading