void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){

    int w_align= 1;

    int h_align= 1;



    switch(s->pix_fmt){

    case PIX_FMT_YUV420P:

    case PIX_FMT_YUYV422:

    case PIX_FMT_UYVY422:

    case PIX_FMT_YUV422P:

    case PIX_FMT_YUV444P:

    case PIX_FMT_GRAY8:

    case PIX_FMT_GRAY16BE:

    case PIX_FMT_GRAY16LE:

    case PIX_FMT_YUVJ420P:

    case PIX_FMT_YUVJ422P:

    case PIX_FMT_YUVJ444P:

    case PIX_FMT_YUVA420P:

        w_align= 16; //FIXME check for non mpeg style codecs and use less alignment

        h_align= 16;



        break;

    case PIX_FMT_YUV411P:

    case PIX_FMT_UYYVYY411:

        w_align=32;

        h_align=8;

        break;

    case PIX_FMT_YUV410P:

        if(s->codec_id == CODEC_ID_SVQ1){

            w_align=64;

            h_align=64;

        }

    case PIX_FMT_RGB555:

        if(s->codec_id == CODEC_ID_RPZA){

            w_align=4;

            h_align=4;

        }

    case PIX_FMT_PAL8:

    case PIX_FMT_BGR8:

    case PIX_FMT_RGB8:

        if(s->codec_id == CODEC_ID_SMC){

            w_align=4;

            h_align=4;

        }

        break;

    case PIX_FMT_BGR24:

        if((s->codec_id == CODEC_ID_MSZH) || (s->codec_id == CODEC_ID_ZLIB)){

            w_align=4;

            h_align=4;

        }

        break;

    default:

        w_align= 1;

        h_align= 1;

        break;

    }



    *width = ALIGN(*width , w_align);

    *height= ALIGN(*height, h_align);

    if(s->codec_id == CODEC_ID_H264)

        *height+=2; // some of the optimized chroma MC reads one line too much

}
void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){

    int w_align= 1;

    int h_align= 1;



    switch(s->pix_fmt){

    case PIX_FMT_YUV420P:

    case PIX_FMT_YUYV422:

    case PIX_FMT_UYVY422:

    case PIX_FMT_YUV422P:

    case PIX_FMT_YUV444P:

    case PIX_FMT_GRAY8:

    case PIX_FMT_GRAY16BE:

    case PIX_FMT_GRAY16LE:

    case PIX_FMT_YUVJ420P:

    case PIX_FMT_YUVJ422P:

    case PIX_FMT_YUVJ444P:

    case PIX_FMT_YUVA420P:

        w_align= 16; 

        h_align= 16;



        break;

    case PIX_FMT_YUV411P:

    case PIX_FMT_UYYVYY411:

        w_align=32;

        h_align=8;

        break;

    case PIX_FMT_YUV410P:

        if(s->codec_id == CODEC_ID_SVQ1){

            w_align=64;

            h_align=64;

        }

    case PIX_FMT_RGB555:

        if(s->codec_id == CODEC_ID_RPZA){

            w_align=4;

            h_align=4;

        }

    case PIX_FMT_PAL8:

    case PIX_FMT_BGR8:

    case PIX_FMT_RGB8:

        if(s->codec_id == CODEC_ID_SMC){

            w_align=4;

            h_align=4;

        }

        break;

    case PIX_FMT_BGR24:

        if((s->codec_id == CODEC_ID_MSZH) || (s->codec_id == CODEC_ID_ZLIB)){

            w_align=4;

            h_align=4;

        }

        break;

    default:

        w_align= 1;

        h_align= 1;

        break;

    }



    *width = ALIGN(*width , w_align);

    *height= ALIGN(*height, h_align);

    if(s->codec_id == CODEC_ID_H264)

        *height+=2; 

}
void FUNC_0(AVCodecContext *VAR_0, int *VAR_1, int *VAR_2){

    int VAR_3= 1;

    int VAR_4= 1;



    switch(VAR_0->pix_fmt){

    case PIX_FMT_YUV420P:

    case PIX_FMT_YUYV422:

    case PIX_FMT_UYVY422:

    case PIX_FMT_YUV422P:

    case PIX_FMT_YUV444P:

    case PIX_FMT_GRAY8:

    case PIX_FMT_GRAY16BE:

    case PIX_FMT_GRAY16LE:

    case PIX_FMT_YUVJ420P:

    case PIX_FMT_YUVJ422P:

    case PIX_FMT_YUVJ444P:

    case PIX_FMT_YUVA420P:

        VAR_3= 16; 

        VAR_4= 16;



        break;

    case PIX_FMT_YUV411P:

    case PIX_FMT_UYYVYY411:

        VAR_3=32;

        VAR_4=8;

        break;

    case PIX_FMT_YUV410P:

        if(VAR_0->codec_id == CODEC_ID_SVQ1){

            VAR_3=64;

            VAR_4=64;

        }

    case PIX_FMT_RGB555:

        if(VAR_0->codec_id == CODEC_ID_RPZA){

            VAR_3=4;

            VAR_4=4;

        }

    case PIX_FMT_PAL8:

    case PIX_FMT_BGR8:

    case PIX_FMT_RGB8:

        if(VAR_0->codec_id == CODEC_ID_SMC){

            VAR_3=4;

            VAR_4=4;

        }

        break;

    case PIX_FMT_BGR24:

        if((VAR_0->codec_id == CODEC_ID_MSZH) || (VAR_0->codec_id == CODEC_ID_ZLIB)){

            VAR_3=4;

            VAR_4=4;

        }

        break;

    default:

        VAR_3= 1;

        VAR_4= 1;

        break;

    }



    *VAR_1 = ALIGN(*VAR_1 , VAR_3);

    *VAR_2= ALIGN(*VAR_2, VAR_4);

    if(VAR_0->codec_id == CODEC_ID_H264)

        *VAR_2+=2; 

}
void FUNC_0(AVCodecContext *VAR_0, int *VAR_1, int *VAR_2){ int VAR_3= 1; int VAR_4= 1; switch(VAR_0->pix_fmt){ case PIX_FMT_YUV420P:
case PIX_FMT_YUYV422:
case PIX_FMT_UYVY422:
case PIX_FMT_YUV422P:
case PIX_FMT_YUV444P:
case PIX_FMT_GRAY8:
case PIX_FMT_GRAY16BE:
case PIX_FMT_GRAY16LE:
case PIX_FMT_YUVJ420P:
case PIX_FMT_YUVJ422P:
case PIX_FMT_YUVJ444P:
case PIX_FMT_YUVA420P:
VAR_3= 16; VAR_4= 16; break; case PIX_FMT_YUV411P:
case PIX_FMT_UYYVYY411:
VAR_3=32; VAR_4=8; break; case PIX_FMT_YUV410P:
if(VAR_0->codec_id == CODEC_ID_SVQ1){ VAR_3=64; VAR_4=64; } case PIX_FMT_RGB555:
if(VAR_0->codec_id == CODEC_ID_RPZA){ VAR_3=4; VAR_4=4; } case PIX_FMT_PAL8:
case PIX_FMT_BGR8:
case PIX_FMT_RGB8:
if(VAR_0->codec_id == CODEC_ID_SMC){ VAR_3=4; VAR_4=4; } break; case PIX_FMT_BGR24:
if((VAR_0->codec_id == CODEC_ID_MSZH) || (VAR_0->codec_id == CODEC_ID_ZLIB)){ VAR_3=4; VAR_4=4; } break; default:
VAR_3= 1; VAR_4= 1; break; } *VAR_1 = ALIGN(*VAR_1 , VAR_3); *VAR_2= ALIGN(*VAR_2, VAR_4); if(VAR_0->codec_id == CODEC_ID_H264)
*VAR_2+=2; }