int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width)

{

    int i;

    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];

    int max_step     [4];       /* max pixel step for each plane */

    int max_step_comp[4];       /* the component for each plane which has the max pixel step */



    memset(linesizes, 0, 4*sizeof(linesizes[0]));



    if ((unsigned)pix_fmt >= PIX_FMT_NB || desc->flags & PIX_FMT_HWACCEL)

        return AVERROR(EINVAL);



    if (desc->flags & PIX_FMT_BITSTREAM) {

        if (width > (INT_MAX -7) / (desc->comp[0].step_minus1+1))

            return AVERROR(EINVAL);

        linesizes[0] = (width * (desc->comp[0].step_minus1+1) + 7) >> 3;

        return 0;

    }



    av_image_fill_max_pixsteps(max_step, max_step_comp, desc);

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

        int s = (max_step_comp[i] == 1 || max_step_comp[i] == 2) ? desc->log2_chroma_w : 0;

        int shifted_w = ((width + (1 << s) - 1)) >> s;

        if (max_step[i] > INT_MAX / shifted_w)

            return AVERROR(EINVAL);

        linesizes[i] = max_step[i] * shifted_w;

    }



    return 0;

}

int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width)

{

    int i;

    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];

    int max_step     [4];       

    int max_step_comp[4];       



    memset(linesizes, 0, 4*sizeof(linesizes[0]));



    if ((unsigned)pix_fmt >= PIX_FMT_NB || desc->flags & PIX_FMT_HWACCEL)

        return AVERROR(EINVAL);



    if (desc->flags & PIX_FMT_BITSTREAM) {

        if (width > (INT_MAX -7) / (desc->comp[0].step_minus1+1))

            return AVERROR(EINVAL);

        linesizes[0] = (width * (desc->comp[0].step_minus1+1) + 7) >> 3;

        return 0;

    }



    av_image_fill_max_pixsteps(max_step, max_step_comp, desc);

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

        int s = (max_step_comp[i] == 1 || max_step_comp[i] == 2) ? desc->log2_chroma_w : 0;

        int shifted_w = ((width + (1 << s) - 1)) >> s;

        if (max_step[i] > INT_MAX / shifted_w)

            return AVERROR(EINVAL);

        linesizes[i] = max_step[i] * shifted_w;

    }



    return 0;

}

    if (desc->flags & PIX_FMT_BITSTREAM) {         if (width > (INT_MAX -7) / (desc->comp[0].step_minus1+1))             return AVERROR(EINVAL);         linesizes[0] = (width * (desc->comp[0].step_minus1+1) + 7) >> 3;         return 0;
int FUNC_0(int VAR_0[4], enum PixelFormat VAR_1, int VAR_2)

{

    int VAR_3;

    const AVPixFmtDescriptor *VAR_4 = &av_pix_fmt_descriptors[VAR_1];

    int VAR_5     [4];       

    int VAR_6[4];       



    memset(VAR_0, 0, 4*sizeof(VAR_0[0]));



    if ((unsigned)VAR_1 >= PIX_FMT_NB || VAR_4->flags & PIX_FMT_HWACCEL)

        return AVERROR(EINVAL);



    if (VAR_4->flags & PIX_FMT_BITSTREAM) {

        if (VAR_2 > (INT_MAX -7) / (VAR_4->comp[0].step_minus1+1))

            return AVERROR(EINVAL);

        VAR_0[0] = (VAR_2 * (VAR_4->comp[0].step_minus1+1) + 7) >> 3;

        return 0;

    }



    av_image_fill_max_pixsteps(VAR_5, VAR_6, VAR_4);

    for (VAR_3 = 0; VAR_3 < 4; VAR_3++) {

        int VAR_7 = (VAR_6[VAR_3] == 1 || VAR_6[VAR_3] == 2) ? VAR_4->log2_chroma_w : 0;

        int VAR_8 = ((VAR_2 + (1 << VAR_7) - 1)) >> VAR_7;

        if (VAR_5[VAR_3] > INT_MAX / VAR_8)

            return AVERROR(EINVAL);

        VAR_0[VAR_3] = VAR_5[VAR_3] * VAR_8;

    }



    return 0;

}

int FUNC_0(int VAR_0[4], enum PixelFormat VAR_1, int VAR_2)
{ int VAR_3; const AVPixFmtDescriptor *VAR_4 = &av_pix_fmt_descriptors[VAR_1]; int VAR_5     [4]; int VAR_6[4]; memset(VAR_0, 0, 4*sizeof(VAR_0[0])); if ((unsigned)VAR_1 >= PIX_FMT_NB || VAR_4->flags & PIX_FMT_HWACCEL)
return AVERROR(EINVAL); if (VAR_4->flags & PIX_FMT_BITSTREAM) { if (VAR_2 > (INT_MAX -7) / (VAR_4->comp[0].step_minus1+1))
return AVERROR(EINVAL); VAR_0[0] = (VAR_2 * (VAR_4->comp[0].step_minus1+1) + 7) >> 3; return 0; } av_image_fill_max_pixsteps(VAR_5, VAR_6, VAR_4); for (VAR_3 = 0; VAR_3 < 4; VAR_3++) { int VAR_7 = (VAR_6[VAR_3] == 1 || VAR_6[VAR_3] == 2) ? VAR_4->log2_chroma_w : 0; int VAR_8 = ((VAR_2 + (1 << VAR_7) - 1)) >> VAR_7; if (VAR_5[VAR_3] > INT_MAX / VAR_8)
return AVERROR(EINVAL); VAR_0[VAR_3] = VAR_5[VAR_3] * VAR_8; } return 0; }