void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],

                   const uint8_t *src_data[4], const int src_linesizes[4],

                   enum PixelFormat pix_fmt, int width, int height)

{

    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];



    if (desc->flags & PIX_FMT_HWACCEL)

        return;



    if (desc->flags & PIX_FMT_PAL) {

        av_image_copy_plane(dst_data[0], dst_linesizes[0],

                            src_data[0], src_linesizes[0],

                            width, height);

        /* copy the palette */

        memcpy(dst_data[1], src_data[1], 4*256);

    } else {

        int i, planes_nb = 0;



        for (i = 0; i < desc->nb_components; i++)

            planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1);



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

            int h = height;

            int bwidth = av_image_get_linesize(pix_fmt, width, i);

            if (i == 1 || i == 2) {

                h= -((-height)>>desc->log2_chroma_h);

            }

            av_image_copy_plane(dst_data[i], dst_linesizes[i],

                                src_data[i], src_linesizes[i],

                                bwidth, h);

        }

    }

}

void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],

                   const uint8_t *src_data[4], const int src_linesizes[4],

                   enum PixelFormat pix_fmt, int width, int height)

{

    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];



    if (desc->flags & PIX_FMT_HWACCEL)

        return;



    if (desc->flags & PIX_FMT_PAL) {

        av_image_copy_plane(dst_data[0], dst_linesizes[0],

                            src_data[0], src_linesizes[0],

                            width, height);

        

        memcpy(dst_data[1], src_data[1], 4*256);

    } else {

        int i, planes_nb = 0;



        for (i = 0; i < desc->nb_components; i++)

            planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1);



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

            int h = height;

            int bwidth = av_image_get_linesize(pix_fmt, width, i);

            if (i == 1 || i == 2) {

                h= -((-height)>>desc->log2_chroma_h);

            }

            av_image_copy_plane(dst_data[i], dst_linesizes[i],

                                src_data[i], src_linesizes[i],

                                bwidth, h);

        }

    }

}

    if (desc->flags & PIX_FMT_PAL) {     if (desc->flags & PIX_FMT_PAL) {
void FUNC_0(uint8_t *VAR_0[4], int VAR_1[4],

                   const uint8_t *VAR_2[4], const int VAR_3[4],

                   enum PixelFormat VAR_4, int VAR_5, int VAR_6)

{

    const AVPixFmtDescriptor *VAR_7 = &av_pix_fmt_descriptors[VAR_4];



    if (VAR_7->flags & PIX_FMT_HWACCEL)

        return;



    if (VAR_7->flags & PIX_FMT_PAL) {

        av_image_copy_plane(VAR_0[0], VAR_1[0],

                            VAR_2[0], VAR_3[0],

                            VAR_5, VAR_6);

        

        memcpy(VAR_0[1], VAR_2[1], 4*256);

    } else {

        int VAR_8, VAR_9 = 0;



        for (VAR_8 = 0; VAR_8 < VAR_7->nb_components; VAR_8++)

            VAR_9 = FFMAX(VAR_9, VAR_7->comp[VAR_8].plane + 1);



        for (VAR_8 = 0; VAR_8 < VAR_9; VAR_8++) {

            int VAR_10 = VAR_6;

            int VAR_11 = av_image_get_linesize(VAR_4, VAR_5, VAR_8);

            if (VAR_8 == 1 || VAR_8 == 2) {

                VAR_10= -((-VAR_6)>>VAR_7->log2_chroma_h);

            }

            av_image_copy_plane(VAR_0[VAR_8], VAR_1[VAR_8],

                                VAR_2[VAR_8], VAR_3[VAR_8],

                                VAR_11, VAR_10);

        }

    }

}

void FUNC_0(uint8_t *VAR_0[4], int VAR_1[4],
const uint8_t *VAR_2[4], const int VAR_3[4],
enum PixelFormat VAR_4, int VAR_5, int VAR_6)
{ const AVPixFmtDescriptor *VAR_7 = &av_pix_fmt_descriptors[VAR_4]; if (VAR_7->flags & PIX_FMT_HWACCEL)
return; if (VAR_7->flags & PIX_FMT_PAL) { av_image_copy_plane(VAR_0[0], VAR_1[0],
VAR_2[0], VAR_3[0],
VAR_5, VAR_6); memcpy(VAR_0[1], VAR_2[1], 4*256); } else { int VAR_8, VAR_9 = 0; for (VAR_8 = 0; VAR_8 < VAR_7->nb_components; VAR_8++) VAR_9 = FFMAX(VAR_9, VAR_7->comp[VAR_8].plane + 1); for (VAR_8 = 0; VAR_8 < VAR_9; VAR_8++) { int VAR_10 = VAR_6; int VAR_11 = av_image_get_linesize(VAR_4, VAR_5, VAR_8); if (VAR_8 == 1 || VAR_8 == 2) { VAR_10= -((-VAR_6)>>VAR_7->log2_chroma_h); } av_image_copy_plane(VAR_0[VAR_8], VAR_1[VAR_8],
VAR_2[VAR_8], VAR_3[VAR_8],
VAR_11, VAR_10); } } }