]> granicus.if.org Git - libvpx/commitdiff
Add ARF validation for compound inter mode check
authorJingning Han <jingning@google.com>
Mon, 15 Sep 2014 18:20:30 +0000 (11:20 -0700)
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>
Mon, 15 Sep 2014 19:20:57 +0000 (12:20 -0700)
This commit enforces ARF validation check for compound inter modes.
It avoids potential access to ARF in the encoding process if it
is not allowed.

Change-Id: I055fec946b5d19d97937dc9001e1e564923e2439

vp9/encoder/vp9_rdopt.c

index 088776982d7ba8b7d49899a8b3de0e9810df1085..f3091cc88ccb36799193c82dac2c24e5c267280b 100644 (file)
@@ -2793,6 +2793,15 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
       if (!cm->allow_comp_inter_inter)
         continue;
 
+      // Skip compound inter modes if ARF is not available.
+      if (!(cpi->ref_frame_flags & flag_list[second_ref_frame]))
+        continue;
+
+      // Do not allow compound prediction if the segment level reference frame
+      // feature is in use as in this case there can only be one reference.
+      if (vp9_segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME))
+        continue;
+
       if ((mode_search_skip_flags & FLAG_SKIP_COMP_BESTINTRA) &&
           best_mode_index >= 0 && best_mbmode.ref_frame[0] == INTRA_FRAME)
         continue;