static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,

                              int n, int coded, int intra)

{

    int level, i, last, run;

    int dc_pred_dir;

    RLTable * rl;

    RL_VLC_ELEM * rl_vlc;

    const UINT8 * scan_table;

    int qmul, qadd;



    if(intra) {

	/* DC coef */

        if(s->partitioned_frame){

            level = s->dc_val[0][ s->block_index[n] ];

            if(n<4) level= (level + (s->y_dc_scale>>1))/s->y_dc_scale; //FIXME optimizs

            else    level= (level + (s->c_dc_scale>>1))/s->c_dc_scale;

            dc_pred_dir= (s->pred_dir_table[s->mb_x + s->mb_y*s->mb_width]<<n)&32;

        }else{

            level = mpeg4_decode_dc(s, n, &dc_pred_dir);

            if (level < 0)

                return -1;

        }

        block[0] = level;

        i = 0;

        if (!coded) 

            goto not_coded;

        rl = &rl_intra;

        rl_vlc = rl_intra.rl_vlc[0];

        if (s->ac_pred) {

            if (dc_pred_dir == 0) 

                scan_table = s->intra_v_scantable.permutated; /* left */

            else

                scan_table = s->intra_h_scantable.permutated; /* top */

        } else {

            scan_table = s->intra_scantable.permutated;

        }

        qmul=1;

        qadd=0;

    } else {

        i = -1;

        if (!coded) {

            s->block_last_index[n] = i;

            return 0;

        }

        rl = &rl_inter;

   

        scan_table = s->intra_scantable.permutated;



        if(s->mpeg_quant){

            qmul=1;

            qadd=0;

            rl_vlc = rl_inter.rl_vlc[0];        

        }else{

            qmul = s->qscale << 1;

            qadd = (s->qscale - 1) | 1;

            rl_vlc = rl_inter.rl_vlc[s->qscale];

        }

    }

  {

    OPEN_READER(re, &s->gb);

    for(;;) {

        UPDATE_CACHE(re, &s->gb);

        GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2);

        if (level==0) {

            int cache;

            cache= GET_CACHE(re, &s->gb);

            /* escape */

            if (cache&0x80000000) {

                if (cache&0x40000000) {

                    /* third escape */

                    SKIP_CACHE(re, &s->gb, 2);

                    last=  SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1);

                    run=   SHOW_UBITS(re, &s->gb, 6); LAST_SKIP_CACHE(re, &s->gb, 6);

                    SKIP_COUNTER(re, &s->gb, 2+1+6);

                    UPDATE_CACHE(re, &s->gb);



                    if(SHOW_UBITS(re, &s->gb, 1)==0){

                        fprintf(stderr, "1. marker bit missing in 3. esc\n");

                        return -1;

                    }; SKIP_CACHE(re, &s->gb, 1);

                    

                    level= SHOW_SBITS(re, &s->gb, 12); SKIP_CACHE(re, &s->gb, 12);

 

                    if(SHOW_UBITS(re, &s->gb, 1)==0){

                        fprintf(stderr, "2. marker bit missing in 3. esc\n");

                        return -1;

                    }; LAST_SKIP_CACHE(re, &s->gb, 1);

                    

                    SKIP_COUNTER(re, &s->gb, 1+12+1);

                    

                    if(level*s->qscale>1024 || level*s->qscale<-1024){

                        fprintf(stderr, "|level| overflow in 3. esc, qp=%d\n", s->qscale);

                        return -1;

                    }

#if 1 

                    {

                        const int abs_level= ABS(level);

                        if(abs_level<=MAX_LEVEL && run<=MAX_RUN && ((s->workaround_bugs&FF_BUG_AC_VLC)==0)){

                            const int run1= run - rl->max_run[last][abs_level] - 1;

                            if(abs_level <= rl->max_level[last][run]){

                                fprintf(stderr, "illegal 3. esc, vlc encoding possible\n");

                                return -1;

                            }

                            if(abs_level <= rl->max_level[last][run]*2){

                                fprintf(stderr, "illegal 3. esc, esc 1 encoding possible\n");

                                return -1;

                            }

                            if(run1 >= 0 && abs_level <= rl->max_level[last][run1]){

                                fprintf(stderr, "illegal 3. esc, esc 2 encoding possible\n");

                                return -1;

                            }

                        }

                    }

#endif

		    if (level>0) level= level * qmul + qadd;

                    else         level= level * qmul - qadd;



                    i+= run + 1;

                    if(last) i+=192;

                } else {

                    /* second escape */

#if MIN_CACHE_BITS < 20

                    LAST_SKIP_BITS(re, &s->gb, 2);

                    UPDATE_CACHE(re, &s->gb);

#else

                    SKIP_BITS(re, &s->gb, 2);

#endif

                    GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2);

                    i+= run + rl->max_run[run>>7][level/qmul] +1; //FIXME opt indexing

                    level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);

                    LAST_SKIP_BITS(re, &s->gb, 1);

                }

            } else {

                /* first escape */

#if MIN_CACHE_BITS < 19

                LAST_SKIP_BITS(re, &s->gb, 1);

                UPDATE_CACHE(re, &s->gb);

#else

                SKIP_BITS(re, &s->gb, 1);

#endif

                GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2);

                i+= run;

                level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing

                level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);

                LAST_SKIP_BITS(re, &s->gb, 1);

            }

        } else {

            i+= run;

            level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);

            LAST_SKIP_BITS(re, &s->gb, 1);

        }

        if (i > 62){

            i-= 192;

            if(i&(~63)){

                fprintf(stderr, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);

                return -1;

            }



            block[scan_table[i]] = level;

            break;

        }



        block[scan_table[i]] = level;

    }

    CLOSE_READER(re, &s->gb);

  }

 not_coded:

    if (s->mb_intra) {

        mpeg4_pred_ac(s, block, n, dc_pred_dir);

        if (s->ac_pred) {

            i = 63; /* XXX: not optimal */

        }

    }

    s->block_last_index[n] = i;

    return 0;

}

