Reduce txb optimize route
When a coefficient is quantized to a level below its original
value in magnitude, lowering its level would be less likely to
reduce rate-distortion cost. This commit hence drops such
computation flow to check the lower level rate distortion costs.
Tested on bus_qcif 500 kbps 30 frames. The speed 1 performance goes
from 27596 b/f 42.889 dB 441 s -> 27635 b/f 42.913 dB 398 s.
For city_qcif 500 kbps 30 frames, the speed 1 performance goes from
31845 b/f 49.630 dB 622 s -> 31844 b/f 49.633 dB 609 s.
The overall compression performance for lowres is improved by
0.048%.
STATS_CHANGED
Change-Id: I2fa2bfd9ad39e44d7a2b99b5875267c5f73a178b
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index 10c74a8..c5dab75 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -1300,9 +1300,13 @@
const tran_low_t abs_qc = abs(qc);
const tran_low_t tqc = tcoeff[ci];
const tran_low_t dqc = dqcoeff[ci];
- const int64_t dist = get_coeff_dist(tqc, dqc, shift);
const int rate = get_coeff_cost_simple(ci, abs_qc, coeff_ctx, txb_costs,
bwl, tx_class, levels);
+ if (abs(dqc) < abs(tqc)) {
+ *accu_rate += rate;
+ return;
+ }
+ const int64_t dist = get_coeff_dist(tqc, dqc, shift);
const int64_t rd = RDCOST(rdmult, rate, dist);
const int sign = (qc < 0) ? 1 : 0;