Commit 660343f7 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh Committed by Manuel Jander
Browse files

Bug fixes, ivas_prot.h cleanup, Q documentation updates

parent ddc14384
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@
#include "rom_com.h"
#include "prot_fx.h"
#include "wmc_auto.h"
#include "ivas_prot.h"
#include "ivas_prot_fx.h"

#define FSCALE_DENOM_BY_12800_Q15 1311
+169 −0
Original line number Diff line number Diff line
@@ -7555,3 +7555,172 @@ void rfft_fx(

    return;
}

Word16 find_guarded_bits_fx( Word32 n )
{
    // return n <= 1 ? 0 : n <= 2 ? 1
    //   : n <= 4 ? 2
    //   : n <= 8 ? 3
    //   : n <= 16 ? 4
    //   : n <= 32 ? 5
    //   : n <= 64 ? 6
    //   : n <= 128 ? 7
    //   : n <= 256 ? 8
    //   : n <= 512 ? 9
    //   : n <= 1024 ? 10
    //   : n <= 2048 ? 11
    //   : n <= 4096 ? 12
    //   : n <= 8192 ? 13
    //   : n <= 16384 ? 14
    //   : 15;
    /*Word16 val = 0;
    move32();
    test();
    WHILE( GT_32( n, L_shl( 1, val ) ) && LT_32( val, 16 ) )
    {
        val = add( val, 1 );
    }*/
    IF( LE_32( n, 1 ) )
    {
        return 0;
    }
    ELSE
    {

        return sub( 31, norm_l( L_sub( n, 1 ) ) );
    }
}

Word16 L_norm_arr( const Word32 *arr, Word16 size )
{
    Word16 q = 31;
    move16();
    FOR( Word16 i = 0; i < size; i++ )
#ifndef FIX_1103_OPT_L_NORM_ARR
    IF( arr[i] != 0 )
    {
        q = s_min( q, norm_l( arr[i] ) );
    }
#else
    {
        Word16 q_tst;

        q_tst = norm_l( arr[i] );
        if ( arr[i] != 0 )
        {
            q = s_min( q, q_tst );
        }
    }

#endif
    return q;
}

Word16 norm_arr( Word16 *arr, Word16 size )
{
    Word16 q = 15;
    Word16 exp = 0;
    move16();
    move16();
    FOR( Word16 i = 0; i < size; i++ )
    {
        if ( arr[i] != 0 )
        {
            exp = norm_s( arr[i] );
        }
        if ( arr[i] != 0 )
        {
            q = s_min( q, exp );
        }
    }
    return q;
}

Word16 W_norm_arr( Word64 *arr, Word16 size )
{
    Word16 q = 63;
    Word16 exp = 0;
    move16();
    move16();
    FOR( Word16 i = 0; i < size; i++ )
    {
        if ( arr[i] != 0 )
        {
            exp = W_norm( arr[i] );
        }
        if ( arr[i] != 0 )
        {
            q = s_min( q, exp );
        }
    }
    return q;
}

Word16 get_min_scalefactor( Word32 x, Word32 y )
{
#ifndef FIX_1104_OPT_GETMINSCALEFAC
    Word16 scf = Q31;
    move16();
    test();
    IF( x == 0 && y == 0 )
    {
        return 0;
    }
    IF( x != 0 )
    {
        scf = s_min( scf, norm_l( x ) );
    }
    IF( y != 0 )
    {
        scf = s_min( scf, norm_l( y ) );
    }
    return scf;
#else
    Word16 scf_y;
    Word16 scf = Q31;
    move16();

    test();
    if ( x == 0 && y == 0 )
    {
        scf = 0;
        move16();
    }

    if ( x != 0 )
    {
        scf = norm_l( x );
    }

    scf_y = norm_l( y );
    if ( y != 0 )
    {
        scf = s_min( scf_y, scf );
    }

    return scf;
#endif
}


Flag is_zero_arr( Word32 *arr, Word16 size )
{
    FOR( Word16 i = 0; i < size; i++ )
    IF( arr[i] != 0 )
    {
        return 0;
    }

    return 1;
}

Flag is_zero_arr16( Word16 *arr, Word16 size )
{
    FOR( Word16 i = 0; i < size; i++ )
    IF( arr[i] != 0 )
    {
        return 0;
    }

    return 1;
}
+0 −1
Original line number Diff line number Diff line
@@ -6,7 +6,6 @@
#include "cnst.h"      /* Common constants                       */
#include "rom_com.h"   /* Static table prototypes                */
#include "prot_fx.h"   /* Function prototypes                    */
#include "ivas_prot.h" /* Function prototypes                    */
#include "assert.h"    /* Debug prototypes                       */
#include "stl.h"
#include "ivas_prot_fx.h"
+0 −1
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@
#include "options.h"
#include "wmc_auto.h"
#include "prot_fx.h"
#include "ivas_prot.h"
#include "ivas_prot_fx.h"
#include "stat_dec.h"

+0 −1
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@
#include <math.h>
#include "ivas_cnst.h"
#include "ivas_rom_com.h"
#include "ivas_prot.h"
#include "prot_fx.h"
#include "cnst.h"
#include "wmc_auto.h"
Loading