int h263_decode_picture_header(MpegEncContext *s)

{

    int format, width, height, i;

    uint32_t startcode;

    

    align_get_bits(&s->gb);



    startcode= get_bits(&s->gb, 22-8);



    for(i= s->gb.size_in_bits - get_bits_count(&s->gb); i>24; i-=8) {

        startcode = ((startcode << 8) | get_bits(&s->gb, 8)) & 0x003FFFFF;

        

        if(startcode == 0x20)

            break;

    }

        

    if (startcode != 0x20) {

        av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");

        return -1;

    }

    /* temporal reference */

    s->picture_number = get_bits(&s->gb, 8); /* picture timestamp */



    /* PTYPE starts here */    

    if (get_bits1(&s->gb) != 1) {

        /* marker */

        av_log(s->avctx, AV_LOG_ERROR, "Bad marker\n");

        return -1;

    }

    if (get_bits1(&s->gb) != 0) {

        av_log(s->avctx, AV_LOG_ERROR, "Bad H263 id\n");

        return -1;	/* h263 id */

    }

    skip_bits1(&s->gb);	/* split screen off */

    skip_bits1(&s->gb);	/* camera  off */

    skip_bits1(&s->gb);	/* freeze picture release off */



    /* Reset GOB number */

    s->gob_number = 0;

        

    format = get_bits(&s->gb, 3);

    /*

        0    forbidden

        1    sub-QCIF

        10   QCIF

        7	extended PTYPE (PLUSPTYPE)

    */



    if (format != 7 && format != 6) {

        s->h263_plus = 0;

        /* H.263v1 */

        width = h263_format[format][0];

        height = h263_format[format][1];

        if (!width)

            return -1;

        

        s->pict_type = I_TYPE + get_bits1(&s->gb);



        s->h263_long_vectors = get_bits1(&s->gb); 



        if (get_bits1(&s->gb) != 0) {

            av_log(s->avctx, AV_LOG_ERROR, "H263 SAC not supported\n");

            return -1;	/* SAC: off */

        }

        s->obmc= get_bits1(&s->gb); /* Advanced prediction mode */

        s->unrestricted_mv = s->h263_long_vectors || s->obmc;

        

        if (get_bits1(&s->gb) != 0) {

            av_log(s->avctx, AV_LOG_ERROR, "H263 PB frame not supported\n");

            return -1;	/* not PB frame */

        }

        s->qscale = get_bits(&s->gb, 5);

        skip_bits1(&s->gb);	/* Continuous Presence Multipoint mode: off */



        s->width = width;

        s->height = height;

    } else {

        int ufep;

        

        /* H.263v2 */

        s->h263_plus = 1;

        ufep = get_bits(&s->gb, 3); /* Update Full Extended PTYPE */



        /* ufep other than 0 and 1 are reserved */        

        if (ufep == 1) {

            /* OPPTYPE */       

            format = get_bits(&s->gb, 3);

            dprintf("ufep=1, format: %d\n", format);

            skip_bits(&s->gb,1); /* Custom PCF */

            s->umvplus = get_bits(&s->gb, 1); /* Unrestricted Motion Vector */

            skip_bits1(&s->gb); /* Syntax-based Arithmetic Coding (SAC) */

            s->obmc= get_bits1(&s->gb); /* Advanced prediction mode */

            s->unrestricted_mv = s->umvplus || s->obmc;

            s->h263_aic = get_bits1(&s->gb); /* Advanced Intra Coding (AIC) */

	    

            if (get_bits1(&s->gb) != 0) {

                av_log(s->avctx, AV_LOG_ERROR, "Deblocking Filter not supported\n");

            }

            if (get_bits1(&s->gb) != 0) {

                av_log(s->avctx, AV_LOG_ERROR, "Slice Structured not supported\n");

            }

            if (get_bits1(&s->gb) != 0) {

                av_log(s->avctx, AV_LOG_ERROR, "Reference Picture Selection not supported\n");

            }

            if (get_bits1(&s->gb) != 0) {

                av_log(s->avctx, AV_LOG_ERROR, "Independent Segment Decoding not supported\n");

            }

            s->alt_inter_vlc= get_bits1(&s->gb);

            s->modified_quant= get_bits1(&s->gb);

            

            skip_bits(&s->gb, 1); /* Prevent start code emulation */



            skip_bits(&s->gb, 3); /* Reserved */

        } else if (ufep != 0) {

            av_log(s->avctx, AV_LOG_ERROR, "Bad UFEP type (%d)\n", ufep);

            return -1;

        }

            

        /* MPPTYPE */

        s->pict_type = get_bits(&s->gb, 3) + I_TYPE;

	if (s->pict_type == 8 && s->avctx->codec_tag == ff_get_fourcc("ZYGO"))

	    s->pict_type = I_TYPE;

        if (s->pict_type != I_TYPE &&

            s->pict_type != P_TYPE)

            return -1;

        skip_bits(&s->gb, 2);

        s->no_rounding = get_bits1(&s->gb);

        skip_bits(&s->gb, 4);

        

        /* Get the picture dimensions */

        if (ufep) {

            if (format == 6) {

                /* Custom Picture Format (CPFMT) */

                s->aspect_ratio_info = get_bits(&s->gb, 4);

                dprintf("aspect: %d\n", s->aspect_ratio_info);

                /* aspect ratios:

                0 - forbidden

                1 - 1:1

                2 - 12:11 (CIF 4:3)

                3 - 10:11 (525-type 4:3)

                4 - 16:11 (CIF 16:9)

                5 - 40:33 (525-type 16:9)

                6-14 - reserved

                */

                width = (get_bits(&s->gb, 9) + 1) * 4;

                skip_bits1(&s->gb);

                height = get_bits(&s->gb, 9) * 4;

                dprintf("\nH.263+ Custom picture: %dx%d\n",width,height);

                if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) {

                    /* aspected dimensions */

                    s->avctx->sample_aspect_ratio.num= get_bits(&s->gb, 8);

                    s->avctx->sample_aspect_ratio.den= get_bits(&s->gb, 8);

                }else{

                    s->avctx->sample_aspect_ratio= pixel_aspect[s->aspect_ratio_info];

                }

            } else {

                width = h263_format[format][0];

                height = h263_format[format][1];

            }

            if ((width == 0) || (height == 0))

                return -1;

            s->width = width;

            s->height = height;

            if (s->umvplus) {

                if(get_bits1(&s->gb)==0) /* Unlimited Unrestricted Motion Vectors Indicator (UUI) */

                    skip_bits1(&s->gb); 

            }

        }

            

        s->qscale = get_bits(&s->gb, 5);

    }

    /* PEI */

    while (get_bits1(&s->gb) != 0) {

        skip_bits(&s->gb, 8);

    }

    s->f_code = 1;

    

    if(s->h263_aic){

         s->y_dc_scale_table= 

         s->c_dc_scale_table= ff_aic_dc_scale_table;

    }else{

        s->y_dc_scale_table=

        s->c_dc_scale_table= ff_mpeg1_dc_scale_table;

    }



     if(s->avctx->debug&FF_DEBUG_PICT_INFO){

         av_log(s->avctx, AV_LOG_DEBUG, "qp:%d %c size:%d rnd:%d%s%s%s%s%s%s%s\n", 

         s->qscale, av_get_pict_type_char(s->pict_type),

         s->gb.size_in_bits, 1-s->no_rounding,

         s->obmc ? " AP" : "",

         s->umvplus ? " UMV" : "",

         s->h263_long_vectors ? " LONG" : "",

         s->h263_plus ? " +" : "",

         s->h263_aic ? " AIC" : "",

         s->alt_inter_vlc ? " AIV" : "",

         s->modified_quant ? " MQ" : ""

         ); 

     }

