int last, i, last_non_zero, sign; int code;
int i, last_non_zero; #if 0 int code, sign, last; #endif
static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n, int intra_dc,                                UINT8 *scan_table, PutBitContext *dc_pb, PutBitContext *ac_pb){    int last, i, last_non_zero, sign;    int code;    const RLTable *rl;    UINT32 *bits_tab;    UINT8 *len_tab;    const int last_index = s->block_last_index[n];    if (s->mb_intra) { //Note gcc (3.2.1 at least) will optimize this away	/* mpeg4 based DC predictor */	mpeg4_encode_dc(dc_pb, intra_dc, n);        if(last_index<1) return;	i = 1;        rl = &rl_intra;        bits_tab= uni_mpeg4_intra_rl_bits;        len_tab = uni_mpeg4_intra_rl_len;    } else {        if(last_index<0) return;	i = 0;        rl = &rl_inter;        bits_tab= uni_mpeg4_inter_rl_bits;        len_tab = uni_mpeg4_inter_rl_len;    }    /* AC coefs */    last_non_zero = i - 1;#if 1    for (; i < last_index; i++) {	int level = block[ scan_table[i] ];	if (level) {	    int run = i - last_non_zero - 1;            level+=64;            if((level&(~127)) == 0){                const int index= UNI_MPEG4_ENC_INDEX(0, run, level);                put_bits(ac_pb, len_tab[index], bits_tab[index]);            }else{ //ESC3                put_bits(ac_pb, 7+2+1+6+1+12+1, (3<<23)+(3<<21)+(0<<20)+(run<<14)+(1<<13)+(((level-64)&0xfff)<<1)+1);            }	    last_non_zero = i;	}    }    /*if(i<=last_index)*/{	int level = block[ scan_table[i] ];        int run = i - last_non_zero - 1;        level+=64;        if((level&(~127)) == 0){            const int index= UNI_MPEG4_ENC_INDEX(1, run, level);            put_bits(ac_pb, len_tab[index], bits_tab[index]);        }else{ //ESC3            put_bits(ac_pb, 7+2+1+6+1+12+1, (3<<23)+(3<<21)+(1<<20)+(run<<14)+(1<<13)+(((level-64)&0xfff)<<1)+1);        }    }#else    for (; i <= last_index; i++) {	const int slevel = block[ scan_table[i] ];	if (slevel) {            int level;	    int run = i - last_non_zero - 1;	    last = (i == last_index);	    sign = 0;	    level = slevel;	    if (level < 0) {		sign = 1;		level = -level;	    }            code = get_rl_index(rl, last, run, level);            put_bits(ac_pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);            if (code == rl->n) {                int level1, run1;                level1 = level - rl->max_level[last][run];                if (level1 < 1)                     goto esc2;                code = get_rl_index(rl, last, run, level1);                if (code == rl->n) {                esc2:                    put_bits(ac_pb, 1, 1);                    if (level > MAX_LEVEL)                        goto esc3;                    run1 = run - rl->max_run[last][level] - 1;                    if (run1 < 0)                        goto esc3;                    code = get_rl_index(rl, last, run1, level);                    if (code == rl->n) {                    esc3:                        /* third escape */                        put_bits(ac_pb, 1, 1);                        put_bits(ac_pb, 1, last);                        put_bits(ac_pb, 6, run);                        put_bits(ac_pb, 1, 1);                        put_bits(ac_pb, 12, slevel & 0xfff);                        put_bits(ac_pb, 1, 1);                    } else {                        /* second escape */                        put_bits(ac_pb, 1, 0);                        put_bits(ac_pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);                        put_bits(ac_pb, 1, sign);                    }                } else {                    /* first escape */                    put_bits(ac_pb, 1, 0);                    put_bits(ac_pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);                    put_bits(ac_pb, 1, sign);                }            } else {                put_bits(ac_pb, 1, sign);            }	    last_non_zero = i;	}    }#endif}