Commit 30f61870 authored by JÜRGEN Gerstacker's avatar JÜRGEN Gerstacker
Browse files

removed DEBUG code

parent a131a9e2
Loading
Loading
Loading
Loading
Loading
+0 −103
Original line number Diff line number Diff line
@@ -12,8 +12,6 @@
/*---------------------------------------------------------------
 * Ari decode 14 bits routines
  -------------------------------------------------------------*/
// Please remove all DEBUG lines, when FIX_2402 is done!!
// #define DEBUG_ari_decode_14bits

#ifdef FIX_2402_SIMPLIFY_ARI_CODEC
static Word32 L_msui_32_16( Word32 cum, Word32 range, Word16 cum_freq )
@@ -27,10 +25,6 @@ static Word32 L_msui_32_16( Word32 cum, Word32 range, Word16 cum_freq )

Word32 ari_decode_overflow_fx( Tastat *s )
{
#ifdef DEBUG_ari_decode_14bits
    if ( s->high <= s->low )
        printf( "ari_decode_overflow detected: high=0x%08X  low=0x%08X\n", s->high, s->low );
#endif
#ifdef FIX_2402_SIMPLIFY_ARI_CODEC
    return ( L_sub( s->high, s->low ) <= 0 );
#else
@@ -59,9 +53,6 @@ void ari_start_decoding_14bits_fx(
    s->value = val;
    move32();

#ifdef DEBUG_ari_decode_14bits
    // printf( "ari_start_decoding_14bits_fx: low=0x%08X  high=0x%08X  value=0x%08X\n", s->low, s->high, s->value );
#endif
}

Word16 ari_start_decoding_14bits_prm_fx(
@@ -92,9 +83,6 @@ Word16 ari_start_decoding_14bits_prm_fx(
    s->value = val;
    move32();

#ifdef DEBUG_ari_decode_14bits
    // printf( "ari_start_decoding_14bits_prm_fx: low=0x%08X  high=0x%08X  value=0x%08X  i=%d\n", s->low, s->high, s->value, i );
#endif
    return add( bp, i );
}

@@ -394,11 +382,6 @@ static Word16 ari_decode_14bits_ext_fx(
    high = L_add( low, mul_sbc_14bits( range, cum_freq[symbol] ) );
    low = L_add( low, mul_sbc_14bits( range, cum_freq[add( symbol, 1 )] ) );

#ifdef DEBUG_ari_decode_14bits
//    printf( "ari_decode_14bits_ext_fx(look=%s): low=0x%08X  high=0x%08X  value=0x%08X  symbol=0x%04X  range=0x%08X  cum=0x%08X\n", ( lookup_fn == ari_lookup_bit_fx ) ? "bit" : ( lookup_fn == ari_lookup_s17_fx ) ? "s17" : "s27",
//        low, high, value, symbol, range, cum );
#endif

    FOR( i = 0; i < 0x7FFF; i++ )
    {
        Word32 L_msb_diff, L_msb_low, L_msb_high;
@@ -418,10 +401,6 @@ static Word16 ari_decode_14bits_ext_fx(
        high = L_shl( high, 1 );
        value = L_msu( value, 1, tab_ari_qnew[L_msb_high][L_msb_low] );
        value = L_mac0( L_shl( value, 1 ), 1, get_next_indice_1_fx( st ) );
#ifdef DEBUG_ari_decode_14bits
        // printf( "=>low=0x%08X  high=0x%08X  value=0x%08X  dh=%d  dl=%d\n",
        //         low, high, value, L_msb_high, L_msb_low );
#endif
    }

    s->low = low;
@@ -461,16 +440,7 @@ Word16 ari_decode_14bits_bit_ext_fx( Decoder_State *st, Tastat *s )
    move16();
    move16();
    move16();
#ifdef DEBUG_ari_decode_14bits
    Word16 bp = st->next_bit_pos;
    UWord16 *ptr = st->bit_stream;
    printf( "ari_decode_14bits_bit_ext(beg): high=0x%08X low=0x%08X value=0x%08X ptr[bp=%d] = %d | %d | %d | %d\n", s->high, s->low, s->value, bp, ptr[bp], ptr[bp + 1], ptr[bp + 2], ptr[bp + 3] );
    Word16 symbol = ari_decode_14bits_ext_fx( st, s, cum_freq, ari_lookup_bit_fx );
    printf( "ari_decode_14bits_bit_ext(end): high=0x%08X low=0x%08X value=0x%08X symbol=0x%04X  bp=%d\n", s->high, s->low, s->value, symbol, st->next_bit_pos );
    return symbol;
#else
    return ari_decode_14bits_ext_fx( st, s, cum_freq, ari_lookup_bit_fx );
#endif
}

static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base )
@@ -563,9 +533,6 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base )
    move32();
    s->low = L_add( s->low, mul_sbc_14bits( range, lowlim ) );
    move32();
#ifdef DEBUG_ari_decode_14bits
    printf( "ari_decode_14bits_pow_fx+mul_sbc_14bits: high: 0x%08X  low: 0x%08X  range: 0x%08X (lookup)\n", s->high, s->low, range );
#endif

    return symbol;
}
@@ -580,9 +547,6 @@ static Word16 ari_lookup_sign_fx( Tastat *s, Word16 base )
    range = L_sub( s->high, s->low );
    cum = L_sub( s->value, s->low );

