static int compensate_volume(AVFilterContext *ctx)

{

    struct SOFAlizerContext *s = ctx->priv;

    float compensate;

    float energy = 0;

    float *ir;

    int m;



    if (s->sofa.ncid) {

        /* find IR at front center position in the SOFA file (IR closest to 0°,0°,1m) */

        struct NCSofa *sofa = &s->sofa;

        m = find_m(s, 0, 0, 1);

        /* get energy of that IR and compensate volume */

        ir = sofa->data_ir + 2 * m * sofa->n_samples;

        if (sofa->n_samples & 31) {

            energy = avpriv_scalarproduct_float_c(ir, ir, sofa->n_samples);

        } else {

            energy = s->fdsp->scalarproduct_float(ir, ir, sofa->n_samples);

        }

        compensate = 256 / (sofa->n_samples * sqrt(energy));

        av_log(ctx, AV_LOG_DEBUG, "Compensate-factor: %f\n", compensate);

        ir = sofa->data_ir;

        /* apply volume compensation to IRs */

        s->fdsp->vector_fmul_scalar(ir, ir, compensate, sofa->n_samples * sofa->m_dim * 2);

        emms_c();

    }



    return 0;

}

static int compensate_volume(AVFilterContext *ctx)

{

    struct SOFAlizerContext *s = ctx->priv;

    float compensate;

    float energy = 0;

    float *ir;

    int m;



    if (s->sofa.ncid) {

        

        struct NCSofa *sofa = &s->sofa;

        m = find_m(s, 0, 0, 1);

        

        ir = sofa->data_ir + 2 * m * sofa->n_samples;

        if (sofa->n_samples & 31) {

            energy = avpriv_scalarproduct_float_c(ir, ir, sofa->n_samples);

        } else {

            energy = s->fdsp->scalarproduct_float(ir, ir, sofa->n_samples);

        }

        compensate = 256 / (sofa->n_samples * sqrt(energy));

        av_log(ctx, AV_LOG_DEBUG, "Compensate-factor: %f\n", compensate);

        ir = sofa->data_ir;

        

        s->fdsp->vector_fmul_scalar(ir, ir, compensate, sofa->n_samples * sofa->m_dim * 2);

        emms_c();

    }



    return 0;

}

        s->fdsp->vector_fmul_scalar(ir, ir, compensate, sofa->n_samples * sofa->m_dim * 2);         emms_c();
static int FUNC_0(AVFilterContext *VAR_0)

{

    struct SOFAlizerContext *VAR_1 = VAR_0->priv;

    float VAR_2;

    float VAR_3 = 0;

    float *VAR_4;

    int VAR_5;



    if (VAR_1->VAR_6.ncid) {

        

        struct NCSofa *VAR_6 = &VAR_1->VAR_6;

        VAR_5 = find_m(VAR_1, 0, 0, 1);

        

        VAR_4 = VAR_6->data_ir + 2 * VAR_5 * VAR_6->n_samples;

        if (VAR_6->n_samples & 31) {

            VAR_3 = avpriv_scalarproduct_float_c(VAR_4, VAR_4, VAR_6->n_samples);

        } else {

            VAR_3 = VAR_1->fdsp->scalarproduct_float(VAR_4, VAR_4, VAR_6->n_samples);

        }

        VAR_2 = 256 / (VAR_6->n_samples * sqrt(VAR_3));

        av_log(VAR_0, AV_LOG_DEBUG, "Compensate-factor: %f\n", VAR_2);

        VAR_4 = VAR_6->data_ir;

        

        VAR_1->fdsp->vector_fmul_scalar(VAR_4, VAR_4, VAR_2, VAR_6->n_samples * VAR_6->m_dim * 2);

        emms_c();

    }



    return 0;

}

static int FUNC_0(AVFilterContext *VAR_0)
{ struct SOFAlizerContext *VAR_1 = VAR_0->priv; float VAR_2; float VAR_3 = 0; float *VAR_4; int VAR_5; if (VAR_1->VAR_6.ncid) { struct NCSofa *VAR_6 = &VAR_1->VAR_6; VAR_5 = find_m(VAR_1, 0, 0, 1); VAR_4 = VAR_6->data_ir + 2 * VAR_5 * VAR_6->n_samples; if (VAR_6->n_samples & 31) { VAR_3 = avpriv_scalarproduct_float_c(VAR_4, VAR_4, VAR_6->n_samples); } else { VAR_3 = VAR_1->fdsp->scalarproduct_float(VAR_4, VAR_4, VAR_6->n_samples); } VAR_2 = 256 / (VAR_6->n_samples * sqrt(VAR_3)); av_log(VAR_0, AV_LOG_DEBUG, "Compensate-factor: %f\n", VAR_2); VAR_4 = VAR_6->data_ir; VAR_1->fdsp->vector_fmul_scalar(VAR_4, VAR_4, VAR_2, VAR_6->n_samples * VAR_6->m_dim * 2); emms_c(); } return 0; }