static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,

                              int n, int coded, int intra)

{

    int level, i, last, run;

    int dc_pred_dir;

    RLTable * rl;

    RL_VLC_ELEM * rl_vlc;

    const UINT8 * scan_table;

    int qmul, qadd;



    if(intra) {

	

        if(s->partitioned_frame){

            level = s->dc_val[0][ s->block_index[n] ];

            if(n<4) level= (level + (s->y_dc_scale>>1))/s->y_dc_scale; 

            else    level= (level + (s->c_dc_scale>>1))/s->c_dc_scale;

            dc_pred_dir= (s->pred_dir_table[s->mb_x + s->mb_y*s->mb_width]<<n)&32;

        }else{

            level = mpeg4_decode_dc(s, n, &dc_pred_dir);

            if (level < 0)

                return -1;

        }

        block[0] = level;

        i = 0;

        if (!coded) 

            goto not_coded;

        rl = &rl_intra;

        rl_vlc = rl_intra.rl_vlc[0];

        if (s->ac_pred) {

            if (dc_pred_dir == 0) 

                scan_table = s->intra_v_scantable.permutated; 

            else

                scan_table = s->intra_h_scantable.permutated; 

        } else {

            scan_table = s->intra_scantable.permutated;

        }

        qmul=1;

        qadd=0;

    } else {

        i = -1;

        if (!coded) {

            s->block_last_index[n] = i;

            return 0;

        }

        rl = &rl_inter;

   

        scan_table = s->intra_scantable.permutated;



        if(s->mpeg_quant){

            qmul=1;

            qadd=0;

            rl_vlc = rl_inter.rl_vlc[0];        

        }else{

            qmul = s->qscale << 1;

            qadd = (s->qscale - 1) | 1;

            rl_vlc = rl_inter.rl_vlc[s->qscale];

        }

    }

  {

    OPEN_READER(re, &s->gb);

    for(;;) {

        UPDATE_CACHE(re, &s->gb);

        GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2);

        if (level==0) {

            int cache;

            cache= GET_CACHE(re, &s->gb);

            

            if (cache&0x80000000) {

                if (cache&0x40000000) {

                    

                    SKIP_CACHE(re, &s->gb, 2);

                    last=  SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1);

                    run=   SHOW_UBITS(re, &s->gb, 6); LAST_SKIP_CACHE(re, &s->gb, 6);

                    SKIP_COUNTER(re, &s->gb, 2+1+6);

                    UPDATE_CACHE(re, &s->gb);



                    if(SHOW_UBITS(re, &s->gb, 1)==0){

                        fprintf(stderr, "1. marker bit missing in 3. esc\n");

                        return -1;

                    }; SKIP_CACHE(re, &s->gb, 1);

                    

                    level= SHOW_SBITS(re, &s->gb, 12); SKIP_CACHE(re, &s->gb, 12);

 

                    if(SHOW_UBITS(re, &s->gb, 1)==0){

                        fprintf(stderr, "2. marker bit missing in 3. esc\n");

                        return -1;

                    }; LAST_SKIP_CACHE(re, &s->gb, 1);

                    

                    SKIP_COUNTER(re, &s->gb, 1+12+1);

                    

                    if(level*s->qscale>1024 || level*s->qscale<-1024){

                        fprintf(stderr, "|level| overflow in 3. esc, qp=%d\n", s->qscale);

                        return -1;

                    }

#if 1 

                    {

                        const int abs_level= ABS(level);

                        if(abs_level<=MAX_LEVEL && run<=MAX_RUN && ((s->workaround_bugs&FF_BUG_AC_VLC)==0)){

                            const int run1= run - rl->max_run[last][abs_level] - 1;

                            if(abs_level <= rl->max_level[last][run]){

                                fprintf(stderr, "illegal 3. esc, vlc encoding possible\n");

                                return -1;

                            }

                            if(abs_level <= rl->max_level[last][run]*2){

                                fprintf(stderr, "illegal 3. esc, esc 1 encoding possible\n");

                                return -1;

                            }

                            if(run1 >= 0 && abs_level <= rl->max_level[last][run1]){

                                fprintf(stderr, "illegal 3. esc, esc 2 encoding possible\n");

                                return -1;

                            }

                        }

                    }

#endif

		    if (level>0) level= level * qmul + qadd;

                    else         level= level * qmul - qadd;



                    i+= run + 1;

                    if(last) i+=192;

                } else {

                    

#if MIN_CACHE_BITS < 20

                    LAST_SKIP_BITS(re, &s->gb, 2);

                    UPDATE_CACHE(re, &s->gb);

#else

                    SKIP_BITS(re, &s->gb, 2);

#endif

                    GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2);

                    i+= run + rl->max_run[run>>7][level/qmul] +1; 

                    level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);

                    LAST_SKIP_BITS(re, &s->gb, 1);

                }

            } else {

                

#if MIN_CACHE_BITS < 19

                LAST_SKIP_BITS(re, &s->gb, 1);

                UPDATE_CACHE(re, &s->gb);

#else

                SKIP_BITS(re, &s->gb, 1);

#endif

                GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2);

                i+= run;

                level = level + rl->max_level[run>>7][(run-1)&63] * qmul;

                level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);

                LAST_SKIP_BITS(re, &s->gb, 1);

            }

        } else {

            i+= run;

            level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);

            LAST_SKIP_BITS(re, &s->gb, 1);

        }

        if (i > 62){

            i-= 192;

            if(i&(~63)){

                fprintf(stderr, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);

                return -1;

            }



            block[scan_table[i]] = level;

            break;

        }



        block[scan_table[i]] = level;

    }

    CLOSE_READER(re, &s->gb);

  }

 not_coded:

    if (s->mb_intra) {

        mpeg4_pred_ac(s, block, n, dc_pred_dir);

        if (s->ac_pred) {

            i = 63; 

        }

    }

    s->block_last_index[n] = i;

    return 0;

}

                        if(abs_level<=MAX_LEVEL && run<=MAX_RUN && ((s->workaround_bugs&FF_BUG_AC_VLC)==0)){                             if(abs_level <= rl->max_level[last][run]*2){                                 fprintf(stderr, "illegal 3. esc, esc 1 encoding possible\n");                                 return -1;                             if(run1 >= 0 && abs_level <= rl->max_level[last][run1]){                                 fprintf(stderr, "illegal 3. esc, esc 2 encoding possible\n");                                 return -1;
static inline int FUNC_0(MpegEncContext * VAR_0, DCTELEM * VAR_1,

                              int VAR_2, int VAR_3, int VAR_4)

{

    int VAR_5, VAR_6, VAR_7, VAR_8;

    int VAR_9;

    RLTable * rl;

    RL_VLC_ELEM * rl_vlc;

    const UINT8 * VAR_10;

    int VAR_11, VAR_12;



    if(VAR_4) {

	

        if(VAR_0->partitioned_frame){

            VAR_5 = VAR_0->dc_val[0][ VAR_0->block_index[VAR_2] ];

            if(VAR_2<4) VAR_5= (VAR_5 + (VAR_0->y_dc_scale>>1))/VAR_0->y_dc_scale; 

            else    VAR_5= (VAR_5 + (VAR_0->c_dc_scale>>1))/VAR_0->c_dc_scale;

            VAR_9= (VAR_0->pred_dir_table[VAR_0->mb_x + VAR_0->mb_y*VAR_0->mb_width]<<VAR_2)&32;

        }else{

            VAR_5 = mpeg4_decode_dc(VAR_0, VAR_2, &VAR_9);

            if (VAR_5 < 0)

                return -1;

        }

        VAR_1[0] = VAR_5;

        VAR_6 = 0;

        if (!VAR_3) 

            goto not_coded;

        rl = &rl_intra;

        rl_vlc = rl_intra.rl_vlc[0];

        if (VAR_0->ac_pred) {

            if (VAR_9 == 0) 

                VAR_10 = VAR_0->intra_v_scantable.permutated; 

            else

                VAR_10 = VAR_0->intra_h_scantable.permutated; 

        } else {

            VAR_10 = VAR_0->intra_scantable.permutated;

        }

        VAR_11=1;

        VAR_12=0;

    } else {

        VAR_6 = -1;

        if (!VAR_3) {

            VAR_0->block_last_index[VAR_2] = VAR_6;

            return 0;

        }

        rl = &rl_inter;

   

        VAR_10 = VAR_0->intra_scantable.permutated;



        if(VAR_0->mpeg_quant){

            VAR_11=1;

            VAR_12=0;

            rl_vlc = rl_inter.rl_vlc[0];        

        }else{

            VAR_11 = VAR_0->qscale << 1;

            VAR_12 = (VAR_0->qscale - 1) | 1;

            rl_vlc = rl_inter.rl_vlc[VAR_0->qscale];

        }

    }

  {

    OPEN_READER(re, &VAR_0->gb);

    for(;;) {

        UPDATE_CACHE(re, &VAR_0->gb);

        GET_RL_VLC(VAR_5, VAR_8, re, &VAR_0->gb, rl_vlc, TEX_VLC_BITS, 2);

        if (VAR_5==0) {

            int VAR_13;

            VAR_13= GET_CACHE(re, &VAR_0->gb);

            

            if (VAR_13&0x80000000) {

                if (VAR_13&0x40000000) {

                    

                    SKIP_CACHE(re, &VAR_0->gb, 2);

                    VAR_7=  SHOW_UBITS(re, &VAR_0->gb, 1); SKIP_CACHE(re, &VAR_0->gb, 1);

                    VAR_8=   SHOW_UBITS(re, &VAR_0->gb, 6); LAST_SKIP_CACHE(re, &VAR_0->gb, 6);

                    SKIP_COUNTER(re, &VAR_0->gb, 2+1+6);

                    UPDATE_CACHE(re, &VAR_0->gb);



                    if(SHOW_UBITS(re, &VAR_0->gb, 1)==0){

                        fprintf(stderr, "1. marker bit missing in 3. esc\VAR_2");

                        return -1;

                    }; SKIP_CACHE(re, &VAR_0->gb, 1);

                    

                    VAR_5= SHOW_SBITS(re, &VAR_0->gb, 12); SKIP_CACHE(re, &VAR_0->gb, 12);

 

                    if(SHOW_UBITS(re, &VAR_0->gb, 1)==0){

                        fprintf(stderr, "2. marker bit missing in 3. esc\VAR_2");

                        return -1;

                    }; LAST_SKIP_CACHE(re, &VAR_0->gb, 1);

                    

                    SKIP_COUNTER(re, &VAR_0->gb, 1+12+1);

                    

                    if(VAR_5*VAR_0->qscale>1024 || VAR_5*VAR_0->qscale<-1024){

                        fprintf(stderr, "|VAR_5| overflow in 3. esc, qp=%d\VAR_2", VAR_0->qscale);

                        return -1;

                    }

#if 1 

                    {

                        const int VAR_14= ABS(VAR_5);

                        if(VAR_14<=MAX_LEVEL && VAR_8<=MAX_RUN && ((VAR_0->workaround_bugs&FF_BUG_AC_VLC)==0)){

                            const int VAR_15= VAR_8 - rl->max_run[VAR_7][VAR_14] - 1;

                            if(VAR_14 <= rl->max_level[VAR_7][VAR_8]){

                                fprintf(stderr, "illegal 3. esc, vlc encoding possible\VAR_2");

                                return -1;

                            }

                            if(VAR_14 <= rl->max_level[VAR_7][VAR_8]*2){

                                fprintf(stderr, "illegal 3. esc, esc 1 encoding possible\VAR_2");

                                return -1;

                            }

                            if(VAR_15 >= 0 && VAR_14 <= rl->max_level[VAR_7][VAR_15]){

                                fprintf(stderr, "illegal 3. esc, esc 2 encoding possible\VAR_2");

                                return -1;

                            }

                        }

                    }

#endif

		    if (VAR_5>0) VAR_5= VAR_5 * VAR_11 + VAR_12;

                    else         VAR_5= VAR_5 * VAR_11 - VAR_12;



                    VAR_6+= VAR_8 + 1;

                    if(VAR_7) VAR_6+=192;

                } else {

                    

#if MIN_CACHE_BITS < 20

                    LAST_SKIP_BITS(re, &VAR_0->gb, 2);

                    UPDATE_CACHE(re, &VAR_0->gb);

#else

                    SKIP_BITS(re, &VAR_0->gb, 2);

#endif

                    GET_RL_VLC(VAR_5, VAR_8, re, &VAR_0->gb, rl_vlc, TEX_VLC_BITS, 2);

                    VAR_6+= VAR_8 + rl->max_run[VAR_8>>7][VAR_5/VAR_11] +1; 

                    VAR_5 = (VAR_5 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1);

                    LAST_SKIP_BITS(re, &VAR_0->gb, 1);

                }

            } else {

                

#if MIN_CACHE_BITS < 19

                LAST_SKIP_BITS(re, &VAR_0->gb, 1);

                UPDATE_CACHE(re, &VAR_0->gb);

#else

                SKIP_BITS(re, &VAR_0->gb, 1);

#endif

                GET_RL_VLC(VAR_5, VAR_8, re, &VAR_0->gb, rl_vlc, TEX_VLC_BITS, 2);

                VAR_6+= VAR_8;

                VAR_5 = VAR_5 + rl->max_level[VAR_8>>7][(VAR_8-1)&63] * VAR_11;

                VAR_5 = (VAR_5 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1);

                LAST_SKIP_BITS(re, &VAR_0->gb, 1);

            }

        } else {

            VAR_6+= VAR_8;

            VAR_5 = (VAR_5 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1);

            LAST_SKIP_BITS(re, &VAR_0->gb, 1);

        }

        if (VAR_6 > 62){

            VAR_6-= 192;

            if(VAR_6&(~63)){

                fprintf(stderr, "ac-tex damaged at %d %d\VAR_2", VAR_0->mb_x, VAR_0->mb_y);

                return -1;

            }



            VAR_1[VAR_10[VAR_6]] = VAR_5;

            break;

        }



        VAR_1[VAR_10[VAR_6]] = VAR_5;

    }

    CLOSE_READER(re, &VAR_0->gb);

  }

 not_coded:

    if (VAR_0->mb_intra) {

        mpeg4_pred_ac(VAR_0, VAR_1, VAR_2, VAR_9);

        if (VAR_0->ac_pred) {

            VAR_6 = 63; 

        }

    }

    VAR_0->block_last_index[VAR_2] = VAR_6;

    return 0;

}

static inline int FUNC_0(MpegEncContext * VAR_0, DCTELEM * VAR_1,
int VAR_2, int VAR_3, int VAR_4)
{ int VAR_5, VAR_6, VAR_7, VAR_8; int VAR_9; RLTable * rl; RL_VLC_ELEM * rl_vlc; const UINT8 * VAR_10; int VAR_11, VAR_12; if(VAR_4) { if(VAR_0->partitioned_frame){ VAR_5 = VAR_0->dc_val[0][ VAR_0->block_index[VAR_2] ]; if(VAR_2<4) VAR_5= (VAR_5 + (VAR_0->y_dc_scale>>1))/VAR_0->y_dc_scale; else    VAR_5= (VAR_5 + (VAR_0->c_dc_scale>>1))/VAR_0->c_dc_scale; VAR_9= (VAR_0->pred_dir_table[VAR_0->mb_x + VAR_0->mb_y*VAR_0->mb_width]<<VAR_2)&32; }else{ VAR_5 = mpeg4_decode_dc(VAR_0, VAR_2, &VAR_9); if (VAR_5 < 0)
return -1; } VAR_1[0] = VAR_5; VAR_6 = 0; if (!VAR_3)
goto not_coded; rl = &rl_intra; rl_vlc = rl_intra.rl_vlc[0]; if (VAR_0->ac_pred) { if (VAR_9 == 0)
VAR_10 = VAR_0->intra_v_scantable.permutated; else
VAR_10 = VAR_0->intra_h_scantable.permutated; } else { VAR_10 = VAR_0->intra_scantable.permutated; } VAR_11=1; VAR_12=0; } else { VAR_6 = -1; if (!VAR_3) { VAR_0->block_last_index[VAR_2] = VAR_6; return 0; } rl = &rl_inter; VAR_10 = VAR_0->intra_scantable.permutated; if(VAR_0->mpeg_quant){ VAR_11=1; VAR_12=0; rl_vlc = rl_inter.rl_vlc[0]; }else{ VAR_11 = VAR_0->qscale << 1; VAR_12 = (VAR_0->qscale - 1) | 1; rl_vlc = rl_inter.rl_vlc[VAR_0->qscale]; } } { OPEN_READER(re, &VAR_0->gb); for(;;) { UPDATE_CACHE(re, &VAR_0->gb); GET_RL_VLC(VAR_5, VAR_8, re, &VAR_0->gb, rl_vlc, TEX_VLC_BITS, 2); if (VAR_5==0) { int VAR_13; VAR_13= GET_CACHE(re, &VAR_0->gb); if (VAR_13&0x80000000) { if (VAR_13&0x40000000) { SKIP_CACHE(re, &VAR_0->gb, 2); VAR_7=  SHOW_UBITS(re, &VAR_0->gb, 1); SKIP_CACHE(re, &VAR_0->gb, 1); VAR_8=   SHOW_UBITS(re, &VAR_0->gb, 6); LAST_SKIP_CACHE(re, &VAR_0->gb, 6); SKIP_COUNTER(re, &VAR_0->gb, 2+1+6); UPDATE_CACHE(re, &VAR_0->gb); if(SHOW_UBITS(re, &VAR_0->gb, 1)==0){ fprintf(stderr, "1. marker bit missing in 3. esc\VAR_2"); return -1; }; SKIP_CACHE(re, &VAR_0->gb, 1); VAR_5= SHOW_SBITS(re, &VAR_0->gb, 12); SKIP_CACHE(re, &VAR_0->gb, 12); if(SHOW_UBITS(re, &VAR_0->gb, 1)==0){ fprintf(stderr, "2. marker bit missing in 3. esc\VAR_2"); return -1; }; LAST_SKIP_CACHE(re, &VAR_0->gb, 1); SKIP_COUNTER(re, &VAR_0->gb, 1+12+1); if(VAR_5*VAR_0->qscale>1024 || VAR_5*VAR_0->qscale<-1024){ fprintf(stderr, "|VAR_5| overflow in 3. esc, qp=%d\VAR_2", VAR_0->qscale); return -1; } #if 1
{ const int VAR_14= ABS(VAR_5); if(VAR_14<=MAX_LEVEL && VAR_8<=MAX_RUN && ((VAR_0->workaround_bugs&FF_BUG_AC_VLC)==0)){ const int VAR_15= VAR_8 - rl->max_run[VAR_7][VAR_14] - 1; if(VAR_14 <= rl->max_level[VAR_7][VAR_8]){ fprintf(stderr, "illegal 3. esc, vlc encoding possible\VAR_2"); return -1; } if(VAR_14 <= rl->max_level[VAR_7][VAR_8]*2){ fprintf(stderr, "illegal 3. esc, esc 1 encoding possible\VAR_2"); return -1; } if(VAR_15 >= 0 && VAR_14 <= rl->max_level[VAR_7][VAR_15]){ fprintf(stderr, "illegal 3. esc, esc 2 encoding possible\VAR_2"); return -1; } } } #endif
if (VAR_5>0) VAR_5= VAR_5 * VAR_11 + VAR_12; else         VAR_5= VAR_5 * VAR_11 - VAR_12; VAR_6+= VAR_8 + 1; if(VAR_7) VAR_6+=192; } else { #if MIN_CACHE_BITS < 20
LAST_SKIP_BITS(re, &VAR_0->gb, 2); UPDATE_CACHE(re, &VAR_0->gb); #else
SKIP_BITS(re, &VAR_0->gb, 2); #endif
GET_RL_VLC(VAR_5, VAR_8, re, &VAR_0->gb, rl_vlc, TEX_VLC_BITS, 2); VAR_6+= VAR_8 + rl->max_run[VAR_8>>7][VAR_5/VAR_11] +1; VAR_5 = (VAR_5 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1); LAST_SKIP_BITS(re, &VAR_0->gb, 1); } } else { #if MIN_CACHE_BITS < 19
LAST_SKIP_BITS(re, &VAR_0->gb, 1); UPDATE_CACHE(re, &VAR_0->gb); #else
SKIP_BITS(re, &VAR_0->gb, 1); #endif
GET_RL_VLC(VAR_5, VAR_8, re, &VAR_0->gb, rl_vlc, TEX_VLC_BITS, 2); VAR_6+= VAR_8; VAR_5 = VAR_5 + rl->max_level[VAR_8>>7][(VAR_8-1)&63] * VAR_11; VAR_5 = (VAR_5 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1); LAST_SKIP_BITS(re, &VAR_0->gb, 1); } } else { VAR_6+= VAR_8; VAR_5 = (VAR_5 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1); LAST_SKIP_BITS(re, &VAR_0->gb, 1); } if (VAR_6 > 62){ VAR_6-= 192; if(VAR_6&(~63)){ fprintf(stderr, "ac-tex damaged at %d %d\VAR_2", VAR_0->mb_x, VAR_0->mb_y); return -1; } VAR_1[VAR_10[VAR_6]] = VAR_5; break; } VAR_1[VAR_10[VAR_6]] = VAR_5; } CLOSE_READER(re, &VAR_0->gb); } not_coded:
if (VAR_0->mb_intra) { mpeg4_pred_ac(VAR_0, VAR_1, VAR_2, VAR_9); if (VAR_0->ac_pred) { VAR_6 = 63; } } VAR_0->block_last_index[VAR_2] = VAR_6; return 0; }