Make multiplier scaling layer depth dependent

Make the Lagrangian multiplier scaling factor depend on the layer
depth. The coding performance changes in speed 1 vbr:

          avg PSNR     overall PSNR     SSIM
lowres    0.071	         0.334	       -0.770
lowres2  -0.164	         0.020	       -0.948
midres   -0.165	        -0.072	       -1.012
midres2  -0.329	        -0.225	       -1.167

STATS_CHANGED

Change-Id: I5592b2aaf77ee9b25f35f2ba9a78d5936b6b5dc7
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c
index dc6cb13..14fc97a 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -349,9 +349,9 @@
 
 static const int rd_boost_factor[16] = { 64, 32, 32, 32, 24, 16, 12, 12,
                                          8,  8,  4,  4,  2,  2,  1,  0 };
-static const int rd_frame_type_factor[FRAME_UPDATE_TYPES] = { 128, 144, 128,
-                                                              128, 144, 144,
-                                                              128 };
+static const int rd_layer_depth_factor[6] = {
+  128, 128, 144, 160, 160, 180,
+};
 
 int av1_compute_rd_mult_based_on_qindex(const AV1_COMP *cpi, int qindex) {
   const int q = av1_dc_quant_QTX(qindex, 0, cpi->common.seq_params.bit_depth);
@@ -373,10 +373,10 @@
   if (is_stat_consumption_stage(cpi) &&
       (cpi->common.current_frame.frame_type != KEY_FRAME)) {
     const GF_GROUP *const gf_group = &cpi->gf_group;
-    const FRAME_UPDATE_TYPE frame_type = gf_group->update_type[gf_group->index];
     const int boost_index = AOMMIN(15, (cpi->rc.gfu_boost / 100));
+    const int layer_depth = AOMMIN(gf_group->layer_depth[gf_group->index], 5);
 
-    rdmult = (rdmult * rd_frame_type_factor[frame_type]) >> 7;
+    rdmult = (rdmult * rd_layer_depth_factor[layer_depth]) >> 7;
     rdmult += ((rdmult * rd_boost_factor[boost_index]) >> 7);
   }
   return (int)rdmult;
@@ -422,10 +422,11 @@
   if (is_stat_consumption_stage(cpi) &&
       (cm->current_frame.frame_type != KEY_FRAME)) {
     const GF_GROUP *const gf_group = &cpi->gf_group;
-    const FRAME_UPDATE_TYPE frame_type = gf_group->update_type[gf_group->index];
     const int boost_index = AOMMIN(15, (cpi->rc.gfu_boost / 100));
 
-    rdmult = (rdmult * rd_frame_type_factor[frame_type]) >> 7;
+    const int layer_depth = AOMMIN(gf_group->layer_depth[gf_group->index], 5);
+    rdmult = (rdmult * rd_layer_depth_factor[layer_depth]) >> 7;
+
     rdmult += ((rdmult * rd_boost_factor[boost_index]) >> 7);
   }
   if (rdmult < 1) rdmult = 1;
diff --git a/test/horz_superres_test.cc b/test/horz_superres_test.cc
index 451555e..4b96d44 100644
--- a/test/horz_superres_test.cc
+++ b/test/horz_superres_test.cc
@@ -51,7 +51,7 @@
 }
 
 const TestVideoParam kTestVideoVectors[] = {
-  { "park_joy_90p_8_420.y4m", AOM_IMG_FMT_I420, AOM_BITS_8, 0, 5, 0, 25.5 },
+  { "park_joy_90p_8_420.y4m", AOM_IMG_FMT_I420, AOM_BITS_8, 0, 5, 0, 12.5 },
 #if CONFIG_AV1_HIGHBITDEPTH
   { "park_joy_90p_10_444.y4m", AOM_IMG_FMT_I44416, AOM_BITS_10, 1, 5, 0,
     27.84 },