int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,

                               enum AVSampleFormat sample_fmt, int align)

{

    int line_size;

    int sample_size = av_get_bytes_per_sample(sample_fmt);

    int planar      = av_sample_fmt_is_planar(sample_fmt);



    /* validate parameter ranges */

    if (!sample_size || nb_samples <= 0 || nb_channels <= 0)




    /* auto-select alignment if not specified */

    if (!align) {



        align = 1;

        nb_samples = FFALIGN(nb_samples, 32);

    }



    /* check for integer overflow */

    if (nb_channels > INT_MAX / align ||

        (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size)




    line_size = planar ? FFALIGN(nb_samples * sample_size,               align) :

                         FFALIGN(nb_samples * sample_size * nb_channels, align);

    if (linesize)

        *linesize = line_size;



    return planar ? line_size * nb_channels : line_size;

}
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,

                               enum AVSampleFormat sample_fmt, int align)

{

    int line_size;

    int sample_size = av_get_bytes_per_sample(sample_fmt);

    int planar      = av_sample_fmt_is_planar(sample_fmt);



    

    if (!sample_size || nb_samples <= 0 || nb_channels <= 0)




    

    if (!align) {



        align = 1;

        nb_samples = FFALIGN(nb_samples, 32);

    }



    

    if (nb_channels > INT_MAX / align ||

        (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size)




    line_size = planar ? FFALIGN(nb_samples * sample_size,               align) :

                         FFALIGN(nb_samples * sample_size * nb_channels, align);

    if (linesize)

        *linesize = line_size;



    return planar ? line_size * nb_channels : line_size;

}
int FUNC_0(int *VAR_0, int VAR_1, int VAR_2,

                               enum AVSampleFormat VAR_3, int VAR_4)

{

    int VAR_5;

    int VAR_6 = av_get_bytes_per_sample(VAR_3);

    int VAR_7      = av_sample_fmt_is_planar(VAR_3);



    

    if (!VAR_6 || VAR_2 <= 0 || VAR_1 <= 0)




    

    if (!VAR_4) {



        VAR_4 = 1;

        VAR_2 = FFALIGN(VAR_2, 32);

    }



    

    if (VAR_1 > INT_MAX / VAR_4 ||

        (int64_t)VAR_1 * VAR_2 > (INT_MAX - (VAR_4 * VAR_1)) / VAR_6)




    VAR_5 = VAR_7 ? FFALIGN(VAR_2 * VAR_6,               VAR_4) :

                         FFALIGN(VAR_2 * VAR_6 * VAR_1, VAR_4);

    if (VAR_0)

        *VAR_0 = VAR_5;



    return VAR_7 ? VAR_5 * VAR_1 : VAR_5;

}
int FUNC_0(int *VAR_0, int VAR_1, int VAR_2,
enum AVSampleFormat VAR_3, int VAR_4)
{ int VAR_5; int VAR_6 = av_get_bytes_per_sample(VAR_3); int VAR_7      = av_sample_fmt_is_planar(VAR_3); if (!VAR_6 || VAR_2 <= 0 || VAR_1 <= 0)
if (!VAR_4) { VAR_4 = 1; VAR_2 = FFALIGN(VAR_2, 32); } if (VAR_1 > INT_MAX / VAR_4 ||
(int64_t)VAR_1 * VAR_2 > (INT_MAX - (VAR_4 * VAR_1)) / VAR_6)
VAR_5 = VAR_7 ? FFALIGN(VAR_2 * VAR_6,               VAR_4) :
FFALIGN(VAR_2 * VAR_6 * VAR_1, VAR_4); if (VAR_0)
*VAR_0 = VAR_5; return VAR_7 ? VAR_5 * VAR_1 : VAR_5; }