int av_picture_crop(AVPicture *dst, const AVPicture *src,

                    enum PixelFormat pix_fmt, int top_band, int left_band)

{

    int y_shift;

    int x_shift;



    if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB)

        return -1;



    y_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_h;

    x_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_w;



    if (is_yuv_planar(&pix_fmt_info[pix_fmt])) {

    dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band;

    dst->data[1] = src->data[1] + ((top_band >> y_shift) * src->linesize[1]) + (left_band >> x_shift);

    dst->data[2] = src->data[2] + ((top_band >> y_shift) * src->linesize[2]) + (left_band >> x_shift);

    } else{

        if(top_band % (1<<y_shift) || left_band % (1<<x_shift))

            return -1;

        if(left_band) //FIXME add support for this too

            return -1;

        dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band;

    }



    dst->linesize[0] = src->linesize[0];

    dst->linesize[1] = src->linesize[1];

    dst->linesize[2] = src->linesize[2];

    return 0;

}

int av_picture_crop(AVPicture *dst, const AVPicture *src,

                    enum PixelFormat pix_fmt, int top_band, int left_band)

{

    int y_shift;

    int x_shift;



    if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB)

        return -1;



    y_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_h;

    x_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_w;



    if (is_yuv_planar(&pix_fmt_info[pix_fmt])) {

    dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band;

    dst->data[1] = src->data[1] + ((top_band >> y_shift) * src->linesize[1]) + (left_band >> x_shift);

    dst->data[2] = src->data[2] + ((top_band >> y_shift) * src->linesize[2]) + (left_band >> x_shift);

    } else{

        if(top_band % (1<<y_shift) || left_band % (1<<x_shift))

            return -1;

        if(left_band) 

            return -1;

        dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band;

    }



    dst->linesize[0] = src->linesize[0];

    dst->linesize[1] = src->linesize[1];

    dst->linesize[2] = src->linesize[2];

    return 0;

}

int FUNC_0(AVPicture *VAR_0, const AVPicture *VAR_1,

                    enum PixelFormat VAR_2, int VAR_3, int VAR_4)

{

    int VAR_5;

    int VAR_6;



    if (VAR_2 < 0 || VAR_2 >= PIX_FMT_NB)

        return -1;



    VAR_5 = av_pix_fmt_descriptors[VAR_2].log2_chroma_h;

    VAR_6 = av_pix_fmt_descriptors[VAR_2].log2_chroma_w;



    if (is_yuv_planar(&pix_fmt_info[VAR_2])) {

    VAR_0->data[0] = VAR_1->data[0] + (VAR_3 * VAR_1->linesize[0]) + VAR_4;

    VAR_0->data[1] = VAR_1->data[1] + ((VAR_3 >> VAR_5) * VAR_1->linesize[1]) + (VAR_4 >> VAR_6);

    VAR_0->data[2] = VAR_1->data[2] + ((VAR_3 >> VAR_5) * VAR_1->linesize[2]) + (VAR_4 >> VAR_6);

    } else{

        if(VAR_3 % (1<<VAR_5) || VAR_4 % (1<<VAR_6))

            return -1;

        if(VAR_4) 

            return -1;

        VAR_0->data[0] = VAR_1->data[0] + (VAR_3 * VAR_1->linesize[0]) + VAR_4;

    }



    VAR_0->linesize[0] = VAR_1->linesize[0];

    VAR_0->linesize[1] = VAR_1->linesize[1];

    VAR_0->linesize[2] = VAR_1->linesize[2];

    return 0;

}

int FUNC_0(AVPicture *VAR_0, const AVPicture *VAR_1,
enum PixelFormat VAR_2, int VAR_3, int VAR_4)
{ int VAR_5; int VAR_6; if (VAR_2 < 0 || VAR_2 >= PIX_FMT_NB)
return -1; VAR_5 = av_pix_fmt_descriptors[VAR_2].log2_chroma_h; VAR_6 = av_pix_fmt_descriptors[VAR_2].log2_chroma_w; if (is_yuv_planar(&pix_fmt_info[VAR_2])) { VAR_0->data[0] = VAR_1->data[0] + (VAR_3 * VAR_1->linesize[0]) + VAR_4; VAR_0->data[1] = VAR_1->data[1] + ((VAR_3 >> VAR_5) * VAR_1->linesize[1]) + (VAR_4 >> VAR_6); VAR_0->data[2] = VAR_1->data[2] + ((VAR_3 >> VAR_5) * VAR_1->linesize[2]) + (VAR_4 >> VAR_6); } else{ if(VAR_3 % (1<<VAR_5) || VAR_4 % (1<<VAR_6))
return -1; if(VAR_4)
return -1; VAR_0->data[0] = VAR_1->data[0] + (VAR_3 * VAR_1->linesize[0]) + VAR_4; } VAR_0->linesize[0] = VAR_1->linesize[0]; VAR_0->linesize[1] = VAR_1->linesize[1]; VAR_0->linesize[2] = VAR_1->linesize[2]; return 0; }