static inline int mpeg4_is_resync(MpegEncContext *s){

    const int bits_count= get_bits_count(&s->gb);

    

    if(s->workaround_bugs&FF_BUG_NO_PADDING){

        return 0;

    }



    if(bits_count + 8 >= s->gb.size*8){

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

        v|= 0x7F >> (7-(bits_count&7));

                

        if(v==0x7F)

            return 1;

    }else{

        if(show_bits(&s->gb, 16) == ff_mpeg4_resync_prefix[bits_count&7]){

            int len;

            GetBitContext gb= s->gb;

        

            skip_bits(&s->gb, 1);

            align_get_bits(&s->gb);

        

            for(len=0; len<32; len++){

                if(get_bits1(&s->gb)) break;

            }



            s->gb= gb;



            if(len>=ff_mpeg4_get_video_packet_prefix_length(s))

                return 1;

        }

    }

    return 0;

}

static inline int mpeg4_is_resync(MpegEncContext *s){

    const int bits_count= get_bits_count(&s->gb);

    

    if(s->workaround_bugs&FF_BUG_NO_PADDING){

        return 0;

    }



    if(bits_count + 8 >= s->gb.size*8){

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

        v|= 0x7F >> (7-(bits_count&7));

                

        if(v==0x7F)

            return 1;

    }else{

        if(show_bits(&s->gb, 16) == ff_mpeg4_resync_prefix[bits_count&7]){

            int len;

            GetBitContext gb= s->gb;

        

            skip_bits(&s->gb, 1);

            align_get_bits(&s->gb);

        

            for(len=0; len<32; len++){

                if(get_bits1(&s->gb)) break;

            }



            s->gb= gb;



            if(len>=ff_mpeg4_get_video_packet_prefix_length(s))

                return 1;

        }

    }

    return 0;

}

static inline int FUNC_0(MpegEncContext *VAR_0){

    const int VAR_1= get_bits_count(&VAR_0->gb);

    

    if(VAR_0->workaround_bugs&FF_BUG_NO_PADDING){

        return 0;

    }



    if(VAR_1 + 8 >= VAR_0->gb.size*8){

        int VAR_2= show_bits(&VAR_0->gb, 8);

        VAR_2|= 0x7F >> (7-(VAR_1&7));

                

        if(VAR_2==0x7F)

            return 1;

    }else{

        if(show_bits(&VAR_0->gb, 16) == ff_mpeg4_resync_prefix[VAR_1&7]){

            int VAR_3;

            GetBitContext gb= VAR_0->gb;

        

            skip_bits(&VAR_0->gb, 1);

            align_get_bits(&VAR_0->gb);

        

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

                if(get_bits1(&VAR_0->gb)) break;

            }



            VAR_0->gb= gb;



            if(VAR_3>=ff_mpeg4_get_video_packet_prefix_length(VAR_0))

                return 1;

        }

    }

    return 0;

}

static inline int FUNC_0(MpegEncContext *VAR_0){ const int VAR_1= get_bits_count(&VAR_0->gb); if(VAR_0->workaround_bugs&FF_BUG_NO_PADDING){ return 0; } if(VAR_1 + 8 >= VAR_0->gb.size*8){ int VAR_2= show_bits(&VAR_0->gb, 8); VAR_2|= 0x7F >> (7-(VAR_1&7)); if(VAR_2==0x7F)
return 1; }else{ if(show_bits(&VAR_0->gb, 16) == ff_mpeg4_resync_prefix[VAR_1&7]){ int VAR_3; GetBitContext gb= VAR_0->gb; skip_bits(&VAR_0->gb, 1); align_get_bits(&VAR_0->gb); for(VAR_3=0; VAR_3<32; VAR_3++){ if(get_bits1(&VAR_0->gb)) break; } VAR_0->gb= gb; if(VAR_3>=ff_mpeg4_get_video_packet_prefix_length(VAR_0))
return 1; } } return 0; }