j = zigzag_direct[i];
j = s->intra_scantable.permutated[i];
static void mpeg1_encode_block(MpegEncContext *s,                                DCTELEM *block,                                int n){    int alevel, level, last_non_zero, dc, diff, i, j, run, last_index, sign;    int code, component;//    RLTable *rl = &rl_mpeg1;    last_index = s->block_last_index[n];    /* DC coef */    if (s->mb_intra) {        component = (n <= 3 ? 0 : n - 4 + 1);        dc = block[0]; /* overflow is impossible */        diff = dc - s->last_dc[component];        encode_dc(s, diff, component);        s->last_dc[component] = dc;        i = 1;    } else {        /* encode the first coefficient : needs to be done here because           it is handled slightly differently */        level = block[0];        if (abs(level) == 1) {                code = ((UINT32)level >> 31); /* the sign bit */                put_bits(&s->pb, 2, code | 0x02);                i = 1;        } else {            i = 0;            last_non_zero = -1;            goto next_coef;        }    }    /* now quantify & encode AC coefs */    last_non_zero = i - 1;    for(;i<=last_index;i++) {        j = zigzag_direct[i];        level = block[j];    next_coef:#if 0        if (level != 0)            dprintf("level[%d]=%d\n", i, level);#endif                    /* encode using VLC */        if (level != 0) {            run = i - last_non_zero - 1;#ifdef ARCH_X86            asm volatile(		"movl %2, %1		\n\t"		"movl %1, %0		\n\t"		"addl %1, %1		\n\t"		"sbbl %1, %1		\n\t"		"xorl %1, %0		\n\t"		"subl %1, %0		\n\t"		"andl $1, %1		\n\t"		: "=&r" (alevel), "=&r" (sign)		: "g" (level)	    );#else            sign = 0;            alevel = level;            if (alevel < 0) {		sign = 1;                alevel = -alevel;	    }#endif//            code = get_rl_index(rl, 0, run, alevel);            if (alevel > mpeg1_max_level[0][run])                code= 111; /*rl->n*/            else                code= mpeg1_index_run[0][run] + alevel - 1;            if (code < 111 /* rl->n */) {	    	/* store the vlc & sign at once */                put_bits(&s->pb, mpeg1_vlc[code][1]+1, (mpeg1_vlc[code][0]<<1) + sign);            } else {		/* escape seems to be pretty rare <5% so i dont optimize it */                put_bits(&s->pb, mpeg1_vlc[111/*rl->n*/][1], mpeg1_vlc[111/*rl->n*/][0]);                /* escape: only clip in this case */                put_bits(&s->pb, 6, run);                if (alevel < 128) {                    put_bits(&s->pb, 8, level & 0xff);                } else {                    if (level < 0) {                        put_bits(&s->pb, 16, 0x8001 + level + 255);                    } else {                        put_bits(&s->pb, 16, level & 0xffff);                    }                }            }            last_non_zero = i;        }    }    /* end of block */    put_bits(&s->pb, 2, 0x2);}