diff --git a/vp10/encoder/encodemb.c b/vp10/encoder/encodemb.c index aa8b402ccc5866f54be82c0e09c4c62b516f1960..46ee48dbe781e09f0e2f1fa63df6c4e3185e50b7 100644 --- a/vp10/encoder/encodemb.c +++ b/vp10/encoder/encodemb.c @@ -89,12 +89,13 @@ int vp10_optimize_b(MACROBLOCK *mb, int plane, int block, get_scan(tx_size, tx_type, is_inter_block(&xd->mi[0]->mbmi)); const int16_t* const scan = so->scan; const int16_t* const nb = so->neighbors; + const int shift = get_tx_scale(xd, tx_type, tx_size); #if CONFIG_NEW_QUANT int dq = get_dq_profile_from_ctx(ctx); const dequant_val_type_nuq *dequant_val = pd->dequant_val_nuq[dq]; -#endif // CONFIG_NEW_QUANT - const int shift = get_tx_scale(xd, tx_type, tx_size); +#else const int dq_step[2] = { dequant_ptr[0] >> shift, dequant_ptr[1] >> shift }; +#endif // CONFIG_NEW_QUANT int next = eob, sz = 0; const int64_t rdmult = (mb->rdmult * plane_rd_mult[ref][type]) >> 1; const int64_t rddiv = mb->rddiv; @@ -296,6 +297,14 @@ int vp10_optimize_b(MACROBLOCK *mb, int plane, int block, tokens[i][1].qc = x; if (x) { +#if CONFIG_NEW_QUANT + tokens[i][1].dqc = vp10_dequant_abscoeff_nuq( + abs(x), dequant_ptr[rc != 0], dequant_val[band_translate[i]]); + tokens[i][1].dqc = shift ? + ROUND_POWER_OF_TWO(tokens[i][1].dqc, shift) : tokens[i][1].dqc; + if (sz) + tokens[i][1].dqc = -tokens[i][1].dqc; +#else tran_low_t offset = dq_step[rc != 0]; // The 32x32 transform coefficient uses half quantization step size. // Account for the rounding difference in the dequantized coefficeint @@ -308,6 +317,7 @@ int vp10_optimize_b(MACROBLOCK *mb, int plane, int block, tokens[i][1].dqc = dqcoeff[rc] - offset; else tokens[i][1].dqc = dqcoeff[rc] + offset; +#endif // CONFIG_NEW_QUANT } else { tokens[i][1].dqc = 0; } @@ -365,13 +375,6 @@ int vp10_optimize_b(MACROBLOCK *mb, int plane, int block, qcoeff[rc] = x; dqcoeff[rc] = tokens[i][best].dqc; -#if CONFIG_NEW_QUANT - dqcoeff[rc] = vp10_dequant_abscoeff_nuq(abs(x), dequant_ptr[rc != 0], - dequant_val[band_translate[i]]); - if (shift) dqcoeff[rc] = ROUND_POWER_OF_TWO(dqcoeff[rc], shift); - if (x < 0) dqcoeff[rc] = -dqcoeff[rc]; -#endif // CONFIG_NEW_QUANT - next = tokens[i][best].next; best = best_index[i][best]; }