]> granicus.if.org Git - libvpx/commitdiff
vp9-svc: Put check on usage of long term temporal ref.
authorMarco Paniconi <marpan@google.com>
Mon, 26 Nov 2018 23:52:21 +0000 (15:52 -0800)
committerMarco Paniconi <marpan@google.com>
Tue, 27 Nov 2018 03:18:22 +0000 (19:18 -0800)
If the scale factor of the golden long term reference
is different from the last reference then disable usage
of long term reference.

This should not happen, but add this as a check against
some possibly incorrect update of the svc configuration.

Change-Id: Ic1062d4384e005007d8c922813fa8ad188d8fa98

vp9/encoder/vp9_pickmode.c

index 8dce4cf7b46dcefffbaba7d6b59f32abd2d5e6b9..1324b5bc8aa4f4667e29dedcee5843082e0d3670 100644 (file)
@@ -1732,11 +1732,21 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
   if (!cpi->use_svc ||
       (svc->use_gf_temporal_ref_current_layer &&
        !svc->layer_context[svc->temporal_layer_id].is_key_frame)) {
+    struct scale_factors *const sf_last = &cm->frame_refs[LAST_FRAME - 1].sf;
+    struct scale_factors *const sf_golden =
+        &cm->frame_refs[GOLDEN_FRAME - 1].sf;
     gf_temporal_ref = 1;
-    if (cpi->rc.avg_frame_low_motion > 70)
-      thresh_svc_skip_golden = 500;
-    else
-      thresh_svc_skip_golden = 0;
+    // For temporal long term prediction, check that the golden reference
+    // is same scale as last reference, otherwise disable.
+    if ((sf_last->x_scale_fp != sf_golden->x_scale_fp) ||
+        (sf_last->y_scale_fp != sf_golden->y_scale_fp)) {
+      gf_temporal_ref = 0;
+    } else {
+      if (cpi->rc.avg_frame_low_motion > 70)
+        thresh_svc_skip_golden = 500;
+      else
+        thresh_svc_skip_golden = 0;
+    }
   }
 
   init_ref_frame_cost(cm, xd, ref_frame_cost);