]> granicus.if.org Git - libvpx/commitdiff
Changes to rd error_per_bit calculation.
authorPaul Wilkins <paulwilkins@google.com>
Thu, 7 Mar 2013 15:02:57 +0000 (15:02 +0000)
committerPaul Wilkins <paulwilkins@google.com>
Mon, 18 Mar 2013 23:07:51 +0000 (23:07 +0000)
Specifically changes to retain more precision
especially at low Q through to the point of use.

Change-Id: Ief5f010f2ca4daaabef49520e7edb46c35daf397

vp9/encoder/vp9_mcomp.c
vp9/encoder/vp9_rdopt.c

index 5fd1e83cdd9c6058e6667ccd51cc04e0bcecdde0..e642b7487b3218a39a2e180e5c9999b5f8bfdbd6 100644 (file)
@@ -68,7 +68,7 @@ static int mv_err_cost(int_mv *mv, int_mv *ref, int *mvjcost, int *mvcost[2],
     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 @@ void vp9_init3smotion_compensation(MACROBLOCK *x, int stride) {
     (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
index a8ea3956e60e85b060f75f8ea444e7339f7f7d21..ff2f2f5c56f05e1d3776616caf8d509fd33588c7 100644 (file)
@@ -254,7 +254,7 @@ void vp9_init_me_luts() {
 
 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 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi, int qindex) {
   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,16 +282,13 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi, int qindex) {
       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);
 
   q = (int)pow(vp9_dc_quant(qindex, 0) >> 2, 1.25);
   q <<= 2;
-  cpi->RDMULT = cpi->RDMULT << 4;
-
   if (q < 8)
     q = 8;