Commit 9ced24f5 authored by thomas dettbarn's avatar thomas dettbarn
Browse files

removed some compiler warnings and commented the representations a bit better.

parent 9c6af891
Loading
Loading
Loading
Loading
Loading
+27 −27
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@
#include "prot_fx_enc.h"
#include "ivas_prot.h" /* Range coder header file */

#define MAKE_NUMBER_QX( number, QX )     ( ( number ) << ( QX ) )
#define MAKE_VARIABLE_QX( variable, QX ) W_shl( W_deposit32_l( L_deposit_l( ( variable ) ) ), ( QX ) )
#define MAKE_NUMBER_QX( number, QX )     ( ( number ) << ( QX ) )	/* evaulated at compile time */
#define MAKE_VARIABLE_QX( variable, QX ) W_shl( W_deposit32_l( L_deposit_l( ( variable ) ) ), ( QX ) )	/* evaluated at run time */

/*-------------------------------------------------------------------*
 * ACcontextMapping_encode2_no_mem_s17_LC_fx()
@@ -1346,8 +1346,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx(
            b1 = (Word16) abs( x[b1_i] );
            lev1 = -( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) );

            bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) );
            bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) );
            bit_estimate_fx = W_add( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) );
            bit_estimate_fx = W_add( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) );
            /* 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 ) );

@@ -1357,8 +1357,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx(
            {
                pki = lookup[lev1]; /* ESC symbol */

                bit_estimate_fx = W_add_nosat( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] );
                bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX( 2, Q23 ) );
                bit_estimate_fx = W_add( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] );
                bit_estimate_fx = W_add( bit_estimate_fx, MAKE_VARIABLE_QX( 2, Q23 ) );
                a1 = shr( a1, 1 );
                b1 = shr( b1, 1 );

@@ -1370,10 +1370,10 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx(
            pki = lookup[lev1];

            symbol = add( a1, i_mult( A_THRES, b1 ) ); /* Q0 */
            bit_estimate_fx = W_add_nosat( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] );
            bit_estimate_fx = W_add( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] );

            /* Should we truncate? */
            IF( GT_32( W_shr( bit_estimate_fx, Q8 ), L_shl( target, Q15 ) ) )
            IF( GT_32( W_extract_l( W_shr( bit_estimate_fx, Q8 ) ), L_shl( target, Q15 ) ) )
            {
                stop2 = 1;
                move16();
@@ -1428,11 +1428,11 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx(

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

        total_output_bits = round_fx( W_shr( bit_estimate_fx, Q7 ) );
        total_output_bits = round_fx( W_extract_l( W_shr( bit_estimate_fx, Q7 ) ) ); /* Q23 -> Q16 -> Q0 */

        IF( *stop )
        {
            total_output_bits = round_fx( W_shr( nbits2_fx, Q7 ) );
            total_output_bits = round_fx( W_extract_l( W_shr( nbits2_fx, Q7 ) ) ); /* Q23 -> Q16 -> Q0 */
        }

        IF( stop2 )
@@ -1458,7 +1458,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx(
        move16();


        return round_fx( L_add( W_shr( nbits2_fx, Q7 ), ONE_IN_Q14 ) ); /* Q0 */
        return round_fx( L_add( W_extract_l( W_shr( nbits2_fx, Q7 ) ), ONE_IN_Q14 ) ); /* Q0 */
    }
    ELSE /* if (!hm_cfg) */
    {
@@ -1524,8 +1524,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx(
            move16();
            rateQ = add( rateFlag, extract_l( GT_16( k, shr( nt, 1 ) ) ) ); /* Q0 */

            bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) );
            bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) );
            bit_estimate_fx = W_add( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) );
            bit_estimate_fx = W_add( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) );

            /* 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 )]; /* Q0 */
@@ -1537,8 +1537,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx(
                pki = lookup[( esc_nb << ( NBITS_CONTEXT + NBITS_RATEQ ) )]; /* Q0 */
                move16();

                bit_estimate_fx = W_add_nosat( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] );
                bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX( 2, Q23 ) );
                bit_estimate_fx = W_add( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] );
                bit_estimate_fx = W_add( bit_estimate_fx, MAKE_NUMBER_QX( 2, Q23 ) );

                a1 = shr( a1, 1 );
                b1 = shr( b1, 1 );
