Merge "Reduce the number of frames used in lossless test"
diff --git a/vp8/common/postproc.c b/vp8/common/postproc.c
index dd998f1..e3bee32 100644
--- a/vp8/common/postproc.c
+++ b/vp8/common/postproc.c
@@ -71,11 +71,6 @@
 };
 #endif
 
-static const short kernel5[] =
-{
-    1, 1, 4, 1, 1
-};
-
 const short vp8_rv[] =
 {
     8, 5, 2, 2, 8, 12, 4, 9, 8, 3,
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index 881ada1..de57c32 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -4621,45 +4621,43 @@
         vp8_clear_system_state();
 
         if (cpi->twopass.total_left_stats.coded_error != 0.0)
-            fprintf(f, "%10d %10d %10d %10d %10d %10d %10d %10d %10d %6d %6d"
-                       "%6d %6d %6d %5d %5d %5d %8d %8.2f %10d %10.3f"
-                       "%10.3f %8d\n",
+            fprintf(f, "%10d %10d %10d %10d %10d %10"PRId64" %10"PRId64
+                       "%10"PRId64" %10d %6d %6d %6d %6d %5d %5d %5d %8d "
+                       "%8.2lf %"PRId64" %10.3lf %10"PRId64" %8d\n",
                        cpi->common.current_video_frame, cpi->this_frame_target,
                        cpi->projected_frame_size,
                        (cpi->projected_frame_size - cpi->this_frame_target),
-                       (int)cpi->total_target_vs_actual,
+                       cpi->total_target_vs_actual,
                        cpi->buffer_level,
                        (cpi->oxcf.starting_buffer_level-cpi->bits_off_target),
-                       (int)cpi->total_actual_bits, cm->base_qindex,
+                       cpi->total_actual_bits, cm->base_qindex,
                        cpi->active_best_quality, cpi->active_worst_quality,
                        cpi->ni_av_qi, cpi->cq_target_quality,
-                       cpi->zbin_over_quant,
                        cm->refresh_golden_frame, cm->refresh_alt_ref_frame,
                        cm->frame_type, cpi->gfu_boost,
                        cpi->twopass.est_max_qcorrection_factor,
-                       (int)cpi->twopass.bits_left,
+                       cpi->twopass.bits_left,
                        cpi->twopass.total_left_stats.coded_error,
                        (double)cpi->twopass.bits_left /
                            cpi->twopass.total_left_stats.coded_error,
                        cpi->tot_recode_hits);
         else
-            fprintf(f, "%10d %10d %10d %10d %10d %10d %10d %10d %10d %6d %6d"
-                       "%6d %6d %6d %5d %5d %5d %8d %8.2f %10d %10.3f"
-                       "%8d\n",
-                       cpi->common.current_video_frame,
-                       cpi->this_frame_target, cpi->projected_frame_size,
+            fprintf(f, "%10d %10d %10d %10d %10d %10"PRId64" %10"PRId64
+                       "%10"PRId64" %10d %6d %6d %6d %6d %5d %5d %5d %8d "
+                       "%8.2lf %"PRId64" %10.3lf %8d\n",
+                       cpi->common.current_video_frame, cpi->this_frame_target,
+                       cpi->projected_frame_size,
                        (cpi->projected_frame_size - cpi->this_frame_target),
-                       (int)cpi->total_target_vs_actual,
+                       cpi->total_target_vs_actual,
                        cpi->buffer_level,
                        (cpi->oxcf.starting_buffer_level-cpi->bits_off_target),
-                       (int)cpi->total_actual_bits, cm->base_qindex,
+                       cpi->total_actual_bits, cm->base_qindex,
                        cpi->active_best_quality, cpi->active_worst_quality,
                        cpi->ni_av_qi, cpi->cq_target_quality,
-                       cpi->zbin_over_quant,
                        cm->refresh_golden_frame, cm->refresh_alt_ref_frame,
                        cm->frame_type, cpi->gfu_boost,
                        cpi->twopass.est_max_qcorrection_factor,
-                       (int)cpi->twopass.bits_left,
+                       cpi->twopass.bits_left,
                        cpi->twopass.total_left_stats.coded_error,
                        cpi->tot_recode_hits);
 
@@ -4667,7 +4665,6 @@
 
         {
             FILE *fmodes = fopen("Modes.stt", "a");
-            int i;
 
             fprintf(fmodes, "%6d:%1d:%1d:%1d ",
                         cpi->common.current_video_frame,
diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c
index fe4db13..c51650c 100644
--- a/vp8/encoder/ratectrl.c
+++ b/vp8/encoder/ratectrl.c
@@ -174,14 +174,6 @@
     600, 600, 600, 600, 600, 600, 600, 600,
 };
 
-/* % adjustment to target kf size based on seperation from previous frame */
-static const int kf_boost_seperation_adjustment[16] =
-{
-    30,   40,   50,   55,   60,   65,   70,   75,
-    80,   85,   90,   95,  100,  100,  100,  100,
-};
-
-
 static const int gf_adjust_table[101] =
 {
     100,
@@ -1238,7 +1230,6 @@
         {
             Q = cpi->oxcf.gold_q;
         }
-
     }
     else
     {
diff --git a/vp9/common/vp9_reconinter.c b/vp9/common/vp9_reconinter.c
index 237fd01..a6e51d7 100644
--- a/vp9/common/vp9_reconinter.c
+++ b/vp9/common/vp9_reconinter.c
@@ -49,7 +49,7 @@
       memset(dst, ref_row[0], left);
 
     if (copy)
-      memcpy(dst + left, ref_row + x + left, copy);
+      memmove(dst + left, ref_row + x + left, copy);
 
     if (right)
       memset(dst + left + copy, ref_row[w - 1], right);
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 274ced1..3e18327 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1780,6 +1780,9 @@
           further_steps = (MAX_MVSEARCH_STEPS - 1) - step_param;
           // adjust src pointer for this block
           mi_buf_shift(x, i);
+
+          vp9_clamp_mv_min_max(x, &bsi->ref_mv->as_mv);
+
           if (cpi->sf.search_method == HEX) {
             bestsme = vp9_hex_search(x, &mvp_full.as_mv,
                                      step_param,