static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)

{

    int level, pred, code;

    uint16_t *dc_val;



    if (n < 4) 

        code = get_vlc2(&s->gb, dc_lum.table, DC_VLC_BITS, 1);

    else 

        code = get_vlc2(&s->gb, dc_chrom.table, DC_VLC_BITS, 1);

    if (code < 0 || code > 9 /* && s->nbit<9 */){

        fprintf(stderr, "illegal dc vlc\n");

        return -1;

    }

    if (code == 0) {

        level = 0;

    } else {

        level = get_xbits(&s->gb, code);

        if (code > 8){

            if(get_bits1(&s->gb)==0){ /* marker */

                if(s->error_resilience>=2){

                    fprintf(stderr, "dc marker bit missing\n");

                    return -1;

                }

            }

        }

    }

    pred = ff_mpeg4_pred_dc(s, n, &dc_val, dir_ptr);

    level += pred;

    if (level < 0){

        if(s->error_resilience>=3){

            fprintf(stderr, "dc<0 at %dx%d\n", s->mb_x, s->mb_y);

            return -1;

        }

        level = 0;

    }

    if (n < 4) {

        *dc_val = level * s->y_dc_scale;

    } else {

        *dc_val = level * s->c_dc_scale;

    }

    if(s->error_resilience>=3){

        if(*dc_val > 2048 + s->y_dc_scale + s->c_dc_scale){

            fprintf(stderr, "dc overflow at %dx%d\n", s->mb_x, s->mb_y);

            return -1;

        }

    }

    return level;

}

static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)

{

    int level, pred, code;

    uint16_t *dc_val;



    if (n < 4) 

        code = get_vlc2(&s->gb, dc_lum.table, DC_VLC_BITS, 1);

    else 

        code = get_vlc2(&s->gb, dc_chrom.table, DC_VLC_BITS, 1);

    if (code < 0 || code > 9 ){

        fprintf(stderr, "illegal dc vlc\n");

        return -1;

    }

    if (code == 0) {

        level = 0;

    } else {

        level = get_xbits(&s->gb, code);

        if (code > 8){

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

                if(s->error_resilience>=2){

                    fprintf(stderr, "dc marker bit missing\n");

                    return -1;

                }

            }

        }

    }

    pred = ff_mpeg4_pred_dc(s, n, &dc_val, dir_ptr);

    level += pred;

    if (level < 0){

        if(s->error_resilience>=3){

            fprintf(stderr, "dc<0 at %dx%d\n", s->mb_x, s->mb_y);

            return -1;

        }

        level = 0;

    }

    if (n < 4) {

        *dc_val = level * s->y_dc_scale;

    } else {

        *dc_val = level * s->c_dc_scale;

    }

    if(s->error_resilience>=3){

        if(*dc_val > 2048 + s->y_dc_scale + s->c_dc_scale){

            fprintf(stderr, "dc overflow at %dx%d\n", s->mb_x, s->mb_y);

            return -1;

        }

    }

    return level;

}

static inline int FUNC_0(MpegEncContext * VAR_0, int VAR_1, int *VAR_2)

{

    int VAR_3, VAR_4, VAR_5;

    uint16_t *dc_val;



    if (VAR_1 < 4) 

        VAR_5 = get_vlc2(&VAR_0->gb, dc_lum.table, DC_VLC_BITS, 1);

    else 

        VAR_5 = get_vlc2(&VAR_0->gb, dc_chrom.table, DC_VLC_BITS, 1);

    if (VAR_5 < 0 || VAR_5 > 9 ){

        fprintf(stderr, "illegal dc vlc\VAR_1");

        return -1;

    }

    if (VAR_5 == 0) {

        VAR_3 = 0;

    } else {

        VAR_3 = get_xbits(&VAR_0->gb, VAR_5);

        if (VAR_5 > 8){

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

                if(VAR_0->error_resilience>=2){

                    fprintf(stderr, "dc marker bit missing\VAR_1");

                    return -1;

                }

            }

        }

    }

    VAR_4 = ff_mpeg4_pred_dc(VAR_0, VAR_1, &dc_val, VAR_2);

    VAR_3 += VAR_4;

    if (VAR_3 < 0){

        if(VAR_0->error_resilience>=3){

            fprintf(stderr, "dc<0 at %dx%d\VAR_1", VAR_0->mb_x, VAR_0->mb_y);

            return -1;

        }

        VAR_3 = 0;

    }

    if (VAR_1 < 4) {

        *dc_val = VAR_3 * VAR_0->y_dc_scale;

    } else {

        *dc_val = VAR_3 * VAR_0->c_dc_scale;

    }

    if(VAR_0->error_resilience>=3){

        if(*dc_val > 2048 + VAR_0->y_dc_scale + VAR_0->c_dc_scale){

            fprintf(stderr, "dc overflow at %dx%d\VAR_1", VAR_0->mb_x, VAR_0->mb_y);

            return -1;

        }

    }

    return VAR_3;

}

static inline int FUNC_0(MpegEncContext * VAR_0, int VAR_1, int *VAR_2)
{ int VAR_3, VAR_4, VAR_5; uint16_t *dc_val; if (VAR_1 < 4)
VAR_5 = get_vlc2(&VAR_0->gb, dc_lum.table, DC_VLC_BITS, 1); else
VAR_5 = get_vlc2(&VAR_0->gb, dc_chrom.table, DC_VLC_BITS, 1); if (VAR_5 < 0 || VAR_5 > 9 ){ fprintf(stderr, "illegal dc vlc\VAR_1"); return -1; } if (VAR_5 == 0) { VAR_3 = 0; } else { VAR_3 = get_xbits(&VAR_0->gb, VAR_5); if (VAR_5 > 8){ if(get_bits1(&VAR_0->gb)==0){ if(VAR_0->error_resilience>=2){ fprintf(stderr, "dc marker bit missing\VAR_1"); return -1; } } } } VAR_4 = ff_mpeg4_pred_dc(VAR_0, VAR_1, &dc_val, VAR_2); VAR_3 += VAR_4; if (VAR_3 < 0){ if(VAR_0->error_resilience>=3){ fprintf(stderr, "dc<0 at %dx%d\VAR_1", VAR_0->mb_x, VAR_0->mb_y); return -1; } VAR_3 = 0; } if (VAR_1 < 4) { *dc_val = VAR_3 * VAR_0->y_dc_scale; } else { *dc_val = VAR_3 * VAR_0->c_dc_scale; } if(VAR_0->error_resilience>=3){ if(*dc_val > 2048 + VAR_0->y_dc_scale + VAR_0->c_dc_scale){ fprintf(stderr, "dc overflow at %dx%d\VAR_1", VAR_0->mb_x, VAR_0->mb_y); return -1; } } return VAR_3; }