ref: d8ffee45269b33ca4dda47472e909afc44fcc3fe
parent: a5b54d73e43186f676b4bbbe960aaa8eea250911
author: Paul Wilkins <paulwilkins@google.com>
date: Thu Mar 7 10:02:57 EST 2013
Changes to rd error_per_bit calculation. Specifically changes to retain more precision especially at low Q through to the point of use. Change-Id: Ief5f010f2ca4daaabef49520e7edb46c35daf397
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -68,7 +68,7 @@
v.col = mv->as_mv.col - ref->as_mv.col;
return ((mvjcost[vp9_get_mv_joint(v)] +
mvcost[0][v.row] + mvcost[1][v.col]) *
- error_per_bit + 128) >> 8;
+ error_per_bit + 4096) >> 13;
}
return 0;
}
@@ -205,7 +205,8 @@
(mvcost ? \
((mvjcost[((r) != rr) * 2 + ((c) != rc)] + \
mvcost[0][((r) - rr)] + mvcost[1][((c) - rc)]) * \
- error_per_bit + 128) >> 8 : 0)
+ error_per_bit + 4096) >> 13 : 0)
+
#define SP(x) (((x) & 7) << 1) // convert motion vector component to offset
// for svf calc
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -254,7 +254,7 @@
static int compute_rd_mult(int qindex) {
int q = vp9_dc_quant(qindex, 0);
- return (11 * q * q) >> 6;
+ return (11 * q * q) >> 2;
}
void vp9_initialize_me_consts(VP9_COMP *cpi, int qindex) {
@@ -275,7 +275,6 @@
qindex = (qindex < 0) ? 0 : ((qindex > MAXQ) ? MAXQ : qindex);
cpi->RDMULT = compute_rd_mult(qindex);
-
if (cpi->pass == 2 && (cpi->common.frame_type != KEY_FRAME)) {
if (cpi->twopass.next_iiratio > 31)
cpi->RDMULT += (cpi->RDMULT * rd_iifactor[31]) >> 4;
@@ -283,8 +282,7 @@
cpi->RDMULT +=
(cpi->RDMULT * rd_iifactor[cpi->twopass.next_iiratio]) >> 4;
}
-
- cpi->mb.errorperbit = (cpi->RDMULT / 110);
+ cpi->mb.errorperbit = cpi->RDMULT >> 6;
cpi->mb.errorperbit += (cpi->mb.errorperbit == 0);
vp9_set_speed_features(cpi);
@@ -291,8 +289,6 @@
q = (int)pow(vp9_dc_quant(qindex, 0) >> 2, 1.25);
q <<= 2;
- cpi->RDMULT = cpi->RDMULT << 4;
-
if (q < 8)
q = 8;
--
⑨