static int rv10_decode_picture_header(MpegEncContext *s)

{

    int mb_count, pb_frame, marker, h, full_frame;

    

    /* skip packet header */

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

    if ((h & 0xc0) == 0xc0) {

        int len, pos;

        full_frame = 1;

        len = get_num(&s->gb);

        pos = get_num(&s->gb);

    } else {

        int seq, frame_size, pos;

        full_frame = 0;

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

        frame_size = get_num(&s->gb);

        pos = get_num(&s->gb);

    }

    /* picture number */

    get_bits(&s->gb, 8);



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



    if (get_bits(&s->gb, 1))

        s->pict_type = P_TYPE;

    else

        s->pict_type = I_TYPE;



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



#ifdef DEBUG

    printf("pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame);

#endif

    

    if (pb_frame)

        return -1;



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



    if (s->pict_type == I_TYPE) {

        if (s->rv10_version == 3) {

            /* specific MPEG like DC coding not used */

            s->last_dc[0] = get_bits(&s->gb, 8);

            s->last_dc[1] = get_bits(&s->gb, 8);

            s->last_dc[2] = get_bits(&s->gb, 8);

#ifdef DEBUG

            printf("DC:%d %d %d\n",

                   s->last_dc[0],

                   s->last_dc[1],

                   s->last_dc[2]);

#endif

        }

    }

    /* if multiple packets per frame are sent, the position at which

       to display the macro blocks is coded here */

    if (!full_frame) {

        s->mb_x = get_bits(&s->gb, 6);	/* mb_x */

        s->mb_y = get_bits(&s->gb, 6);	/* mb_y */

        mb_count = get_bits(&s->gb, 12);

    } else {

        s->mb_x = 0;

        s->mb_y = 0;

        mb_count = s->mb_width * s->mb_height;

    }



    get_bits(&s->gb, 3);	/* ignored */

    s->f_code = 1;

    s->unrestricted_mv = 1;

#if 0

    s->h263_long_vectors = 1;

#endif

    return mb_count;

}

static int rv10_decode_picture_header(MpegEncContext *s)

{

    int mb_count, pb_frame, marker, h, full_frame;

    

    

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

    if ((h & 0xc0) == 0xc0) {

        int len, pos;

        full_frame = 1;

        len = get_num(&s->gb);

        pos = get_num(&s->gb);

    } else {

        int seq, frame_size, pos;

        full_frame = 0;

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

        frame_size = get_num(&s->gb);

        pos = get_num(&s->gb);

    }

    

    get_bits(&s->gb, 8);



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



    if (get_bits(&s->gb, 1))

        s->pict_type = P_TYPE;

    else

        s->pict_type = I_TYPE;



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



#ifdef DEBUG

    printf("pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame);

#endif

    

    if (pb_frame)

        return -1;



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



    if (s->pict_type == I_TYPE) {

        if (s->rv10_version == 3) {

            

            s->last_dc[0] = get_bits(&s->gb, 8);

            s->last_dc[1] = get_bits(&s->gb, 8);

            s->last_dc[2] = get_bits(&s->gb, 8);

#ifdef DEBUG

            printf("DC:%d %d %d\n",

                   s->last_dc[0],

                   s->last_dc[1],

                   s->last_dc[2]);

#endif

        }

    }

    



    if (!full_frame) {

        s->mb_x = get_bits(&s->gb, 6);	

        s->mb_y = get_bits(&s->gb, 6);	

        mb_count = get_bits(&s->gb, 12);

    } else {

        s->mb_x = 0;

        s->mb_y = 0;

        mb_count = s->mb_width * s->mb_height;

    }



    get_bits(&s->gb, 3);	

    s->f_code = 1;

    s->unrestricted_mv = 1;

#if 0

    s->h263_long_vectors = 1;

#endif

    return mb_count;

}

static int FUNC_0(MpegEncContext *VAR_0)

{

    int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5;

    

    

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

    if ((VAR_4 & 0xc0) == 0xc0) {

        int VAR_6, VAR_10;

        VAR_5 = 1;

        VAR_6 = get_num(&VAR_0->gb);

        VAR_10 = get_num(&VAR_0->gb);

    } else {

        int VAR_8, VAR_9, VAR_10;

        VAR_5 = 0;

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

        VAR_9 = get_num(&VAR_0->gb);

        VAR_10 = get_num(&VAR_0->gb);

    }

    

    get_bits(&VAR_0->gb, 8);



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



    if (get_bits(&VAR_0->gb, 1))

        VAR_0->pict_type = P_TYPE;

    else

        VAR_0->pict_type = I_TYPE;



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



#ifdef DEBUG

    printf("pict_type=%d VAR_2=%d\n", VAR_0->pict_type, VAR_2);

#endif

    

    if (VAR_2)

        return -1;



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



    if (VAR_0->pict_type == I_TYPE) {

        if (VAR_0->rv10_version == 3) {

            

            VAR_0->last_dc[0] = get_bits(&VAR_0->gb, 8);

            VAR_0->last_dc[1] = get_bits(&VAR_0->gb, 8);

            VAR_0->last_dc[2] = get_bits(&VAR_0->gb, 8);

#ifdef DEBUG

            printf("DC:%d %d %d\n",

                   VAR_0->last_dc[0],

                   VAR_0->last_dc[1],

                   VAR_0->last_dc[2]);

#endif

        }

    }

    



    if (!VAR_5) {

        VAR_0->mb_x = get_bits(&VAR_0->gb, 6);	

        VAR_0->mb_y = get_bits(&VAR_0->gb, 6);	

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

    } else {

        VAR_0->mb_x = 0;

        VAR_0->mb_y = 0;

        VAR_1 = VAR_0->mb_width * VAR_0->mb_height;

    }



    get_bits(&VAR_0->gb, 3);	

    VAR_0->f_code = 1;

    VAR_0->unrestricted_mv = 1;

#if 0

    VAR_0->h263_long_vectors = 1;

#endif

    return VAR_1;

}

static int FUNC_0(MpegEncContext *VAR_0)
{ int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5; VAR_4 = get_bits(&VAR_0->gb, 8); if ((VAR_4 & 0xc0) == 0xc0) { int VAR_6, VAR_10; VAR_5 = 1; VAR_6 = get_num(&VAR_0->gb); VAR_10 = get_num(&VAR_0->gb); } else { int VAR_8, VAR_9, VAR_10; VAR_5 = 0; VAR_8 = get_bits(&VAR_0->gb, 8); VAR_9 = get_num(&VAR_0->gb); VAR_10 = get_num(&VAR_0->gb); } get_bits(&VAR_0->gb, 8); VAR_3 = get_bits(&VAR_0->gb, 1); if (get_bits(&VAR_0->gb, 1))
VAR_0->pict_type = P_TYPE; else
VAR_0->pict_type = I_TYPE; VAR_2 = get_bits(&VAR_0->gb, 1); #ifdef DEBUG
printf("pict_type=%d VAR_2=%d\n", VAR_0->pict_type, VAR_2); #endif
if (VAR_2)
return -1; VAR_0->qscale = get_bits(&VAR_0->gb, 5); if (VAR_0->pict_type == I_TYPE) { if (VAR_0->rv10_version == 3) { VAR_0->last_dc[0] = get_bits(&VAR_0->gb, 8); VAR_0->last_dc[1] = get_bits(&VAR_0->gb, 8); VAR_0->last_dc[2] = get_bits(&VAR_0->gb, 8); #ifdef DEBUG
printf("DC:%d %d %d\n",
VAR_0->last_dc[0],
VAR_0->last_dc[1],
VAR_0->last_dc[2]); #endif
} } if (!VAR_5) { VAR_0->mb_x = get_bits(&VAR_0->gb, 6); VAR_0->mb_y = get_bits(&VAR_0->gb, 6); VAR_1 = get_bits(&VAR_0->gb, 12); } else { VAR_0->mb_x = 0; VAR_0->mb_y = 0; VAR_1 = VAR_0->mb_width * VAR_0->mb_height; } get_bits(&VAR_0->gb, 3); VAR_0->f_code = 1; VAR_0->unrestricted_mv = 1; #if 0
VAR_0->h263_long_vectors = 1; #endif
return VAR_1; }