Commit d976c7b5 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh Committed by Fabian Bauer
Browse files

Cleanup of float code

parent 5fa4449a
Loading
Loading
Loading
Loading

lib_enc/ACcontextMapping_enc.c

deleted100644 → 0
+0 −712
Original line number Diff line number Diff line
/******************************************************************************************************

   (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
   contributors to this repository. All Rights Reserved.

   This software is protected by copyright law and by international treaties.
   The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
   contributors to this repository retain full ownership rights in their respective contributions in
   the software. This notice grants no license of any kind, including but not limited to patent
   license, nor is any license granted by implication, estoppel or otherwise.

   Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
   contributions.

   This software is provided "AS IS", without any express or implied warranties. The software is in the
   development stage. It is intended exclusively for experts who have experience with such software and
   solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
   and fitness for a particular purpose are hereby disclaimed and excluded.

   Any dispute, controversy or claim arising under or in relation to providing this software shall be
   submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
   accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
   the United Nations Convention on Contracts on the International Sales of Goods.

*******************************************************************************************************/

/*====================================================================================
    EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
  ====================================================================================*/

#include <stdint.h>
#include "options.h"
#include <assert.h>
#include "cnst.h"
#include "rom_com.h"
#include "prot.h"
#include "ivas_prot.h" /* Range coder header file */
#include "ivas_rom_com.h"
#include "ivas_rom_enc.h"
#include "wmc_auto.h"
#include "prot_fx.h"


/*-------------------------------------------------------------------*
 * ACcontextMapping_encode2_no_mem_s17_LC()
 *
 * Arithmetic encoder
 *-------------------------------------------------------------------*/
/*-------------------------------------------------------------------*
 * find_last_nz_pair()
 *
 *
 *-------------------------------------------------------------------*/

static Word16 find_last_nz_pair(
    const Word16 x[],
    const Word16 length,
    const CONTEXT_HM_CONFIG *hm_cfg )
{
    Word16 last_nz, i;
    const Word16 *tmp;

    last_nz = 2;
    move16();

    IF( hm_cfg )
    {
        /* mapped kernel */
        tmp = hm_cfg->indexBuffer;

        FOR( i = length; i >= 4; i -= 2 )
        {
            test();
            IF( x[tmp[i - 2]] || x[tmp[i - 1]] )
            {
                last_nz = i;
                move16();
                BREAK;
            }
        }
    }
    ELSE
    {
        /* unmapped kernel */

        FOR( i = length; i >= 4; i -= 2 )
        {
            test();
            IF( x[i - 2] || x[i - 1] )
            {
                last_nz = i;
                move16();
                BREAK;
            }
        }
    }

    return last_nz;
}


/*-------------------------------------------------------------------*
 * ACcontextMapping_encode2_estimate_no_mem_s17_LC()
 *
 *
 *-------------------------------------------------------------------*/