#if 1

    if (s->pict_type == I_TYPE && s->avctx->codec_tag == ff_get_fourcc("ZYGO")){

        int i,j;

        for(i=0; i<85; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));

        av_log(s->avctx, AV_LOG_DEBUG, "\n");

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

            for(j=0; j<3; j++){

                int v= get_bits(&s->gb, 8);

                v |= get_sbits(&s->gb, 8)<<8;

                av_log(s->avctx, AV_LOG_DEBUG, " %5d", v);

            }

            av_log(s->avctx, AV_LOG_DEBUG, "\n");

        }

        for(i=0; i<50; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));

    }

#endif



    return 0;

}

int h263_decode_picture_header(MpegEncContext *s)

{

    int format, width, height, i;

    uint32_t startcode;

    

    align_get_bits(&s->gb);



    startcode= get_bits(&s->gb, 22-8);



    for(i= s->gb.size_in_bits - get_bits_count(&s->gb); i>24; i-=8) {

        startcode = ((startcode << 8) | get_bits(&s->gb, 8)) & 0x003FFFFF;

        

        if(startcode == 0x20)

            break;

    }

        

    if (startcode != 0x20) {

        av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");

        return -1;

    }

    

    s->picture_number = get_bits(&s->gb, 8); 



        

    if (get_bits1(&s->gb) != 1) {

        

        av_log(s->avctx, AV_LOG_ERROR, "Bad marker\n");

        return -1;

    }

    if (get_bits1(&s->gb) != 0) {

        av_log(s->avctx, AV_LOG_ERROR, "Bad H263 id\n");

        return -1;	

    }

    skip_bits1(&s->gb);	

    skip_bits1(&s->gb);	

    skip_bits1(&s->gb);	



    

    s->gob_number = 0;

        

    format = get_bits(&s->gb, 3);

    













    if (format != 7 && format != 6) {

        s->h263_plus = 0;

        

        width = h263_format[format][0];

        height = h263_format[format][1];

        if (!width)

            return -1;

        

        s->pict_type = I_TYPE + get_bits1(&s->gb);



        s->h263_long_vectors = get_bits1(&s->gb); 



        if (get_bits1(&s->gb) != 0) {

            av_log(s->avctx, AV_LOG_ERROR, "H263 SAC not supported\n");

            return -1;	

        }

        s->obmc= get_bits1(&s->gb); 

        s->unrestricted_mv = s->h263_long_vectors || s->obmc;

        

        if (get_bits1(&s->gb) != 0) {

            av_log(s->avctx, AV_LOG_ERROR, "H263 PB frame not supported\n");

            return -1;	

        }

        s->qscale = get_bits(&s->gb, 5);

        skip_bits1(&s->gb);	



        s->width = width;

        s->height = height;

    } else {

        int ufep;

        

        

        s->h263_plus = 1;

        ufep = get_bits(&s->gb, 3); 



                

        if (ufep == 1) {

                   

            format = get_bits(&s->gb, 3);

            dprintf("ufep=1, format: %d\n", format);

            skip_bits(&s->gb,1); 

            s->umvplus = get_bits(&s->gb, 1); 

            skip_bits1(&s->gb); 

            s->obmc= get_bits1(&s->gb); 

            s->unrestricted_mv = s->umvplus || s->obmc;

            s->h263_aic = get_bits1(&s->gb); 

	    

            if (get_bits1(&s->gb) != 0) {

                av_log(s->avctx, AV_LOG_ERROR, "Deblocking Filter not supported\n");

            }

            if (get_bits1(&s->gb) != 0) {

                av_log(s->avctx, AV_LOG_ERROR, "Slice Structured not supported\n");

            }

            if (get_bits1(&s->gb) != 0) {

                av_log(s->avctx, AV_LOG_ERROR, "Reference Picture Selection not supported\n");

            }

            if (get_bits1(&s->gb) != 0) {

                av_log(s->avctx, AV_LOG_ERROR, "Independent Segment Decoding not supported\n");

            }

            s->alt_inter_vlc= get_bits1(&s->gb);

            s->modified_quant= get_bits1(&s->gb);

            

            skip_bits(&s->gb, 1); 



            skip_bits(&s->gb, 3); 

        } else if (ufep != 0) {

            av_log(s->avctx, AV_LOG_ERROR, "Bad UFEP type (%d)\n", ufep);

            return -1;

        }

            

        

        s->pict_type = get_bits(&s->gb, 3) + I_TYPE;

	if (s->pict_type == 8 && s->avctx->codec_tag == ff_get_fourcc("ZYGO"))

	    s->pict_type = I_TYPE;

        if (s->pict_type != I_TYPE &&

            s->pict_type != P_TYPE)

            return -1;

        skip_bits(&s->gb, 2);

        s->no_rounding = get_bits1(&s->gb);

        skip_bits(&s->gb, 4);

        

        

        if (ufep) {

            if (format == 6) {

                

                s->aspect_ratio_info = get_bits(&s->gb, 4);

                dprintf("aspect: %d\n", s->aspect_ratio_info);

                

















                width = (get_bits(&s->gb, 9) + 1) * 4;

                skip_bits1(&s->gb);

                height = get_bits(&s->gb, 9) * 4;

                dprintf("\nH.263+ Custom picture: %dx%d\n",width,height);

                if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) {

                    

                    s->avctx->sample_aspect_ratio.num= get_bits(&s->gb, 8);

                    s->avctx->sample_aspect_ratio.den= get_bits(&s->gb, 8);

                }else{

                    s->avctx->sample_aspect_ratio= pixel_aspect[s->aspect_ratio_info];

                }

            } else {

                width = h263_format[format][0];

                height = h263_format[format][1];

            }

            if ((width == 0) || (height == 0))

                return -1;

            s->width = width;

            s->height = height;

            if (s->umvplus) {

                if(get_bits1(&s->gb)==0) 

                    skip_bits1(&s->gb); 

            }

        }

            

        s->qscale = get_bits(&s->gb, 5);

    }

    

    while (get_bits1(&s->gb) != 0) {

        skip_bits(&s->gb, 8);

    }

    s->f_code = 1;

    

    if(s->h263_aic){

         s->y_dc_scale_table= 

         s->c_dc_scale_table= ff_aic_dc_scale_table;

    }else{

        s->y_dc_scale_table=

        s->c_dc_scale_table= ff_mpeg1_dc_scale_table;

    }



     if(s->avctx->debug&FF_DEBUG_PICT_INFO){

         av_log(s->avctx, AV_LOG_DEBUG, "qp:%d %c size:%d rnd:%d%s%s%s%s%s%s%s\n", 

         s->qscale, av_get_pict_type_char(s->pict_type),

         s->gb.size_in_bits, 1-s->no_rounding,

         s->obmc ? " AP" : "",

         s->umvplus ? " UMV" : "",

         s->h263_long_vectors ? " LONG" : "",

         s->h263_plus ? " +" : "",

         s->h263_aic ? " AIC" : "",

         s->alt_inter_vlc ? " AIV" : "",

         s->modified_quant ? " MQ" : ""

         ); 

     }

