/* Returns the number of bits that encoding the 8x8 block in block would need.  */
static int get_block_rate(MpegEncContext *s, DCTELEM block[64], int block_last_index, uint8_t scantable[64])
/* Returns the number of bits that encoding the 8x8 block in block would need.  */
static int get_block_rate(MpegEncContext *s, DCTELEM block[64], int block_last_index, uint8_t scantable[64])
{
        const int index= scantable[j];
        int level= block[index];
        if(level){
            level+= 64;
            if((level&(~127)) == 0){
                if(j<block_last_index) rate+= s->intra_ac_vlc_length     [UNI_AC_ENC_INDEX(j-last-1, level)];
                else                   rate+= s->intra_ac_vlc_last_length[UNI_AC_ENC_INDEX(j-last-1, level)];
            }else
                rate += s->ac_esc_length;
            last= j;
        }
    }
    return rate;
}