/*-------------------------------------------------------------------*
 * RCcontextMapping_encode2_estimate_no_mem_s17_LCS()
 *
 * Range coder bit-estimation
 *-------------------------------------------------------------------*/

Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS(
    Word16 *x,       /* Spectral coefficients */
    const Word16 nt, /* L - size of spectrum (no. of spectral coefficients) */
    Word16 *lastnz_out,
    Word16 *nEncoded,    /* No. of spectral coefficients that can be coded without an overflow occuring */
    const Word16 target, /* Target bits */
    Word16 *stop,
    Word16 mode,
    CONTEXT_HM_CONFIG *hm_cfg /* context-based harmonic model configuration */
)
{
    /* Common variables */
    Word16 a1, b1;
    Word16 k, pki, lev1;
    UWord16 t;
    Word16 lastnz, lastnz2;
    Word16 rateFlag;
    Word32 bit_estimate_fx;
    Word16 bit_estimate_e;
    Word16 symbol;
    const UWord8 *lookup;
    Word32 nbits2_fx; // Q23
    Word16 nbits2_e;  // Q23

    /* Initialization */
    bit_estimate_fx = 2 * ONE_IN_Q29;
    bit_estimate_e = 2;
    move32();
    nbits2_fx = 0;
    nbits2_e = 0;
    move32();

    /* bits to encode lastnz */
    k = 1;
    move16();

    WHILE( LT_16( k, nt / 2 ) )
    {
        bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, ONE_IN_Q30, 1, &bit_estimate_e );
        k = k << 1;
        /* check while condition */
    }

    nbits2_fx = bit_estimate_fx;
    nbits2_e = bit_estimate_e;

    IF( hm_cfg )
    {
        Word16 a1_i, b1_i;
        Word16 stop2;
        Word16 total_output_bits;
        Word16 nt_half;
        Word32 c[2], *ctx;
        Word32 p1, p2;
        Word16 ii[2];
        Word16 idx1, idx2, idx;
        Word16 numPeakIndicesOrig = 0, numHoleIndices = 0; /* only to avoid compiler warning */
        move16();
        move16();

        /* Rate flag */
        IF( GT_16( target, 400 ) )
        {
            rateFlag = 2 << NBITS_CONTEXT; /* Select context-A for higher bitrates */
            move16();
        }
        ELSE
        {
            rateFlag = 0; /* Select context-B for lower bitrates */
            move16();
        }

        nt_half = shr( nt, 1 );
        move16();
        stop2 = 0;
        move16();
        c[0] = c[1] = 0;
        move32();
        move32();

        /* Find last non-zero tuple in the mapped domain signal */
        lastnz = find_last_nz_pair( x, nt, hm_cfg );

        lastnz2 = 2;
        move16();

        /* mapped domain */
        numPeakIndicesOrig = hm_cfg->numPeakIndices;
        move16();
        hm_cfg->numPeakIndices = s_min( hm_cfg->numPeakIndices, lastnz );
        move16();
        numHoleIndices = sub( lastnz, hm_cfg->numPeakIndices );

        /* Mark hole indices beyond lastnz as pruned */
        FOR( k = numHoleIndices; k < hm_cfg->numHoleIndices; ++k )
        {
            hm_cfg->holeIndices[k] = add( hm_cfg->holeIndices[k], nt );
            move16();
        }

        ii[0] = numPeakIndicesOrig;
        move16();
        ii[1] = 0;
        move16();

        p1 = p2 = 0; /* to avoid compilation warnings */
        move32();
        move32();

        /* Main Loop through the 2-tuples */
        FOR( k = 0; k < lastnz; k += 2 )
        {
            a1_i = get_next_coeff_mapped_ivas_fx( ii, &p1, &idx1, hm_cfg );
            b1_i = get_next_coeff_mapped_ivas_fx( ii, &p2, &idx2, hm_cfg );

            idx = s_min( idx1, idx2 );

            /* Get context */
            ctx = &c[L_or( p1, p2 )];

            t = (UWord16) L_add( *ctx, rateFlag );
            IF( LT_16( nt_half, idx ) )
            {
                t = add( t, ( 1 << NBITS_CONTEXT ) );
            }

            /* Init current 2-tuple encoding */
            a1 = (Word16) abs( x[a1_i] );
            b1 = (Word16) abs( x[b1_i] );
            lev1 = -( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) );

            bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, s_min( a1, 1 ) * ONE_IN_Q30, 1, &bit_estimate_e );
            bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, s_min( b1, 1 ) * ONE_IN_Q30, 1, &bit_estimate_e );

            /* pre-compute address of ari_pk_s17_LC_ext[0][Val_esc] to avoid doing it multiple times inside the loop */
            lookup = &ari_lookup_s17_LC[t] + ( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) );

            /* check while condition */
            /* MSBs coding */
            WHILE( GE_16( s_max( a1, b1 ), A_THRES ) )
            {
                pki = lookup[lev1]; /* ESC symbol */

                bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC], 8, &bit_estimate_e );
                bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, 2 * ONE_IN_Q29, 2, &bit_estimate_e ); /* Add 2 LSB bits corresponding to the bit-plane */

                ( a1 ) = shr( a1, 1 );
                ( b1 ) = shr( b1, 1 );

                lev1 = s_min( add( lev1, ( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ) ), 2 << ( NBITS_CONTEXT + NBITS_RATEQ ) );

                /* check while condition */
            }

            pki = lookup[lev1];

            symbol = add( a1, i_mult( A_THRES, b1 ) );
            bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, ari_bit_estimate_s17_LC_fx[pki][symbol], 8, &bit_estimate_e );

            /* Should we truncate? */
            IF( GT_32( L_shr( bit_estimate_fx, sub( Q16, bit_estimate_e ) ), L_shl( target, Q15 ) ) )
            {
                stop2 = 1;
                move16();

                IF( *stop )
                {
                    BREAK;
                }
            }
            ELSE
            {
                lastnz2 = add( b1_i, 1 );
                nbits2_fx = bit_estimate_fx;
                move32();
                nbits2_e = bit_estimate_e;
                move16();
            }

            /* Update context for next 2-tuple */
            IF( EQ_32( p1, p2 ) ) /* peak-peak or hole-hole context */
            {
                lev1 = shr( lev1, NBITS_CONTEXT + NBITS_RATEQ );

                IF( lev1 <= 0 )
                {
                    t = add( 1, i_mult( add( a1, b1 ), add( lev1, 2 ) ) );
                }
                ELSE
                {
                    t = add( 13, lev1 );
                }

                *ctx = L_add( imult3216( L_and( *ctx, 0xf ), 16 ), t );
                move32();
            }
            ELSE
            {
                /* mixed context */

                IF( s_and( idx1, 1 ) )
                {
                    /* update first context */
                    c[p1] = update_mixed_context_ivas_fx( c[p1], (Word16) abs( x[a1_i] ) );
                    move32();
                }

                IF( s_and( idx2, 1 ) )
                {
                    /* update second context */
                    c[p2] = update_mixed_context_ivas_fx( c[p2], (Word16) abs( x[b1_i] ) );
                    move32();
                }
            }

        } /*end of the 2-tuples loop*/

        total_output_bits = round_fx( L_shr( bit_estimate_fx, sub( Q15, bit_estimate_e ) ) );

        IF( *stop )
        {
            total_output_bits = round_fx( L_shr( nbits2_fx, sub( Q15, nbits2_e ) ) );
        }

        IF( stop2 )
        {
            stop2 = total_output_bits;
            move16();
        }

        *nEncoded = lastnz2;
        move16();
        *stop = stop2; /* If zero, it means no overflow occured during bit-estimation */
        move16();
        *lastnz_out = lastnz;
        move16();

        /* Restore hole indices beyond lastnz */
        FOR( k = numHoleIndices; k < hm_cfg->numHoleIndices; ++k )
        {
            hm_cfg->holeIndices[k] = sub( hm_cfg->holeIndices[k], nt );
            move16();
        }
        hm_cfg->numPeakIndices = numPeakIndicesOrig;
        move16();

        return round_fx( L_add( L_shr( nbits2_fx, sub( Q15, nbits2_e ) ), ONE_IN_Q14 ) );
    }
    ELSE /* if (!hm_cfg) */
    {
        Word16 esc_nb, cp, rateQ;
        UWord16 s;
        Word16 tot_bits2;
        Word16 overflow_flag = 0;

        /* Rate flag */
        IF( GT_16( target, 400 ) )
        {
            rateFlag = 2;
            move16();
        }
        ELSE
        {
            rateFlag = 0; /* Select context-B for lower bitrates */
            move16();
        }

        t = 0;
        move16();
        s = 0;
        move16();
        cp = 0;
        move16();
        lastnz = 1;
        move16();
        lastnz2 = 0;
        move16();
        tot_bits2 = 0;
        move16();

        /* Find last non-zero tuple in the mapped domain signal */
        FOR( lastnz = sub( nt, 2 ); lastnz >= 0; lastnz -= 2 )
        {
            test();
            IF( ( x[lastnz] != 0 ) || ( x[lastnz + 1] != 0 ) )
            {
                BREAK;
            }
        }
        lastnz = add( lastnz, 2 );
        IF( LT_16( lastnz, 2 ) )
        {
            lastnz = 2; /* At least one tuple is coded */
            move16();
        }

        lastnz2 = 2;
        move16();

        /* Main Loop through the 2-tuples */
        FOR( k = 0; k < lastnz; k += 2 )
        {
            /* Init current 2-tuple encoding */
            a1 = abs_s( x[k] );
            b1 = abs_s( x[k + 1] );
            lev1 = 0;
            move16();
            esc_nb = 0;
            move16();
            rateQ = add( rateFlag, (Word16) GT_16( k, shr( nt, 1 ) ) );

            bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, s_min( a1, 1 ) * ONE_IN_Q30, 1, &bit_estimate_e );
            bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, s_min( b1, 1 ) * ONE_IN_Q30, 1, &bit_estimate_e );

            /* pre-compute address of ari_pk_s17_LC_ext[0][Val_esc] to avoid doing it multiple times inside the loop */
            lookup = &ari_lookup_s17_LC[t + shl( rateQ, NBITS_CONTEXT )];

            /* check while condition */
            /* MSBs coding */
            WHILE( GE_16( s_max( a1, b1 ), A_THRES ) )
            {
                pki = lookup[( esc_nb << ( NBITS_CONTEXT + NBITS_RATEQ ) )];

                bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC], 8, &bit_estimate_e );
                bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, 2 * ONE_IN_Q29, 2, &bit_estimate_e ); /* Add 2 LSB bits corresponding to the bit-plane */

                ( a1 ) = shr( a1, 1 );
                ( b1 ) = shr( b1, 1 );

                lev1 = add( lev1, 1 );
                esc_nb = s_min( lev1, 3 );

                /* check while condition */
            }

            pki = lookup[( esc_nb << ( NBITS_CONTEXT + NBITS_RATEQ ) )];

            symbol = add( a1, i_mult( A_THRES, b1 ) );
            bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, ari_bit_estimate_s17_LC_fx[pki][symbol], 8, &bit_estimate_e );

            /* Should we truncate? */
            IF( GT_32( L_shr( bit_estimate_fx, sub( Q16, bit_estimate_e ) ), L_shl( target, Q15 ) ) ) /* Overflow occured */
            {
                overflow_flag = 1;
                move16();
            }
            ELSE
            {
                IF( abs_s( x[k] ) || abs_s( x[k + 1] ) ) /* No overflow & non-zero tuple */
                {
                    nbits2_fx = bit_estimate_fx;
                    nbits2_e = bit_estimate_e;
                    move32();
                    lastnz2 = add( k, 2 );
                }
            }

            /* Update context for next 2-tuple */
            IF( LT_16( esc_nb, 2 ) )
            {
                cp = add( 1, i_mult( add( a1, b1 ), add( esc_nb, 1 ) ) );
            }
            ELSE
            {
                cp = add( 12, esc_nb );
            }
            /*shift old bits and replace last 4 bits*/
            s = ( s << 4 ) + cp;
            t = ( s & 0xFF );

        } /*end of the 2-tuples loop*/

        tot_bits2 = round_fx( L_shr( nbits2_fx, sub( Q15, nbits2_e ) ) );
        IF( lastnz2 < lastnz ) /* Overflow occured because unable to code all tuples */
        {
            overflow_flag = 1;
            move16();
        }
        IF( EQ_16( mode, -1 ) )
        {
            tot_bits2 = round_fx( L_shr( bit_estimate_fx, sub( Q15, bit_estimate_e ) ) );
        }
        IF( overflow_flag == 0 ) /* No overflow */
        {
            *stop = 0;
            move16();
        }
        ELSE /* Overflow */
            {
                IF( *stop ){
                        *stop = tot_bits2;
        move16();
    }
    ELSE
    {
        *stop = round_fx( L_shr( bit_estimate_fx, sub( Q15, bit_estimate_e ) ) );
        move16();
    }
}