@@ -1553,10 +1553,10 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx(
            move16();

            symbol = add( a1, i_mult( A_THRES, b1 ) ); /* Q0 */
            bit_estimate_fx = W_add_nosat( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] );
            bit_estimate_fx = W_add( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] );

            /* Should we truncate? */
            IF( GT_32( W_shr( bit_estimate_fx, Q8 ), L_shl( target, Q15 ) ) )
            IF( GT_32( W_extract_l( W_shr( bit_estimate_fx, Q8 ) ), L_shl( target, Q15 ) ) )
            {
                overflow_flag = 1;
                move16();
@@ -1587,7 +1587,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx(

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

        tot_bits2 = round_fx( W_shr( nbits2_fx, Q7 ) );
        tot_bits2 = round_fx( W_extract_l( W_shr( nbits2_fx, Q7 ) ) ); /* Q23 -> Q16 -> Q0 */
        IF( LT_16( lastnz2, lastnz ) ) /* Overflow occured because unable to code all tuples */
        {
            overflow_flag = 1;
@@ -1595,7 +1595,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx(
        }
        IF( EQ_16( mode, -1 ) )
        {
            tot_bits2 = round_fx( W_shr( bit_estimate_fx, Q7 ) );
            tot_bits2 = round_fx( W_extract_l( W_shr( bit_estimate_fx, Q7 ) ) ); /* Q23 -> Q16 -> Q0 */
        }
        IF( overflow_flag == 0 ) /* No overflow */
        {
@@ -1610,7 +1610,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx(
    }
    ELSE
    {
        *stop = round_fx( W_shr( bit_estimate_fx, Q7 ) );
        *stop = round_fx( W_extract_l( W_shr( bit_estimate_fx, Q7 ) ) ); /* Q23 -> Q16 -> Q0 */
        move16();
    }
}
@@ -1683,7 +1683,7 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx(
    }

    /* bits to encode lastnz */
    hContextMem->nbits_old = round_fx( W_shr( hContextMem->bit_estimate_fx, Q7 ) ); /* Q0 */
    hContextMem->nbits_old = round_fx( W_extract_l( W_shr( hContextMem->bit_estimate_fx, Q7 ) ) ); /* Q0 */
    move16();

    hContextMem->ctx = 0;
@@ -1761,8 +1761,8 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx(
        lev1 = -( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ); /* Q0 */

        /* Signs Bits */
        hContextMem->bit_estimate_fx = W_add_nosat( hContextMem->bit_estimate_fx, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) );
        hContextMem->bit_estimate_fx = W_add_nosat( hContextMem->bit_estimate_fx, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) );
        hContextMem->bit_estimate_fx = W_add( hContextMem->bit_estimate_fx, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) );
        hContextMem->bit_estimate_fx = W_add( hContextMem->bit_estimate_fx, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) );

        move32();
        move32();
@@ -1777,8 +1777,8 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx(
            pki = lookup[lev1]; /* Q0 */
            move16();

            hContextMem->bit_estimate_fx = W_add_nosat( hContextMem->bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] );
            hContextMem->bit_estimate_fx = W_add_nosat( hContextMem->bit_estimate_fx, MAKE_VARIABLE_QX( 2, Q23 ) );
            hContextMem->bit_estimate_fx = W_add( hContextMem->bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] );
            hContextMem->bit_estimate_fx = W_add( hContextMem->bit_estimate_fx, MAKE_NUMBER_QX( 2, Q23 ) );
            move32();
            move32();

@@ -1796,7 +1796,7 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx(
        pki = lookup[lev1]; /* Q0 */
        move16();
        symbol = add( a1, i_mult( A_THRES, b1 ) ); /* MSB symbol    Q0*/
        hContextMem->bit_estimate_fx = W_add_nosat( hContextMem->bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] );
        hContextMem->bit_estimate_fx = W_add( hContextMem->bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] );

        move32();
        // hContextMem->bit_estimate = hContextMem->bit_estimate + ari_bit_estimate_s17_LC[pki][symbol];
@@ -1817,7 +1817,7 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx(
        move16();

    }                                                                          /*end of the 2-tuples loop*/
    total_output_bits = round_fx( W_shr( hContextMem->bit_estimate_fx, Q7 ) ); /* Q0 */
    total_output_bits = round_fx( W_extract_l( W_shr( hContextMem->bit_estimate_fx, Q7 ) ) ); /* Q0 */
    // total_output_bits = (Word16) ( hContextMem->bit_estimate + 0.5f );