static av_always_inline void dv_set_class_number(DCTELEM* blk, EncBlockInfo* bi,
                                              const uint8_t* zigzag_scan, const int *weight, int bias)
{
    int i, area;
#if 0
    static const int classes[] = {12, 24, 36, 0xffff};
#else
    static const int classes[] = {-1, -1, 255, 0xffff};
#endif
    int max=classes[0];
    int prev=0;
    bi->mb[0] = blk[0];
    for (area = 0; area < 4; area++) {
       bi->prev[area] = prev;
       bi->bit_size[area] = 1;
       for (i=mb_area_start[area]; i<mb_area_start[area+1]; i++) {
          int level = blk[zigzag_scan[i]];
          if (level+15 > 30U) {
              bi->sign[i] = (level>>31)&1;
              level = (FFABS(level) * weight[i] + (1<<(dv_weight_bits+3))) >> (dv_weight_bits+4);
              bi->mb[i] = level;
              if(level>max) max= level;
              bi->bit_size[area] += dv_rl2vlc_size(i - prev  - 1, level);
              bi->next[prev]= i;
              prev= i;
          }
       }
    }
    bi->next[prev]= i;
    for(bi->cno = 0; max > classes[bi->cno]; bi->cno++);
    bi->cno += bias;
    if (bi->cno >= 3) {
        bi->cno = 3;
        prev=0;
        i= bi->next[prev];
        for (area = 0; area < 4; area++) {
            bi->prev[area] = prev;
            bi->bit_size[area] = 1;
            for (; i<mb_area_start[area+1]; i= bi->next[i]) {
                bi->mb[i] >>=1;
                if (bi->mb[i]) {
                    bi->bit_size[area] += dv_rl2vlc_size(i - prev - 1, bi->mb[i]);
                    bi->next[prev]= i;
                    prev= i;
                }
            }
        }
        bi->next[prev]= i;
    }
}
['static av_always_inline void dv_set_class_number(DCTELEM* blk, EncBlockInfo* bi,\n                                              const uint8_t* zigzag_scan, const int *weight, int bias)\n{\n    int i, area;\n#if 0\n    static const int classes[] = {12, 24, 36, 0xffff};\n#else\n    static const int classes[] = {-1, -1, 255, 0xffff};\n#endif\n    int max=classes[0];\n    int prev=0;\n    bi->mb[0] = blk[0];\n    for (area = 0; area < 4; area++) {\n       bi->prev[area] = prev;\n       bi->bit_size[area] = 1;\n       for (i=mb_area_start[area]; i<mb_area_start[area+1]; i++) {\n          int level = blk[zigzag_scan[i]];\n          if (level+15 > 30U) {\n              bi->sign[i] = (level>>31)&1;\n              level = (FFABS(level) * weight[i] + (1<<(dv_weight_bits+3))) >> (dv_weight_bits+4);\n              bi->mb[i] = level;\n              if(level>max) max= level;\n              bi->bit_size[area] += dv_rl2vlc_size(i - prev  - 1, level);\n              bi->next[prev]= i;\n              prev= i;\n          }\n       }\n    }\n    bi->next[prev]= i;\n    for(bi->cno = 0; max > classes[bi->cno]; bi->cno++);\n    bi->cno += bias;\n    if (bi->cno >= 3) {\n        bi->cno = 3;\n        prev=0;\n        i= bi->next[prev];\n        for (area = 0; area < 4; area++) {\n            bi->prev[area] = prev;\n            bi->bit_size[area] = 1;\n            for (; i<mb_area_start[area+1]; i= bi->next[i]) {\n                bi->mb[i] >>=1;\n                if (bi->mb[i]) {\n                    bi->bit_size[area] += dv_rl2vlc_size(i - prev - 1, bi->mb[i]);\n                    bi->next[prev]= i;\n                    prev= i;\n                }\n            }\n        }\n        bi->next[prev]= i;\n    }\n}']