Commit 5cea8524 authored by multrus's avatar multrus
Browse files

add norm_arr2(), which runs across a big number of samples

parent dbfda4bb
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -4556,6 +4556,9 @@ Word16 find_guarded_bits_fx( Word32 n );
Word16 L_norm_arr( const Word32 *arr, Word16 size );
Word16 norm_arr( Word16 *arr, Word16 size );
#ifdef FIX1998_APA_EXEC_SCALING
Word16 norm_arr2( Word16 *arr, Word32 size );
#endif
Word16 W_norm_arr( Word64 *arr, Word16 size );
Word16 get_min_scalefactor( Word32 x, Word32 y );
+22 −0
Original line number Diff line number Diff line
@@ -4864,6 +4864,28 @@ Word16 norm_arr( Word16 *arr, Word16 size )
    return q;
}

#ifdef FIX1998_APA_EXEC_SCALING
Word16 norm_arr2( Word16 *arr, Word32 size )
{
    Word16 q = 15;
    Word16 exp = 0;
    move16();
    move16();
    FOR( Word32 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;
}
#endif

Word16 W_norm_arr( Word64 *arr, Word16 size )
{
    Word16 q = 63;
+1 −1
Original line number Diff line number Diff line
@@ -965,7 +965,7 @@ UWord8 apa_exec_ivas_fx(
        Word16 a_tmp[APA_BUF];
        Word16 *buf_out_ptr = &( ps->buf_out_fx[ps->l_buf_out - ps->l_frm] );
#ifdef FIX1998_APA_EXEC_SCALING
        Word16 Q_buf_out_tmp = sub( add( norm_arr( ps->buf_out_fx, ps->buf_out_capacity ), ps->Q_buf_out ), Q1 );
        Word16 Q_buf_out_tmp = sub( add( norm_arr2( ps->buf_out_fx, ps->buf_out_capacity ), ps->Q_buf_out ), Q1 );

        Q_a_out = s_min( Q_a_out, Q_buf_out_tmp );
#else