*lastnz_out = lastnz;
move16();
*nEncoded = lastnz2;
move16();
/* Safety mechanism to avoid overflow */
test();
IF( EQ_16( lastnz2, 2 ) && EQ_16( overflow_flag, 1 ) )
{
    FOR( k = 0; k < lastnz2; k++ )
    {
        x[k] = 0;
        move16();
    }
}

return tot_bits2;
}
}

/*-------------------------------------------------------------------*
 * RCcontextMapping_encode2_estimate_bandWise_start()
 *
 * Range coder - start bandwise bit-estimation
 *-------------------------------------------------------------------*/

Word16 RCcontextMapping_encode2_estimate_bandWise_start(
    Word16 *x,
    const Word16 nt,
    const Word16 target,
    HANDLE_RC_CONTEXT_MEM hContextMem )
{
    Word16 i, k;

    /* Rate flag */
    IF( GT_16( target, 400 ) )
    {
        hContextMem->rateFlag = 2 << NBITS_CONTEXT;
        move16();
    }
    ELSE
    {
        hContextMem->rateFlag = 0;
        move16();
    }

    hContextMem->bit_estimate_fx = 2;
    move32();
    hContextMem->bit_estimate_e = Q31;
    move16();


    /* Init */
    hContextMem->nt_half = shr( nt, 1 );
    move16();

    /* bits to encode lastnz */
    k = 1;
    move16();

    WHILE( LT_16( k, hContextMem->nt_half ) )
    {
        hContextMem->bit_estimate_fx = L_add( hContextMem->bit_estimate_fx, 1 );
        move32();

        k = shl( k, 1 );
        /* check while condition */
    }

    /* bits to encode lastnz */
    hContextMem->nbits_old = extract_l( hContextMem->bit_estimate_fx );
    move16();

    hContextMem->ctx = 0;
    move16();
    hContextMem->lastnz = 2;
    move16();

    /* Find last non-zero tuple  */

    FOR( i = nt; i >= 4; i -= 2 )
    {
        test();
        IF( x[i - 2] != 0 || x[i - 1] != 0 )
        {
            hContextMem->lastnz = i;
            move16();
            break;
        }
    }
    Word16 tmp2 = extract_l( hContextMem->bit_estimate_fx );
    Word16 tmp = norm_l( hContextMem->bit_estimate_fx );
    hContextMem->bit_estimate_e = sub( Q31, tmp );
    move16();
    hContextMem->bit_estimate_fx = L_shl( hContextMem->bit_estimate_fx, tmp );
    move32();

    return tmp2;
}

