Commit 83d041a6 authored by Nicolas Roussin's avatar Nicolas Roussin
Browse files

Debug fx32.

parent 2a0924b8
Loading
Loading
Loading
Loading
Loading
+39 −28
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ void ivas_filters_init_fx(
            filter_state->den_q[IVAS_FILTER_STAGE_0][i] = Q30;
            move16();
            move16();
#else
            // #else FIXME
            filter_state->num_e[IVAS_FILTER_STAGE_0][i] = 1;
            filter_state->den_e[IVAS_FILTER_STAGE_0][i] = 1;
            move16();
@@ -80,14 +80,17 @@ void ivas_filters_init_fx(
#endif
        }

        filter_state->state_fx[IVAS_FILTER_STAGE_0][0] = 0;
        filter_state->state_fx[IVAS_FILTER_STAGE_0][1] = 0;
        filter_state->state_fx[IVAS_FILTER_STAGE_0][2] = 0;
#ifdef OPT_2239_IVAS_FILTER_PROCESS
        filter_state->state64_fx[IVAS_FILTER_STAGE_0][0] = 0;
        filter_state->state64_fx[IVAS_FILTER_STAGE_0][1] = 0;
        filter_state->state64_fx[IVAS_FILTER_STAGE_0][2] = 0;
        move64();
        move64();
        move64();
#else
        // #else FIXME
        filter_state->state_fx[IVAS_FILTER_STAGE_0][0] = 0;
        filter_state->state_fx[IVAS_FILTER_STAGE_0][1] = 0;
        filter_state->state_fx[IVAS_FILTER_STAGE_0][2] = 0;
        move32();
        move32();
        move32();
@@ -123,7 +126,7 @@ void ivas_filters_init_fx(
            move16();
            move16();
            move16();
#else
            // #else FIXME
            filter_state->num_e[IVAS_FILTER_STAGE_0][i] = filt_coeff_e[i];
            filter_state->den_e[IVAS_FILTER_STAGE_0][i] = filt_coeff_e[i + IVAS_BIQUAD_FILT_LEN];
            filter_state->num_e[IVAS_FILTER_STAGE_1][i] = filt_coeff_e[i + IVAS_BIQUAD_FILT_LEN * 2];
@@ -135,20 +138,26 @@ void ivas_filters_init_fx(
#endif
        }

        filter_state->state_fx[IVAS_FILTER_STAGE_0][0] = 0;
        filter_state->state_fx[IVAS_FILTER_STAGE_0][1] = 0;
        filter_state->state_fx[IVAS_FILTER_STAGE_0][2] = 0;
        filter_state->state_fx[IVAS_FILTER_STAGE_1][0] = 0;
        filter_state->state_fx[IVAS_FILTER_STAGE_1][1] = 0;
        filter_state->state_fx[IVAS_FILTER_STAGE_1][2] = 0;
#ifdef OPT_2239_IVAS_FILTER_PROCESS
        filter_state->state64_fx[IVAS_FILTER_STAGE_0][0] = 0;
        filter_state->state64_fx[IVAS_FILTER_STAGE_0][1] = 0;
        filter_state->state64_fx[IVAS_FILTER_STAGE_0][2] = 0;
        filter_state->state64_fx[IVAS_FILTER_STAGE_1][0] = 0;
        filter_state->state64_fx[IVAS_FILTER_STAGE_1][1] = 0;
        filter_state->state64_fx[IVAS_FILTER_STAGE_1][2] = 0;
        move64();
        move64();
        move64();
        move64();
        move64();
        move64();
#else
        // #else FIXME
        filter_state->state_fx[IVAS_FILTER_STAGE_0][0] = 0;
        filter_state->state_fx[IVAS_FILTER_STAGE_0][1] = 0;
        filter_state->state_fx[IVAS_FILTER_STAGE_0][2] = 0;
        filter_state->state_fx[IVAS_FILTER_STAGE_1][0] = 0;
        filter_state->state_fx[IVAS_FILTER_STAGE_1][1] = 0;
        filter_state->state_fx[IVAS_FILTER_STAGE_1][2] = 0;
        move32();
        move32();
        move32();
@@ -219,30 +228,28 @@ static void ivas_iir_2_filter_fx32(
    Word32 in, out;
    Word16 i, j, shift, state_q;

    state_q = add( q, 32 );

    FOR( i = 0; i < length; i++ )
    {
        in = pIn_Out_fx[i];
        move32();

        shift = filter_state->num_q[stage][0] + q - state_q;
        shift = sub( filter_state->num_q[stage][0], 32 );
        tmp_prod = W_shr( W_mult0_32_32( filter_state->num_fx[stage][0], in ), shift );

        pIn_Out_fx[i] = out = W_extract_h( W_add( filter_state->state_fx[stage][0], tmp_prod ) );
        pIn_Out_fx[i] = out = W_extract_h( W_add( filter_state->state64_fx[stage][0], tmp_prod ) );
        move32();

        FOR( j = 1; j < filter_state->filt_len; j++ )
        {
            shift = filter_state->num_q[stage][j] + q - state_q;
            shift = sub( filter_state->num_q[stage][j], 32 );
            tmp_prod = W_shr( W_mult0_32_32( filter_state->num_fx[stage][j], in ), shift );

            tmp = W_add( filter_state->state_fx[stage][j], tmp_prod );
            tmp = W_add( filter_state->state64_fx[stage][j], tmp_prod );

            shift = filter_state->den_q[stage][j] + q - state_q;
            shift = sub( filter_state->den_q[stage][j], 32 );
            tmp_prod = W_shr( W_mult0_32_32( filter_state->den_fx[stage][j], out ), shift );

            filter_state->state_fx[stage][j - 1] = W_sub( tmp, tmp_prod );
            filter_state->state64_fx[stage][j - 1] = W_sub( tmp, tmp_prod );
            move32();
        }
    }
@@ -262,6 +269,9 @@ void ivas_filter_process_fx32(
    const Word16 length,                        /* i  : filter order                    */
    Word16 q )
{
#if 1
    ivas_filter_process_fx( filter_state, pIn_Out_fx, length, q );
#else
    SWITCH( filter_state->order )
    {
        case IVAS_FILTER_ORDER_1:
@@ -274,6 +284,7 @@ void ivas_filter_process_fx32(
        default:
            BREAK;
    }
#endif

    return;
}
@@ -299,23 +310,23 @@ static void ivas_iir_2_filter_fx64(
        in = pIn_Out_fx[i];
        move32();

        shift = ( filter_state->num_q[stage][0] + q - 31 ) - q;
        shift = sub( filter_state->num_q[stage][0], 31 );
        tmp_prod = W_shr( Mpy_64_32( in, filter_state->num_fx[stage][0] ), shift );

        pIn_Out_fx[i] = out = W_add( filter_state->state_fx[stage][0], tmp_prod );
        pIn_Out_fx[i] = out = W_add( filter_state->state64_fx[stage][0], tmp_prod );
        move32();

        FOR( j = 1; j < filter_state->filt_len; j++ )
        {
            shift = ( filter_state->num_q[stage][j] + q - 31 ) - q;
            shift = sub( filter_state->num_q[stage][j], 31 );
            tmp_prod = W_shr( Mpy_64_32( in, filter_state->num_fx[stage][j] ), shift );

            tmp = W_add( filter_state->state_fx[stage][j], tmp_prod );
            tmp = W_add( filter_state->state64_fx[stage][j], tmp_prod );

            shift = ( filter_state->den_q[stage][j] + q - 31 ) - q;
            shift = sub( filter_state->den_q[stage][j], 31 );
            tmp_prod = W_shr( Mpy_64_32( out, filter_state->den_fx[stage][j] ), shift );

            filter_state->state_fx[stage][j - 1] = W_sub( tmp, tmp_prod );
            filter_state->state64_fx[stage][j - 1] = W_sub( tmp, tmp_prod );
            move32();
        }
    }
@@ -351,7 +362,7 @@ void ivas_filter_process_fx64(
    return;
}

#else
// #else FIXME
static void ivas_iir_2_filter_fx( ivas_filters_process_state_t *filter_state, Word32 *pIn_Out_fx, const Word16 length, const Word16 stage, Word16 *pIn_Out_e );

/*-----------------------------------------------------------------------------------------*
+1 −1
Original line number Diff line number Diff line
@@ -3817,7 +3817,7 @@ void ivas_filter_process_fx64(
    const Word16 length,                                        /* i  : filter order                                    */
    Word16 q 
);
#else
// #else FIXME
void ivas_filter_process_fx(
    ivas_filters_process_state_t *filter_state,                 /* i/o: filter state handle                             */
    Word32 *pIn_Out_fx,                                         /* i  : signal subject to filtering                     */
+2 −2
Original line number Diff line number Diff line
@@ -657,10 +657,10 @@ typedef struct ivas_filters_process_state_t
    Word32 num_fx[IVAS_FILTER_MAX_STAGES][IVAS_BIQUAD_FILT_LEN];
    Word32 den_fx[IVAS_FILTER_MAX_STAGES][IVAS_BIQUAD_FILT_LEN];
#ifdef OPT_2239_IVAS_FILTER_PROCESS
    Word64 state_fx[IVAS_FILTER_MAX_STAGES][IVAS_BIQUAD_FILT_LEN];
    Word64 state64_fx[IVAS_FILTER_MAX_STAGES][IVAS_BIQUAD_FILT_LEN];
    Word16 num_q[IVAS_FILTER_MAX_STAGES][IVAS_BIQUAD_FILT_LEN];
    Word16 den_q[IVAS_FILTER_MAX_STAGES][IVAS_BIQUAD_FILT_LEN];
#else
    // #else FIXME
    Word32 state_fx[IVAS_FILTER_MAX_STAGES][IVAS_BIQUAD_FILT_LEN];
    Word16 num_e[IVAS_FILTER_MAX_STAGES][IVAS_BIQUAD_FILT_LEN];
    Word16 den_e[IVAS_FILTER_MAX_STAGES][IVAS_BIQUAD_FILT_LEN];