static always_inline void dv_set_class_number(DCTELEM* blk, EncBlockInfo* bi, 

                                              const uint8_t* zigzag_scan, int bias)

{

    int i, area;

    int run;

    int classes[] = {12, 24, 36, 0xffff};



    run = 0;

    bi->mb[0] = blk[0]; 

    bi->cno = 0;

    for (area = 0; area < 4; area++) {

       bi->prev_run[area] = run;

       bi->bit_size[area] = 0;

       for (i=mb_area_start[area]; i<mb_area_start[area+1]; i++) {

          bi->mb[i] = (blk[zigzag_scan[i]] / 16);

          while ((bi->mb[i] ^ (bi->mb[i] >> 8)) > classes[bi->cno])

              bi->cno++;

       

          if (bi->mb[i]) {

              bi->bit_size[area] += dv_rl2vlc_size(run, bi->mb[i]);

	      run = 0;

          } else

              ++run;

       }

    }

    bi->bit_size[3] += 4; /* EOB marker */

    bi->cno += bias;

    

    if (bi->cno >= 3) { /* FIXME: we have to recreate bit_size[], prev_run[] */

        bi->cno = 3;

	for (i=1; i<64; i++)

	   bi->mb[i] /= 2;

    }

}

static always_inline void dv_set_class_number(DCTELEM* blk, EncBlockInfo* bi, 

                                              const uint8_t* zigzag_scan, int bias)

{

    int i, area;

    int run;

    int classes[] = {12, 24, 36, 0xffff};



    run = 0;

    bi->mb[0] = blk[0]; 

    bi->cno = 0;

    for (area = 0; area < 4; area++) {

       bi->prev_run[area] = run;

       bi->bit_size[area] = 0;

       for (i=mb_area_start[area]; i<mb_area_start[area+1]; i++) {

          bi->mb[i] = (blk[zigzag_scan[i]] / 16);

          while ((bi->mb[i] ^ (bi->mb[i] >> 8)) > classes[bi->cno])

              bi->cno++;

       

          if (bi->mb[i]) {

              bi->bit_size[area] += dv_rl2vlc_size(run, bi->mb[i]);

	      run = 0;

          } else

              ++run;

       }

    }

    bi->bit_size[3] += 4; 

    bi->cno += bias;

    

    if (bi->cno >= 3) { 

        bi->cno = 3;

	for (i=1; i<64; i++)

	   bi->mb[i] /= 2;

    }

}

static always_inline void FUNC_0(DCTELEM* blk, EncBlockInfo* bi, 

                                              const uint8_t* zigzag_scan, int bias)

{

    int VAR_0, VAR_1;

    int VAR_2;

    int VAR_3[] = {12, 24, 36, 0xffff};



    VAR_2 = 0;

    bi->mb[0] = blk[0]; 

    bi->cno = 0;

    for (VAR_1 = 0; VAR_1 < 4; VAR_1++) {

       bi->prev_run[VAR_1] = VAR_2;

       bi->bit_size[VAR_1] = 0;

       for (VAR_0=mb_area_start[VAR_1]; VAR_0<mb_area_start[VAR_1+1]; VAR_0++) {

          bi->mb[VAR_0] = (blk[zigzag_scan[VAR_0]] / 16);

          while ((bi->mb[VAR_0] ^ (bi->mb[VAR_0] >> 8)) > VAR_3[bi->cno])

              bi->cno++;

       

          if (bi->mb[VAR_0]) {

              bi->bit_size[VAR_1] += dv_rl2vlc_size(VAR_2, bi->mb[VAR_0]);

	      VAR_2 = 0;

          } else

              ++VAR_2;

       }

    }

    bi->bit_size[3] += 4; 

    bi->cno += bias;

    

    if (bi->cno >= 3) { 

        bi->cno = 3;

	for (VAR_0=1; VAR_0<64; VAR_0++)

	   bi->mb[VAR_0] /= 2;

    }

}

static always_inline void FUNC_0(DCTELEM* blk, EncBlockInfo* bi,
const uint8_t* zigzag_scan, int bias)
{ int VAR_0, VAR_1; int VAR_2; int VAR_3[] = {12, 24, 36, 0xffff}; VAR_2 = 0; bi->mb[0] = blk[0]; bi->cno = 0; for (VAR_1 = 0; VAR_1 < 4; VAR_1++) { bi->prev_run[VAR_1] = VAR_2; bi->bit_size[VAR_1] = 0; for (VAR_0=mb_area_start[VAR_1]; VAR_0<mb_area_start[VAR_1+1]; VAR_0++) { bi->mb[VAR_0] = (blk[zigzag_scan[VAR_0]] / 16); while ((bi->mb[VAR_0] ^ (bi->mb[VAR_0] >> 8)) > VAR_3[bi->cno])
bi->cno++; if (bi->mb[VAR_0]) { bi->bit_size[VAR_1] += dv_rl2vlc_size(VAR_2, bi->mb[VAR_0]); VAR_2 = 0; } else ++VAR_2; } } bi->bit_size[3] += 4; bi->cno += bias; if (bi->cno >= 3) { bi->cno = 3; for (VAR_0=1; VAR_0<64; VAR_0++) bi->mb[VAR_0] /= 2; } }