#if 1

    if (s->pict_type == I_TYPE && s->avctx->codec_tag == ff_get_fourcc("ZYGO")){

        int i,j;

        for(i=0; i<85; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));

        av_log(s->avctx, AV_LOG_DEBUG, "\n");

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

            for(j=0; j<3; j++){

                int v= get_bits(&s->gb, 8);

                v |= get_sbits(&s->gb, 8)<<8;

                av_log(s->avctx, AV_LOG_DEBUG, " %5d", v);

            }

            av_log(s->avctx, AV_LOG_DEBUG, "\n");

        }

        for(i=0; i<50; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));

    }

#endif



    return 0;

}

int FUNC_0(MpegEncContext *VAR_0)

{

    int VAR_1, VAR_2, VAR_3, VAR_6;

    uint32_t startcode;

    

    align_get_bits(&VAR_0->gb);



    startcode= get_bits(&VAR_0->gb, 22-8);



    for(VAR_6= VAR_0->gb.size_in_bits - get_bits_count(&VAR_0->gb); VAR_6>24; VAR_6-=8) {

        startcode = ((startcode << 8) | get_bits(&VAR_0->gb, 8)) & 0x003FFFFF;

        

        if(startcode == 0x20)

            break;

    }

        

    if (startcode != 0x20) {

        av_log(VAR_0->avctx, AV_LOG_ERROR, "Bad picture start code\n");

        return -1;

    }

    

    VAR_0->picture_number = get_bits(&VAR_0->gb, 8); 



        

    if (get_bits1(&VAR_0->gb) != 1) {

        

        av_log(VAR_0->avctx, AV_LOG_ERROR, "Bad marker\n");

        return -1;

    }

    if (get_bits1(&VAR_0->gb) != 0) {

        av_log(VAR_0->avctx, AV_LOG_ERROR, "Bad H263 id\n");

        return -1;	

    }

    skip_bits1(&VAR_0->gb);	

    skip_bits1(&VAR_0->gb);	

    skip_bits1(&VAR_0->gb);	



    

    VAR_0->gob_number = 0;

        

    VAR_1 = get_bits(&VAR_0->gb, 3);

    













    if (VAR_1 != 7 && VAR_1 != 6) {

        VAR_0->h263_plus = 0;

        

        VAR_2 = h263_format[VAR_1][0];

        VAR_3 = h263_format[VAR_1][1];

        if (!VAR_2)

            return -1;

        

        VAR_0->pict_type = I_TYPE + get_bits1(&VAR_0->gb);



        VAR_0->h263_long_vectors = get_bits1(&VAR_0->gb); 



        if (get_bits1(&VAR_0->gb) != 0) {

            av_log(VAR_0->avctx, AV_LOG_ERROR, "H263 SAC not supported\n");

            return -1;	

        }

        VAR_0->obmc= get_bits1(&VAR_0->gb); 

        VAR_0->unrestricted_mv = VAR_0->h263_long_vectors || VAR_0->obmc;

        

        if (get_bits1(&VAR_0->gb) != 0) {

            av_log(VAR_0->avctx, AV_LOG_ERROR, "H263 PB frame not supported\n");

            return -1;	

        }

        VAR_0->qscale = get_bits(&VAR_0->gb, 5);

        skip_bits1(&VAR_0->gb);	



        VAR_0->VAR_2 = VAR_2;

        VAR_0->VAR_3 = VAR_3;

    } else {

        int VAR_5;

        

        

        VAR_0->h263_plus = 1;

        VAR_5 = get_bits(&VAR_0->gb, 3); 



                

        if (VAR_5 == 1) {

                   

            VAR_1 = get_bits(&VAR_0->gb, 3);

            dprintf("VAR_5=1, VAR_1: %d\n", VAR_1);

            skip_bits(&VAR_0->gb,1); 

            VAR_0->umvplus = get_bits(&VAR_0->gb, 1); 

            skip_bits1(&VAR_0->gb); 

            VAR_0->obmc= get_bits1(&VAR_0->gb); 

            VAR_0->unrestricted_mv = VAR_0->umvplus || VAR_0->obmc;

            VAR_0->h263_aic = get_bits1(&VAR_0->gb); 

	    

            if (get_bits1(&VAR_0->gb) != 0) {

                av_log(VAR_0->avctx, AV_LOG_ERROR, "Deblocking Filter not supported\n");

            }

            if (get_bits1(&VAR_0->gb) != 0) {

                av_log(VAR_0->avctx, AV_LOG_ERROR, "Slice Structured not supported\n");

            }

            if (get_bits1(&VAR_0->gb) != 0) {

                av_log(VAR_0->avctx, AV_LOG_ERROR, "Reference Picture Selection not supported\n");

            }

            if (get_bits1(&VAR_0->gb) != 0) {

                av_log(VAR_0->avctx, AV_LOG_ERROR, "Independent Segment Decoding not supported\n");

            }

            VAR_0->alt_inter_vlc= get_bits1(&VAR_0->gb);

            VAR_0->modified_quant= get_bits1(&VAR_0->gb);

            

            skip_bits(&VAR_0->gb, 1); 



            skip_bits(&VAR_0->gb, 3); 

        } else if (VAR_5 != 0) {

            av_log(VAR_0->avctx, AV_LOG_ERROR, "Bad UFEP type (%d)\n", VAR_5);

            return -1;

        }

            

        

        VAR_0->pict_type = get_bits(&VAR_0->gb, 3) + I_TYPE;

	if (VAR_0->pict_type == 8 && VAR_0->avctx->codec_tag == ff_get_fourcc("ZYGO"))

	    VAR_0->pict_type = I_TYPE;

        if (VAR_0->pict_type != I_TYPE &&

            VAR_0->pict_type != P_TYPE)

            return -1;

        skip_bits(&VAR_0->gb, 2);

        VAR_0->no_rounding = get_bits1(&VAR_0->gb);

        skip_bits(&VAR_0->gb, 4);

        

        

        if (VAR_5) {

            if (VAR_1 == 6) {

                

                VAR_0->aspect_ratio_info = get_bits(&VAR_0->gb, 4);

                dprintf("aspect: %d\n", VAR_0->aspect_ratio_info);

                

















                VAR_2 = (get_bits(&VAR_0->gb, 9) + 1) * 4;

                skip_bits1(&VAR_0->gb);

                VAR_3 = get_bits(&VAR_0->gb, 9) * 4;

                dprintf("\nH.263+ Custom picture: %dx%d\n",VAR_2,VAR_3);

                if (VAR_0->aspect_ratio_info == FF_ASPECT_EXTENDED) {

                    

                    VAR_0->avctx->sample_aspect_ratio.num= get_bits(&VAR_0->gb, 8);

                    VAR_0->avctx->sample_aspect_ratio.den= get_bits(&VAR_0->gb, 8);

                }else{

                    VAR_0->avctx->sample_aspect_ratio= pixel_aspect[VAR_0->aspect_ratio_info];

                }

            } else {

                VAR_2 = h263_format[VAR_1][0];

                VAR_3 = h263_format[VAR_1][1];

            }

            if ((VAR_2 == 0) || (VAR_3 == 0))

                return -1;

            VAR_0->VAR_2 = VAR_2;

            VAR_0->VAR_3 = VAR_3;

            if (VAR_0->umvplus) {

                if(get_bits1(&VAR_0->gb)==0) 

                    skip_bits1(&VAR_0->gb); 

            }

        }

            

        VAR_0->qscale = get_bits(&VAR_0->gb, 5);

    }

    

    while (get_bits1(&VAR_0->gb) != 0) {

        skip_bits(&VAR_0->gb, 8);

    }

    VAR_0->f_code = 1;

    

    if(VAR_0->h263_aic){

         VAR_0->y_dc_scale_table= 

         VAR_0->c_dc_scale_table= ff_aic_dc_scale_table;

    }else{

        VAR_0->y_dc_scale_table=

        VAR_0->c_dc_scale_table= ff_mpeg1_dc_scale_table;

    }



     if(VAR_0->avctx->debug&FF_DEBUG_PICT_INFO){

         av_log(VAR_0->avctx, AV_LOG_DEBUG, "qp:%d %c size:%d rnd:%d%VAR_0%VAR_0%VAR_0%VAR_0%VAR_0%VAR_0%VAR_0\n", 

         VAR_0->qscale, av_get_pict_type_char(VAR_0->pict_type),

         VAR_0->gb.size_in_bits, 1-VAR_0->no_rounding,

         VAR_0->obmc ? " AP" : "",

         VAR_0->umvplus ? " UMV" : "",

         VAR_0->h263_long_vectors ? " LONG" : "",

         VAR_0->h263_plus ? " +" : "",

         VAR_0->h263_aic ? " AIC" : "",

         VAR_0->alt_inter_vlc ? " AIV" : "",

         VAR_0->modified_quant ? " MQ" : ""

         ); 

     }

#if 1

    if (VAR_0->pict_type == I_TYPE && VAR_0->avctx->codec_tag == ff_get_fourcc("ZYGO")){

        int VAR_6,VAR_6;

        for(VAR_6=0; VAR_6<85; VAR_6++) av_log(VAR_0->avctx, AV_LOG_DEBUG, "%d", get_bits1(&VAR_0->gb));

        av_log(VAR_0->avctx, AV_LOG_DEBUG, "\n");

        for(VAR_6=0; VAR_6<13; VAR_6++){

            for(VAR_6=0; VAR_6<3; VAR_6++){

                int VAR_7= get_bits(&VAR_0->gb, 8);

                VAR_7 |= get_sbits(&VAR_0->gb, 8)<<8;

                av_log(VAR_0->avctx, AV_LOG_DEBUG, " %5d", VAR_7);

            }

            av_log(VAR_0->avctx, AV_LOG_DEBUG, "\n");

        }

        for(VAR_6=0; VAR_6<50; VAR_6++) av_log(VAR_0->avctx, AV_LOG_DEBUG, "%d", get_bits1(&VAR_0->gb));

    }

#endif



    return 0;

}

