Update the comp_refs counts
authorJingning Han <jingning@google.com>
Tue, 18 Sep 2018 22:26:26 +0000 (15:26 -0700)
committerJingning Han <jingning@google.com>
Thu, 20 Sep 2018 15:58:06 +0000 (08:58 -0700)
Generalize the comp_refs counts update support the case where one
has 1 fwd and 2 bwd reference frames too.

Change-Id: I979216a95d45efef51026158f94612bef39d3c6d

vp9/encoder/vp9_encodeframe.c

index 488f04d..702f8c2 100644 (file)
@@ -2027,8 +2027,10 @@ static void update_stats(VP9_COMMON *cm, ThreadData *td) {
                             [has_second_ref(mi)]++;
 
         if (has_second_ref(mi)) {
-          counts->comp_ref[vp9_get_pred_context_comp_ref_p(cm, xd)]
-                          [ref0 == GOLDEN_FRAME]++;
+          const int idx = cm->ref_frame_sign_bias[cm->comp_fixed_ref];
+          const int ctx = vp9_get_pred_context_comp_ref_p(cm, xd);
+          const int bit = mi->ref_frame[!idx] == cm->comp_var_ref[1];
+          counts->comp_ref[ctx][bit]++;
         } else {
           counts->single_ref[vp9_get_pred_context_single_ref_p1(xd)][0]
                             [ref0 != LAST_FRAME]++;