#ifdef DEBUG_ari_decode_14bits
    printf( "sign-A: high: 0x%08X  low: 0x%08X  value: 0x%08X  range: 0x%08X  cum: 0x%08X\n", s->high, s->low, s->value, range, cum );
#endif
    range = L_shr( range, 1 );

    IF( GT_32( range, cum ) )
@@ -591,10 +555,6 @@ static Word16 ari_lookup_sign_fx( Tastat *s, Word16 base )
        move16();
        s->high = L_add( s->low, range );
        move32();
#ifdef DEBUG_ari_decode_14bits
        printf( "sign-B1: high: 0x%08X  low: 0x%08X  value: 0x%08X  range: 0x%08X  cum: 0x%08X\n", s->high, s->low, s->value, range, cum );

#endif
    }
    ELSE
    {
@@ -602,9 +562,6 @@ static Word16 ari_lookup_sign_fx( Tastat *s, Word16 base )
        move16();
        s->low = L_add( s->low, range );
        move32();
#ifdef DEBUG_ari_decode_14bits
        printf( "sign-B2: high: 0x%08X  low: 0x%08X  value: 0x%08X  range: 0x%08X  cum: 0x%08X\n", s->high, s->low, s->value, range, cum );
#endif
    }

    return symbol;
@@ -628,16 +585,6 @@ static Word16 ari_decode_14bits_notbl_fx(
    high = L_add( s->high, 0 );
    value = L_add( s->value, 0 );

#ifdef DEBUG_ari_decode_14bits
    // if (lookup_fn == ari_lookup_pow_fx)
    // printf( "ari_decode_14bits_pow_fx+mul_sbc_14bits: high: 0x%08X  low: 0x%08X\n", high, low );
#endif
#ifdef DEBUG_ari_decode_14bits
    // if ( lookup_fn == ari_lookup_pow_fx )
    //     printf( "ari_decode_14bits_notbl_fx (pow): symbol=0x%04X  high=0x%08X low=0x%08X value=0x%08X\n",
    //             symbol, high, low, value );
#endif

    FOR( ; bp < bits; ++bp )
    {
        Word32 L_msb_diff, L_msb_low, L_msb_high;
@@ -666,9 +613,6 @@ static Word16 ari_decode_14bits_notbl_fx(
    IF( ( lookup_fn != ari_lookup_sign_fx ) && !( NE_16( bp, bits ) || !( ( EQ_32( s->low, low ) ) && ( EQ_32( s->high, L_sub( high, 1 ) ) ) && ( EQ_32( s->value, value ) ) ) ) )
    {
        /* This should not happen except of bit errors. */
#ifdef DEBUG_ari_decode_14bits
        printf( "ari_decode_14bits_notbl_fx: bit error detected high: 0x%08X  low: 0x%08X  value: 0x%08X  bp: %d bits: %d\n", high, low, value, bp, bits );
#endif
        s->high = 0;
        move32();
        s->low = 0;
@@ -687,10 +631,6 @@ static Word16 ari_decode_14bits_notbl_fx(

    *res = symbol;
    move16();
#ifdef DEBUG_ari_decode_14bits
    if ( lookup_fn == ari_lookup_sign_fx )
        printf( "sign-X: high: 0x%08X  low: 0x%08X  value: 0x%08X  symbol: 0x%04X\n", high, low, value, *res );
#endif

    return bp;
}
@@ -708,27 +648,8 @@ static Word16 ari_decode_14bits_notbl_fx(
Word16 ari_decode_14bits_pow_fx( Word16 *ptr, Word16 bp, Word16 bits, Word16 *res, Tastat *s, Word16 base )
{
    /* There are two versions to call: pow_ivas or pow_fx (default) */
#if 0
#ifdef DEBUG_ari_decode_14bits
    printf( "ari_decode_14bits_pow_ivas(inp): high=0x%08X low=0x%08X value=0x%08X ptr[bp=%d] = %d | %d | %d | %d\n",
        s->high, s->low, s->value, bp, ptr[bp], ptr[bp+1], ptr[bp+2], ptr[bp+3] );
#endif        
    Word16 result = ari_decode_14bits_pow_ivas( ptr, bp, bits, res, s, base );
#ifdef DEBUG_ari_decode_14bits
    printf( "ari_decode_14bits_pow_ivas(end): high=0x%08X low=0x%08X value=0x%08X symbol=0x%04X  bp=%d\n", s->high, s->low, s->value, *res, result );
#endif    
    return result;
#else
#ifdef DEBUG_ari_decode_14bits
    printf( "ari_decode_14bits_pow_fx(inp): high=0x%08X low=0x%08X value=0x%08X ptr[bp=%d] = %d | %d | %d | %d\n",
            s->high, s->low, s->value, bp, ptr[bp], ptr[bp + 1], ptr[bp + 2], ptr[bp + 3] );
#endif
    Word16 result = ari_decode_14bits_notbl_fx( ptr, bp, bits, res, s, base, ari_lookup_pow_fx );
#ifdef DEBUG_ari_decode_14bits
    printf( "ari_decode_14bits_pow_fx(end): high=0x%08X low=0x%08X value=0x%08X symbol=0x%04X  bp=%d\n", s->high, s->low, s->value, *res, result );
#endif
    return result;
#endif
}

/*------------------------------------------------------------------------
@@ -738,14 +659,7 @@ Word16 ari_decode_14bits_pow_fx( Word16 *ptr, Word16 bp, Word16 bits, Word16 *re
 *-------------------------------------------------------------------------*/
Word16 ari_decode_14bits_sign_fx( Word16 *ptr, Word16 bp, Word16 bits, Word16 *res, Tastat *s )
{
#ifdef DEBUG_ari_decode_14bits
    // printf( "ari_decode_14bits_sign_fx(inp): high=0x%08X low=0x%08X value=0x%08X ptr[bp=%d] = %d | %d | %d | %d\n",
    //         s->high, s->low, s->value, bp, ptr[bp], ptr[bp + 1], ptr[bp + 2], ptr[bp + 3] );
#endif
    Word16 result = ari_decode_14bits_notbl_fx( ptr, bp, bits, res, s, 0, ari_lookup_sign_fx );
#ifdef DEBUG_ari_decode_14bits
    // printf( "ari_decode_14bits_sign_fx(end): high=0x%08X low=0x%08X value=0x%08X symbol=0x%04X  bp=%d\n", s->high, s->low, s->value, *res, result );
#endif
    return result;
}

@@ -820,10 +734,6 @@ Word16 ari_decode_14bits_pow_ivas(
    move32();


#ifdef DEBUG_ari_decode_14bits
    // printf( "ari_decode_14bits_pow_ivas: low=0x%08X  high=0x%08X  value=0x%08X  symbol=0x%04X  range=0x%08X  cum=0x%08X\n", low, high, value, symbol, range, cum );
#endif

    /* search for the interval where "cum" fits */
    IF( GT_64( W_mult0_32_32( L_shr( base, 1 ), range ), cum ) ) /* below pow-1 */
    {
@@ -847,9 +757,6 @@ Word16 ari_decode_14bits_pow_ivas(
                BREAK;
            }
        }
#ifdef DEBUG_ari_decode_14bits
        // printf( "ari_decode_14bits_pow_ivas (below-1): k=%d  symbol=0x%04X  pows[0]=0x%04X  pows[%d]=0x%04X\n", k, symbol, pows[0], k-1, pows[k-1] );
#endif
        assert( k < 12 ); /* maximum 2^10-1*/
        /* narrow the range down */
        FOR( k--; k > 0; k-- )
@@ -872,9 +779,6 @@ Word16 ari_decode_14bits_pow_ivas(
    }
    ELSE /* trivial case, above pow-1, that is, first symbol */
    {
#ifdef DEBUG_ari_decode_14bits
        // printf( "ari_decode_14bits_pow_ivas (above pow-1): symbol=0  base=0x%04X\n", base );
#endif
        symbol = 0;
        lowlim = extract_l( L_shr( base, 1 ) );
        highlim = 16384;
@@ -887,10 +791,6 @@ Word16 ari_decode_14bits_pow_ivas(

    low = L_add( low, mul_sbc_14bits( range, lowlim ) );

#ifdef DEBUG_ari_decode_14bits
    printf( "ari_decode_14bits_pow_ivas+mul_sbc_14bits: high: 0x%08X  low: 0x%08X  range: 0x%08X\n", high, low, range );
#endif

    /*ptr init for ptr*/
    FOR( ; bp < bits; )
    {
@@ -948,9 +848,6 @@ Word16 ari_decode_14bits_pow_ivas(

    *res = symbol;
    move16();
#ifdef DEBUG_ari_decode_14bits
    // printf( "ari_decode_14bits_pow_ivas(end): high=0x%08X low=0x%08X value=0x%08X symbol=0x%04X  bp=%d\n", s->high, s->low, s->value, *res, bp );
#endif
    return bp;
}