static void process_tns_coeffs(TemporalNoiseShaping *tns, double *coef_raw,

                               int *order_p, int w, int filt)

{

    int i, j, order = *order_p;

    int *idx = tns->coef_idx[w][filt];

    float *lpc = tns->coef[w][filt];

    float temp[TNS_MAX_ORDER] = {0.0f}, out[TNS_MAX_ORDER] = {0.0f};



    if (!order)

        return;



    /* Not what the specs say, but it's better */

    for (i = 0; i < order; i++) {

        idx[i] = quant_array_idx(coef_raw[i], tns_tmp2_map_0_4, 16);

        lpc[i] = tns_tmp2_map_0_4[idx[i]];

    }



    /* Trim any coeff less than 0.1f from the end */

    for (i = order-1; i > -1; i--) {

        lpc[i] = (fabs(lpc[i]) > 0.1f) ? lpc[i] : 0.0f;

        if (lpc[i] != 0.0 ) {

            order = i;

            break;

        }

    }



    /* Step up procedure, convert to LPC coeffs */

    out[0] = 1.0f;

    for (i = 1; i <= order; i++) {

        for (j = 1; j < i; j++) {

            temp[j] = out[j] + lpc[i]*out[i-j];

        }

        for (j = 1; j <= i; j++) {

            out[j] = temp[j];

        }

        out[i] = lpc[i-1];

    }

    *order_p = order;

    memcpy(lpc, out, TNS_MAX_ORDER*sizeof(float));

}

static void process_tns_coeffs(TemporalNoiseShaping *tns, double *coef_raw,

                               int *order_p, int w, int filt)

{

    int i, j, order = *order_p;

    int *idx = tns->coef_idx[w][filt];

    float *lpc = tns->coef[w][filt];

    float temp[TNS_MAX_ORDER] = {0.0f}, out[TNS_MAX_ORDER] = {0.0f};



    if (!order)

        return;



    

    for (i = 0; i < order; i++) {

        idx[i] = quant_array_idx(coef_raw[i], tns_tmp2_map_0_4, 16);

        lpc[i] = tns_tmp2_map_0_4[idx[i]];

    }



    

    for (i = order-1; i > -1; i--) {

        lpc[i] = (fabs(lpc[i]) > 0.1f) ? lpc[i] : 0.0f;

        if (lpc[i] != 0.0 ) {

            order = i;

            break;

        }

    }



    

    out[0] = 1.0f;

    for (i = 1; i <= order; i++) {

        for (j = 1; j < i; j++) {

            temp[j] = out[j] + lpc[i]*out[i-j];

        }

        for (j = 1; j <= i; j++) {

            out[j] = temp[j];

        }

        out[i] = lpc[i-1];

    }

    *order_p = order;

    memcpy(lpc, out, TNS_MAX_ORDER*sizeof(float));

}

    *order_p = order;
static void FUNC_0(TemporalNoiseShaping *VAR_0, double *VAR_1,

                               int *VAR_2, int VAR_3, int VAR_4)

{

    int VAR_5, VAR_6, VAR_7 = *VAR_2;

    int *VAR_8 = VAR_0->coef_idx[VAR_3][VAR_4];

    float *VAR_9 = VAR_0->coef[VAR_3][VAR_4];

    float VAR_10[TNS_MAX_ORDER] = {0.0f}, out[TNS_MAX_ORDER] = {0.0f};



    if (!VAR_7)

        return;



    

    for (VAR_5 = 0; VAR_5 < VAR_7; VAR_5++) {

        VAR_8[VAR_5] = quant_array_idx(VAR_1[VAR_5], tns_tmp2_map_0_4, 16);

        VAR_9[VAR_5] = tns_tmp2_map_0_4[VAR_8[VAR_5]];

    }



    

    for (VAR_5 = VAR_7-1; VAR_5 > -1; VAR_5--) {

        VAR_9[VAR_5] = (fabs(VAR_9[VAR_5]) > 0.1f) ? VAR_9[VAR_5] : 0.0f;

        if (VAR_9[VAR_5] != 0.0 ) {

            VAR_7 = VAR_5;

            break;

        }

    }



    

    out[0] = 1.0f;

    for (VAR_5 = 1; VAR_5 <= VAR_7; VAR_5++) {

        for (VAR_6 = 1; VAR_6 < VAR_5; VAR_6++) {

            VAR_10[VAR_6] = out[VAR_6] + VAR_9[VAR_5]*out[VAR_5-VAR_6];

        }

        for (VAR_6 = 1; VAR_6 <= VAR_5; VAR_6++) {

            out[VAR_6] = VAR_10[VAR_6];

        }

        out[VAR_5] = VAR_9[VAR_5-1];

    }

    *VAR_2 = VAR_7;

    memcpy(VAR_9, out, TNS_MAX_ORDER*sizeof(float));

}

static void FUNC_0(TemporalNoiseShaping *VAR_0, double *VAR_1,
int *VAR_2, int VAR_3, int VAR_4)
{ int VAR_5, VAR_6, VAR_7 = *VAR_2; int *VAR_8 = VAR_0->coef_idx[VAR_3][VAR_4]; float *VAR_9 = VAR_0->coef[VAR_3][VAR_4]; float VAR_10[TNS_MAX_ORDER] = {0.0f}, out[TNS_MAX_ORDER] = {0.0f}; if (!VAR_7)
return; for (VAR_5 = 0; VAR_5 < VAR_7; VAR_5++) { VAR_8[VAR_5] = quant_array_idx(VAR_1[VAR_5], tns_tmp2_map_0_4, 16); VAR_9[VAR_5] = tns_tmp2_map_0_4[VAR_8[VAR_5]]; } for (VAR_5 = VAR_7-1; VAR_5 > -1; VAR_5--) { VAR_9[VAR_5] = (fabs(VAR_9[VAR_5]) > 0.1f) ? VAR_9[VAR_5] : 0.0f; if (VAR_9[VAR_5] != 0.0 ) { VAR_7 = VAR_5; break; } } out[0] = 1.0f; for (VAR_5 = 1; VAR_5 <= VAR_7; VAR_5++) { for (VAR_6 = 1; VAR_6 < VAR_5; VAR_6++) { VAR_10[VAR_6] = out[VAR_6] + VAR_9[VAR_5]*out[VAR_5-VAR_6]; } for (VAR_6 = 1; VAR_6 <= VAR_5; VAR_6++) { out[VAR_6] = VAR_10[VAR_6]; } out[VAR_5] = VAR_9[VAR_5-1]; } *VAR_2 = VAR_7; memcpy(VAR_9, out, TNS_MAX_ORDER*sizeof(float)); }