/*-------------------------------------------------------------------*
 * RCcontextMapping_encode2_estimate_bandWise()
 *
 * Range coder - bandwise bit-estimation
 *-------------------------------------------------------------------*/

Word16 RCcontextMapping_encode2_estimate_bandWise(
    Word16 *x,
    const Word16 start_line,
    const Word16 end_line,
    HANDLE_RC_CONTEXT_MEM hContextMem )
{
    Word16 a1, b1, a1_i, b1_i;
    Word16 k, pki, lev1;
    UWord16 t;
    Word16 bandBits = 0;
    move16();
    Word16 total_output_bits; /* No. of bits after finalization */
    Word16 symbol;
    const UWord8 *lookup;
    Word16 idx;

    /* Main Loop through the 2-tuples */
    /*hContextMem->nt_half = end_line >> 1;*/
    FOR( k = start_line; k < min( hContextMem->lastnz, end_line ); k += 2 )
    {
        a1_i = k;
        move16();
        b1_i = add( k, 1 );

        idx = k;
        move16();

        /* Get context */
        t = add( hContextMem->ctx, hContextMem->rateFlag );
        t = add( t, GE_16( hContextMem->nt_half, idx ) ? 0 : ( 1 << NBITS_CONTEXT ) );

        /* Init current 2-tuple encoding */
        a1 = abs_s( x[a1_i] );
        b1 = abs_s( x[b1_i] );
        lev1 = -( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) );

        /* Signs Bits */
        hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, s_min( a1, 1 ) * ONE_IN_Q30, Q1, &hContextMem->bit_estimate_e );
        hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, s_min( b1, 1 ) * ONE_IN_Q30, Q1, &hContextMem->bit_estimate_e );

        /* pre-compute address of ari_pk_s17_LC_ext[0][Val_esc] to avoid doing it multiple times inside the loop */
        lookup = &ari_lookup_s17_LC[t] + ( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) );

        /* check while condition */
        /* MSBs coding */
        WHILE( GE_16( s_max( a1, b1 ), A_THRES ) )
        {
            pki = lookup[lev1];
            hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC], Q8, &hContextMem->bit_estimate_e );
            hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, 2 * ONE_IN_Q29, Q2, &hContextMem->bit_estimate_e ); /* Add the 2 LSB bits that were shifted out */
            // hContextMem->bit_estimate = hContextMem->bit_estimate + ari_bit_estimate_s17_LC[pki][VAL_ESC];
            // hContextMem->bit_estimate += 2; /* Add the 2 LSB bits that were shifted out */

            ( a1 ) = shr( a1, 1 );
            ( b1 ) = shr( b1, 1 );

            lev1 = s_min( add( lev1, ( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ) ), 2 << ( NBITS_CONTEXT + NBITS_RATEQ ) );
            /* check while condition */
        }

        pki = lookup[lev1];
        symbol = add( a1, i_mult( A_THRES, b1 ) ); /* MSB symbol */
        hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, ari_bit_estimate_s17_LC_fx[pki][symbol], Q8, &hContextMem->bit_estimate_e );
        // hContextMem->bit_estimate = hContextMem->bit_estimate + ari_bit_estimate_s17_LC[pki][symbol];

        /* Update context */
        lev1 = shr( lev1, NBITS_CONTEXT + NBITS_RATEQ );

        IF( lev1 <= 0 )
        {
            t = add( 1, i_mult( add( a1, b1 ), add( lev1, 2 ) ) );
        }
        ELSE
        {
            t = add( 13, lev1 );
        }

        hContextMem->ctx = add( i_mult( s_and( hContextMem->ctx, 0xf ), 16 ), t );

    } /*end of the 2-tuples loop*/
    total_output_bits = round_fx( L_shr( hContextMem->bit_estimate_fx, sub( Q15, hContextMem->bit_estimate_e ) ) );
    // total_output_bits = (Word16) ( hContextMem->bit_estimate + 0.5f );

    bandBits = sub( total_output_bits, hContextMem->nbits_old );
    hContextMem->nbits_old = total_output_bits;
    move16();

    return bandBits;
}

lib_enc/FEC_enc.c

deleted100644 → 0
+0 −216

File deleted.

Preview size limit exceeded, changes collapsed.

lib_enc/SNR_calc.c

deleted100644 → 0
+0 −42

File deleted.

Preview size limit exceeded, changes collapsed.

lib_enc/acelp_core_enc.c

deleted100644 → 0
+0 −970

File deleted.

Preview size limit exceeded, changes collapsed.

lib_enc/acelp_core_switch_enc.c

deleted100644 → 0
+0 −44

File deleted.

Preview size limit exceeded, changes collapsed.

Loading