static inline int dequant(AVSContext *h, DCTELEM *level_buf, uint8_t *run_buf,
                          DCTELEM *dst, int mul, int shift, int coeff_num) {
    int round = 1 << (shift - 1);
    int pos = -1;
    const uint8_t *scantab = h->scantable.permutated;
    while(--coeff_num >= 0){
        pos += run_buf[coeff_num];
        if(pos > 63) {
            av_log(h->s.avctx, AV_LOG_ERROR,
                "position out of block bounds at pic %d MB(%d,%d)\n",
                h->picture.poc, h->mbx, h->mby);
            return -1;
        }
        dst[scantab[pos]] = (level_buf[coeff_num]*mul + round) >> shift;
    }
    return 0;
}
['static int decode_residual_block(AVSContext *h, GetBitContext *gb,\n                                 const dec_2dvlc_t *r, int esc_golomb_order,\n                                 int qp, uint8_t *dst, int stride) {\n    int i, level_code, esc_code, level, run, mask;\n    DCTELEM level_buf[64];\n    uint8_t run_buf[64];\n    DCTELEM *block = h->block;\n    for(i=0;i<65;i++) {\n        level_code = get_ue_code(gb,r->golomb_order);\n        if(level_code >= ESCAPE_CODE) {\n            run = ((level_code - ESCAPE_CODE) >> 1) + 1;\n            esc_code = get_ue_code(gb,esc_golomb_order);\n            level = esc_code + (run > r->max_run ? 1 : r->level_add[run]);\n            while(level > r->inc_limit)\n                r++;\n            mask = -(level_code & 1);\n            level = (level^mask) - mask;\n        } else {\n            level = r->rltab[level_code][0];\n            if(!level)\n                break;\n            run   = r->rltab[level_code][1];\n            r += r->rltab[level_code][2];\n        }\n        level_buf[i] = level;\n        run_buf[i] = run;\n    }\n    if(dequant(h,level_buf, run_buf, block, ff_cavs_dequant_mul[qp],\n               ff_cavs_dequant_shift[qp], i))\n        return -1;\n    h->s.dsp.cavs_idct8_add(dst,block,stride);\n    return 0;\n}', 'static inline int dequant(AVSContext *h, DCTELEM *level_buf, uint8_t *run_buf,\n                          DCTELEM *dst, int mul, int shift, int coeff_num) {\n    int round = 1 << (shift - 1);\n    int pos = -1;\n    const uint8_t *scantab = h->scantable.permutated;\n    while(--coeff_num >= 0){\n        pos += run_buf[coeff_num];\n        if(pos > 63) {\n            av_log(h->s.avctx, AV_LOG_ERROR,\n                "position out of block bounds at pic %d MB(%d,%d)\\n",\n                h->picture.poc, h->mbx, h->mby);\n            return -1;\n        }\n        dst[scantab[pos]] = (level_buf[coeff_num]*mul + round) >> shift;\n    }\n    return 0;\n}']