int ff_audio_mix(AudioMix *am, AudioData *src)

{

    int use_generic = 1;

    int len = src->nb_samples;

    int i, j;



    /* determine whether to use the optimized function based on pointer and

       samples alignment in both the input and output */

    if (am->has_optimized_func) {

        int aligned_len = FFALIGN(len, am->samples_align);

        if (!(src->ptr_align % am->ptr_align) &&

            src->samples_align >= aligned_len) {

            len = aligned_len;

            use_generic = 0;

        }

    }

    av_dlog(am->avr, "audio_mix: %d samples - %d to %d channels (%s)\n",

            src->nb_samples, am->in_channels, am->out_channels,

            use_generic ? am->func_descr_generic : am->func_descr);



    if (am->in_matrix_channels && am->out_matrix_channels) {

        uint8_t **data;

        uint8_t *data0[AVRESAMPLE_MAX_CHANNELS];



        if (am->out_matrix_channels < am->out_channels ||

             am->in_matrix_channels <  am->in_channels) {

            for (i = 0, j = 0; i < FFMAX(am->in_channels, am->out_channels); i++) {

                if (am->input_skip[i] || am->output_skip[i] || am->output_zero[i])

                    continue;

                data0[j++] = src->data[i];

            }

            data = data0;

        } else {

            data = src->data;

        }



        if (use_generic)

            am->mix_generic(data, am->matrix, len, am->out_matrix_channels,

                            am->in_matrix_channels);

        else

            am->mix(data, am->matrix, len, am->out_matrix_channels,

                    am->in_matrix_channels);

    }



    if (am->out_matrix_channels < am->out_channels) {

        for (i = 0; i < am->out_channels; i++)

            if (am->output_zero[i])

                av_samples_set_silence(&src->data[i], 0, len, 1, am->fmt);

    }



    ff_audio_data_set_channels(src, am->out_channels);



    return 0;

}

int ff_audio_mix(AudioMix *am, AudioData *src)

{

    int use_generic = 1;

    int len = src->nb_samples;

    int i, j;



    



    if (am->has_optimized_func) {

        int aligned_len = FFALIGN(len, am->samples_align);

        if (!(src->ptr_align % am->ptr_align) &&

            src->samples_align >= aligned_len) {

            len = aligned_len;

            use_generic = 0;

        }

    }

    av_dlog(am->avr, "audio_mix: %d samples - %d to %d channels (%s)\n",

            src->nb_samples, am->in_channels, am->out_channels,

            use_generic ? am->func_descr_generic : am->func_descr);



    if (am->in_matrix_channels && am->out_matrix_channels) {

        uint8_t **data;

        uint8_t *data0[AVRESAMPLE_MAX_CHANNELS];



        if (am->out_matrix_channels < am->out_channels ||

             am->in_matrix_channels <  am->in_channels) {

            for (i = 0, j = 0; i < FFMAX(am->in_channels, am->out_channels); i++) {

                if (am->input_skip[i] || am->output_skip[i] || am->output_zero[i])

                    continue;

                data0[j++] = src->data[i];

            }

            data = data0;

        } else {

            data = src->data;

        }



        if (use_generic)

            am->mix_generic(data, am->matrix, len, am->out_matrix_channels,

                            am->in_matrix_channels);

        else

            am->mix(data, am->matrix, len, am->out_matrix_channels,

                    am->in_matrix_channels);

    }



    if (am->out_matrix_channels < am->out_channels) {

        for (i = 0; i < am->out_channels; i++)

            if (am->output_zero[i])

                av_samples_set_silence(&src->data[i], 0, len, 1, am->fmt);

    }



    ff_audio_data_set_channels(src, am->out_channels);



    return 0;

}

        uint8_t *data0[AVRESAMPLE_MAX_CHANNELS];
int FUNC_0(AudioMix *VAR_0, AudioData *VAR_1)

