shithub: libvpx

Download patch

ref: 9d403d6f4886b80737f7e78ca1e579f6ecc6bad5
parent: 002cf3883712cd65e5c5fb0dd1fb9014ec05f328
parent: c824eda6ccf84ddbc55f2b78cb8ad57525db066b
author: Marco Paniconi <[email protected]>
date: Mon Apr 3 12:23:25 EDT 2017

Merge "vp9: SVC: Fix issue with artifact for svc-denoising."

--- a/vp9/encoder/vp9_denoiser.c
+++ b/vp9/encoder/vp9_denoiser.c
@@ -187,7 +187,7 @@
 }
 
 static VP9_DENOISER_DECISION perform_motion_compensation(
-    VP9_DENOISER *denoiser, MACROBLOCK *mb, BLOCK_SIZE bs,
+    VP9_COMMON *const cm, VP9_DENOISER *denoiser, MACROBLOCK *mb, BLOCK_SIZE bs,
     int increase_denoising, int mi_row, int mi_col, PICK_MODE_CONTEXT *ctx,
     int motion_magnitude, int is_skin, int *zeromv_filter, int consec_zeromv,
     int num_spatial_layers, int width) {
@@ -199,6 +199,7 @@
   int i;
   struct buf_2d saved_dst[MAX_MB_PLANE];
   struct buf_2d saved_pre[MAX_MB_PLANE];
+  RefBuffer *saved_block_refs[2];
 
   frame = ctx->best_reference_frame;
   saved_mi = *mi;
@@ -260,6 +261,7 @@
     saved_pre[i] = filter_mbd->plane[i].pre[0];
     saved_dst[i] = filter_mbd->plane[i].dst;
   }
+  saved_block_refs[0] = filter_mbd->block_refs[0];
 
   // Set the pointers in the MACROBLOCKD to point to the buffers in the denoiser
   // struct.
@@ -289,10 +291,12 @@
                   denoiser->mc_running_avg_y.uv_stride, mi_row, mi_col);
   filter_mbd->plane[2].dst.stride = denoiser->mc_running_avg_y.uv_stride;
 
+  set_ref_ptrs(cm, filter_mbd, frame, NONE);
   vp9_build_inter_predictors_sby(filter_mbd, mi_row, mi_col, bs);
 
   // Restore everything to its original state
   *mi = saved_mi;
+  filter_mbd->block_refs[0] = saved_block_refs[0];
   for (i = 0; i < MAX_MB_PLANE; ++i) {
     filter_mbd->plane[i].pre[0] = saved_pre[i];
     filter_mbd->plane[i].dst = saved_dst[i];
@@ -363,7 +367,7 @@
 
   if (denoiser->denoising_level >= kDenLow)
     decision = perform_motion_compensation(
-        denoiser, mb, bs, increase_denoising, mi_row, mi_col, ctx,
+        &cpi->common, denoiser, mb, bs, increase_denoising, mi_row, mi_col, ctx,
         motion_magnitude, is_skin, &zeromv_filter, consec_zeromv,
         cpi->svc.number_spatial_layers, cpi->Source->y_width);
 
--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -1587,14 +1587,6 @@
         !svc_force_zero_mode[GOLDEN_FRAME - 1] && !force_skip_low_temp_var))
     use_golden_nonzeromv = 0;
 
-#if CONFIG_VP9_TEMPORAL_DENOISING
-  // TODO(marpan): Allowing golden as the (spatial) reference for SVC with
-  // denoising causes bad artifact. Remove this condition when artifact issue
-  // is resolved.
-  if (cpi->use_svc && cpi->oxcf.noise_sensitivity > 0 && denoise_svc_pickmode)
-    usable_ref_frame = LAST_FRAME;
-#endif
-
   if (cpi->oxcf.speed >= 8 && !cpi->use_svc &&
       ((cpi->rc.frames_since_golden + 1) < x->last_sb_high_content ||
        x->last_sb_high_content > 40))
@@ -2036,13 +2028,6 @@
         !(cpi->ref_frame_flags & flag_list[GOLDEN_FRAME]) ||
         (!cpi->svc.layer_context[cpi->svc.temporal_layer_id].is_key_frame &&
          svc_force_zero_mode[best_ref_frame - 1]);
-#if CONFIG_VP9_TEMPORAL_DENOISING
-    // TODO(marpan): Temporary fix to keep intra prediction on as we currently
-    // disallow golden as the (spatial) reference for SVC with denoising due to
-    // artifact issue, Remove this condition when artifact issue is resolved.
-    if (cpi->use_svc && cpi->oxcf.noise_sensitivity > 0 && denoise_svc_pickmode)
-      perform_intra_pred = 1;
-#endif
     inter_mode_thresh = (inter_mode_thresh << 1) + inter_mode_thresh;
   }
   if (cpi->oxcf.lag_in_frames > 0 && cpi->oxcf.rc_mode == VPX_VBR &&