int FUNC_0(MpegEncContext *VAR_0)
{ int VAR_1, VAR_2, VAR_3, VAR_6; uint32_t startcode; align_get_bits(&VAR_0->gb); startcode= get_bits(&VAR_0->gb, 22-8); for(VAR_6= VAR_0->gb.size_in_bits - get_bits_count(&VAR_0->gb); VAR_6>24; VAR_6-=8) { startcode = ((startcode << 8) | get_bits(&VAR_0->gb, 8)) & 0x003FFFFF; if(startcode == 0x20)
break; } if (startcode != 0x20) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Bad picture start code\n"); return -1; } VAR_0->picture_number = get_bits(&VAR_0->gb, 8); if (get_bits1(&VAR_0->gb) != 1) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Bad marker\n"); return -1; } if (get_bits1(&VAR_0->gb) != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Bad H263 id\n"); return -1; } skip_bits1(&VAR_0->gb); skip_bits1(&VAR_0->gb); skip_bits1(&VAR_0->gb); VAR_0->gob_number = 0; VAR_1 = get_bits(&VAR_0->gb, 3); if (VAR_1 != 7 && VAR_1 != 6) { VAR_0->h263_plus = 0; VAR_2 = h263_format[VAR_1][0]; VAR_3 = h263_format[VAR_1][1]; if (!VAR_2)
return -1; VAR_0->pict_type = I_TYPE + get_bits1(&VAR_0->gb); VAR_0->h263_long_vectors = get_bits1(&VAR_0->gb); if (get_bits1(&VAR_0->gb) != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "H263 SAC not supported\n"); return -1; } VAR_0->obmc= get_bits1(&VAR_0->gb); VAR_0->unrestricted_mv = VAR_0->h263_long_vectors || VAR_0->obmc; if (get_bits1(&VAR_0->gb) != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "H263 PB frame not supported\n"); return -1; } VAR_0->qscale = get_bits(&VAR_0->gb, 5); skip_bits1(&VAR_0->gb); VAR_0->VAR_2 = VAR_2; VAR_0->VAR_3 = VAR_3; } else { int VAR_5; VAR_0->h263_plus = 1; VAR_5 = get_bits(&VAR_0->gb, 3); if (VAR_5 == 1) { VAR_1 = get_bits(&VAR_0->gb, 3); dprintf("VAR_5=1, VAR_1: %d\n", VAR_1); skip_bits(&VAR_0->gb,1); VAR_0->umvplus = get_bits(&VAR_0->gb, 1); skip_bits1(&VAR_0->gb); VAR_0->obmc= get_bits1(&VAR_0->gb); VAR_0->unrestricted_mv = VAR_0->umvplus || VAR_0->obmc; VAR_0->h263_aic = get_bits1(&VAR_0->gb); if (get_bits1(&VAR_0->gb) != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Deblocking Filter not supported\n"); } if (get_bits1(&VAR_0->gb) != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Slice Structured not supported\n"); } if (get_bits1(&VAR_0->gb) != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Reference Picture Selection not supported\n"); } if (get_bits1(&VAR_0->gb) != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Independent Segment Decoding not supported\n"); } VAR_0->alt_inter_vlc= get_bits1(&VAR_0->gb); VAR_0->modified_quant= get_bits1(&VAR_0->gb); skip_bits(&VAR_0->gb, 1); skip_bits(&VAR_0->gb, 3); } else if (VAR_5 != 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Bad UFEP type (%d)\n", VAR_5); return -1; } VAR_0->pict_type = get_bits(&VAR_0->gb, 3) + I_TYPE; if (VAR_0->pict_type == 8 && VAR_0->avctx->codec_tag == ff_get_fourcc("ZYGO"))
VAR_0->pict_type = I_TYPE; if (VAR_0->pict_type != I_TYPE &&
VAR_0->pict_type != P_TYPE)
return -1; skip_bits(&VAR_0->gb, 2); VAR_0->no_rounding = get_bits1(&VAR_0->gb); skip_bits(&VAR_0->gb, 4); if (VAR_5) { if (VAR_1 == 6) { VAR_0->aspect_ratio_info = get_bits(&VAR_0->gb, 4); dprintf("aspect: %d\n", VAR_0->aspect_ratio_info); VAR_2 = (get_bits(&VAR_0->gb, 9) + 1) * 4; skip_bits1(&VAR_0->gb); VAR_3 = get_bits(&VAR_0->gb, 9) * 4; dprintf("\nH.263+ Custom picture: %dx%d\n",VAR_2,VAR_3); if (VAR_0->aspect_ratio_info == FF_ASPECT_EXTENDED) { VAR_0->avctx->sample_aspect_ratio.num= get_bits(&VAR_0->gb, 8); VAR_0->avctx->sample_aspect_ratio.den= get_bits(&VAR_0->gb, 8); }else{ VAR_0->avctx->sample_aspect_ratio= pixel_aspect[VAR_0->aspect_ratio_info]; } } else { VAR_2 = h263_format[VAR_1][0]; VAR_3 = h263_format[VAR_1][1]; } if ((VAR_2 == 0) || (VAR_3 == 0))
return -1; VAR_0->VAR_2 = VAR_2; VAR_0->VAR_3 = VAR_3; if (VAR_0->umvplus) { if(get_bits1(&VAR_0->gb)==0)
skip_bits1(&VAR_0->gb); } } VAR_0->qscale = get_bits(&VAR_0->gb, 5); } while (get_bits1(&VAR_0->gb) != 0) { skip_bits(&VAR_0->gb, 8); } VAR_0->f_code = 1; if(VAR_0->h263_aic){ VAR_0->y_dc_scale_table=
VAR_0->c_dc_scale_table= ff_aic_dc_scale_table; }else{ VAR_0->y_dc_scale_table=
VAR_0->c_dc_scale_table= ff_mpeg1_dc_scale_table; } if(VAR_0->avctx->debug&FF_DEBUG_PICT_INFO){ av_log(VAR_0->avctx, AV_LOG_DEBUG, "qp:%d %c size:%d rnd:%d%VAR_0%VAR_0%VAR_0%VAR_0%VAR_0%VAR_0%VAR_0\n",
VAR_0->qscale, av_get_pict_type_char(VAR_0->pict_type),
VAR_0->gb.size_in_bits, 1-VAR_0->no_rounding,
VAR_0->obmc ? " AP" : "",
VAR_0->umvplus ? " UMV" : "",
VAR_0->h263_long_vectors ? " LONG" : "",
VAR_0->h263_plus ? " +" : "",
VAR_0->h263_aic ? " AIC" : "",
VAR_0->alt_inter_vlc ? " AIV" : "",
VAR_0->modified_quant ? " MQ" : ""
); } #if 1
if (VAR_0->pict_type == I_TYPE && VAR_0->avctx->codec_tag == ff_get_fourcc("ZYGO")){ int VAR_6,VAR_6; for(VAR_6=0; VAR_6<85; VAR_6++) av_log(VAR_0->avctx, AV_LOG_DEBUG, "%d", get_bits1(&VAR_0->gb)); av_log(VAR_0->avctx, AV_LOG_DEBUG, "\n"); for(VAR_6=0; VAR_6<13; VAR_6++){ for(VAR_6=0; VAR_6<3; VAR_6++){ int VAR_7= get_bits(&VAR_0->gb, 8); VAR_7 |= get_sbits(&VAR_0->gb, 8)<<8; av_log(VAR_0->avctx, AV_LOG_DEBUG, " %5d", VAR_7); } av_log(VAR_0->avctx, AV_LOG_DEBUG, "\n"); } for(VAR_6=0; VAR_6<50; VAR_6++) av_log(VAR_0->avctx, AV_LOG_DEBUG, "%d", get_bits1(&VAR_0->gb)); } #endif
return 0; }