{

    int VAR_2 = 1;

    int VAR_3 = VAR_1->nb_samples;

    int VAR_4, VAR_5;



    



    if (VAR_0->has_optimized_func) {

        int VAR_6 = FFALIGN(VAR_3, VAR_0->samples_align);

        if (!(VAR_1->ptr_align % VAR_0->ptr_align) &&

            VAR_1->samples_align >= VAR_6) {

            VAR_3 = VAR_6;

            VAR_2 = 0;

        }

    }

    av_dlog(VAR_0->avr, "audio_mix: %d samples - %d to %d channels (%s)\n",

            VAR_1->nb_samples, VAR_0->in_channels, VAR_0->out_channels,

            VAR_2 ? VAR_0->func_descr_generic : VAR_0->func_descr);



    if (VAR_0->in_matrix_channels && VAR_0->out_matrix_channels) {

        uint8_t **data;

        uint8_t *data0[AVRESAMPLE_MAX_CHANNELS];



        if (VAR_0->out_matrix_channels < VAR_0->out_channels ||

             VAR_0->in_matrix_channels <  VAR_0->in_channels) {

            for (VAR_4 = 0, VAR_5 = 0; VAR_4 < FFMAX(VAR_0->in_channels, VAR_0->out_channels); VAR_4++) {

                if (VAR_0->input_skip[VAR_4] || VAR_0->output_skip[VAR_4] || VAR_0->output_zero[VAR_4])

                    continue;

                data0[VAR_5++] = VAR_1->data[VAR_4];

            }

            data = data0;

        } else {

            data = VAR_1->data;

        }



        if (VAR_2)

            VAR_0->mix_generic(data, VAR_0->matrix, VAR_3, VAR_0->out_matrix_channels,

                            VAR_0->in_matrix_channels);

        else

            VAR_0->mix(data, VAR_0->matrix, VAR_3, VAR_0->out_matrix_channels,

                    VAR_0->in_matrix_channels);

    }



    if (VAR_0->out_matrix_channels < VAR_0->out_channels) {

        for (VAR_4 = 0; VAR_4 < VAR_0->out_channels; VAR_4++)

            if (VAR_0->output_zero[VAR_4])

                av_samples_set_silence(&VAR_1->data[VAR_4], 0, VAR_3, 1, VAR_0->fmt);

    }



    ff_audio_data_set_channels(VAR_1, VAR_0->out_channels);



    return 0;

}

int FUNC_0(AudioMix *VAR_0, AudioData *VAR_1)
{ int VAR_2 = 1; int VAR_3 = VAR_1->nb_samples; int VAR_4, VAR_5; if (VAR_0->has_optimized_func) { int VAR_6 = FFALIGN(VAR_3, VAR_0->samples_align); if (!(VAR_1->ptr_align % VAR_0->ptr_align) &&
VAR_1->samples_align >= VAR_6) { VAR_3 = VAR_6; VAR_2 = 0; } } av_dlog(VAR_0->avr, "audio_mix: %d samples - %d to %d channels (%s)\n",
VAR_1->nb_samples, VAR_0->in_channels, VAR_0->out_channels,
VAR_2 ? VAR_0->func_descr_generic : VAR_0->func_descr); if (VAR_0->in_matrix_channels && VAR_0->out_matrix_channels) { uint8_t **data; uint8_t *data0[AVRESAMPLE_MAX_CHANNELS]; if (VAR_0->out_matrix_channels < VAR_0->out_channels ||
VAR_0->in_matrix_channels <  VAR_0->in_channels) { for (VAR_4 = 0, VAR_5 = 0; VAR_4 < FFMAX(VAR_0->in_channels, VAR_0->out_channels); VAR_4++) { if (VAR_0->input_skip[VAR_4] || VAR_0->output_skip[VAR_4] || VAR_0->output_zero[VAR_4])
continue; data0[VAR_5++] = VAR_1->data[VAR_4]; } data = data0; } else { data = VAR_1->data; } if (VAR_2)
VAR_0->mix_generic(data, VAR_0->matrix, VAR_3, VAR_0->out_matrix_channels,
VAR_0->in_matrix_channels); else
VAR_0->mix(data, VAR_0->matrix, VAR_3, VAR_0->out_matrix_channels,
VAR_0->in_matrix_channels); } if (VAR_0->out_matrix_channels < VAR_0->out_channels) { for (VAR_4 = 0; VAR_4 < VAR_0->out_channels; VAR_4++) if (VAR_0->output_zero[VAR_4])
av_samples_set_silence(&VAR_1->data[VAR_4], 0, VAR_3, 1, VAR_0->fmt); } ff_audio_data_set_channels(VAR_1, VAR_0->out_channels); return 0; }