shithub: libvpx

Download patch

ref: 5f0f260f0cf304eebf2aa88a90978f3e9df20dcb
parent: fe96afa705075fbf5426ba9932dbb88362594551
author: Paul Wilkins <paulwilkins@google.com>
date: Fri Jan 27 13:35:14 EST 2012

Moved some reference frame data structures into common.

In this commit only the decoder side was updated.

Change-Id: Ia9bd58da07d1a943f028e330f0489344e62b0d02

--- a/vp8/common/blockd.h
+++ b/vp8/common/blockd.h
@@ -191,8 +191,7 @@
     unsigned char need_to_clamp_mvs;
     unsigned char segment_id;                  /* Which set of segmentation parameters should be used for this MB */
 
-    // Flag used when temporal prediction of segment map is enabled.
-    // 1 means it is predicted 0 that it must be coded explicitly
+    // Flags used for prediction status of various bistream signals
     unsigned char seg_id_predicted;
 
 } MB_MODE_INFO;
@@ -300,8 +299,8 @@
     int mb_to_top_edge;
     int mb_to_bottom_edge;
 
+    // TODO this is not used in the decoder so should not be in this structure
     int ref_frame_cost[MAX_REF_FRAMES];
-
 
     unsigned int frames_since_golden;
     unsigned int frames_till_alt_ref_frame;
--- a/vp8/common/onyxc_int.h
+++ b/vp8/common/onyxc_int.h
@@ -208,7 +208,6 @@
     ENTROPY_CONTEXT_PLANES *above_context;   /* row of context for each plane */
     ENTROPY_CONTEXT_PLANES left_context;  /* (up to) 4 contexts "" */
 
-
     /* keyframe block modes are predicted by their above, left neighbors */
 
     vp8_prob kf_bmode_prob [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES-1];
@@ -226,6 +225,11 @@
 #endif
 
     vp8_prob i8x8_mode_prob [VP8_UV_MODES-1];
+
+    vp8_prob prob_intra_coded;
+    vp8_prob prob_last_coded;
+    vp8_prob prob_gf_coded;
+
     // Context probabilities when using predictive coding of segment id
     vp8_prob segment_pred_probs[PREDICTION_PROBS];
     unsigned char temporal_update;
--- a/vp8/decoder/decodemv.c
+++ b/vp8/decoder/decodemv.c
@@ -121,6 +121,7 @@
     y_mode = (MB_PREDICTION_MODE) vp8_kfread_ymode(
                                       bc, pbi->common.kf_ymode_prob);
 #endif
+
     m->mbmi.ref_frame = INTRA_FRAME;
 
     if ((m->mbmi.mode = y_mode) == B_PRED)
@@ -236,6 +237,7 @@
     int seg_ref_active;
 
 //#if CONFIG_SEGFEATURES
+    VP8_COMMON *const cm = & pbi->common;
     MACROBLOCKD *const xd = &pbi->mb;
 
     seg_ref_active = segfeature_active( xd,
@@ -246,14 +248,14 @@
     if ( !seg_ref_active )
     {
         ref_frame =
-            (MV_REFERENCE_FRAME) vp8_read(bc, pbi->prob_intra);
+            (MV_REFERENCE_FRAME) vp8_read(bc, cm->prob_intra_coded);
 
         if (ref_frame)
         {
-            if (vp8_read(bc, pbi->prob_last))
+            if (vp8_read(bc, cm->prob_last_coded))
             {
                 ref_frame = (MV_REFERENCE_FRAME)((int)ref_frame +
-                            (int)(1 + vp8_read(bc, pbi->prob_gf)));
+                            (int)(1 + vp8_read(bc, cm->prob_gf_coded)));
             }
         }
     }
@@ -272,7 +274,8 @@
             // Else if there are both intra and inter options we need to read
             // the inter / intra flag, else mark as inter.
             if ( check_segref( xd, segment_id, INTRA_FRAME ) )
-                ref_frame = (MV_REFERENCE_FRAME) vp8_read(bc, pbi->prob_intra);
+                ref_frame =
+                    (MV_REFERENCE_FRAME) vp8_read(bc, cm->prob_intra_coded);
             else
                 ref_frame = LAST_FRAME;
 
@@ -296,8 +299,9 @@
                     // Else we must read bit to decide.
                     else
                     {
-                        ref_frame = (MV_REFERENCE_FRAME)((int)ref_frame +
-                                    (int)(1 + vp8_read(bc, pbi->prob_gf)));
+                        ref_frame =
+                            (MV_REFERENCE_FRAME)((int)ref_frame +
+                            (int)(1 + vp8_read(bc, cm->prob_gf_coded)));
                     }
                 }
                 // Both last and at least one of alt or golden are enabled
@@ -305,7 +309,7 @@
                           check_segref( xd, segment_id, ALTREF_FRAME ) )
                 {
                     // Read flag to indicate (golden or altref) vs last
-                    if (vp8_read(bc, pbi->prob_last))
+                    if (vp8_read(bc, cm->prob_last_coded))
                     {
                         // If not golden then it must be altref
                         if (!check_segref( xd, segment_id, GOLDEN_FRAME ))
@@ -320,8 +324,9 @@
                         }
                         else
                         {
-                            ref_frame = (MV_REFERENCE_FRAME)((int)ref_frame +
-                                        (int)(1 + vp8_read(bc, pbi->prob_gf)));
+                            ref_frame =
+                                (MV_REFERENCE_FRAME)((int)ref_frame +
+                                (int)(1 + vp8_read(bc, cm->prob_gf_coded)));
                         }
                     }
                     // ELSE LAST
@@ -370,6 +375,7 @@
 
 static void mb_mode_mv_init(VP8D_COMP *pbi)
 {
+    VP8_COMMON *const cm = & pbi->common;
     vp8_reader *const bc = & pbi->bc;
     MV_CONTEXT *const mvc = pbi->common.fc.mvc;
 
@@ -385,14 +391,17 @@
 
     if(pbi->common.frame_type != KEY_FRAME)
     {
-        pbi->prob_intra = (vp8_prob)vp8_read_literal(bc, 8);
-        pbi->prob_last  = (vp8_prob)vp8_read_literal(bc, 8);
-        pbi->prob_gf    = (vp8_prob)vp8_read_literal(bc, 8);
+        // Decode the baseline probabilities for decoding reference frame
+        cm->prob_intra_coded = (vp8_prob)vp8_read_literal(bc, 8);
+        cm->prob_last_coded  = (vp8_prob)vp8_read_literal(bc, 8);
+        cm->prob_gf_coded    = (vp8_prob)vp8_read_literal(bc, 8);
+
+
 #if CONFIG_DUALPRED
         pbi->common.dual_pred_mode = vp8_read(bc, 128);
-        if (pbi->common.dual_pred_mode)
-            pbi->common.dual_pred_mode += vp8_read(bc, 128);
-        if (pbi->common.dual_pred_mode == HYBRID_PREDICTION)
+        if (cm->dual_pred_mode)
+            cm->dual_pred_mode += vp8_read(bc, 128);
+        if (cm->dual_pred_mode == HYBRID_PREDICTION)
         {
             pbi->prob_dualpred[0] = (vp8_prob)vp8_read_literal(bc, 8);
             pbi->prob_dualpred[1] = (vp8_prob)vp8_read_literal(bc, 8);
@@ -406,7 +415,7 @@
 
             do
             {
-                pbi->common.fc.ymode_prob[i] = (vp8_prob) vp8_read_literal(bc, 8);
+                cm->fc.ymode_prob[i] = (vp8_prob) vp8_read_literal(bc, 8);
             }
             while (++i < 4);
         }
@@ -419,7 +428,7 @@
 
             do
             {
-                pbi->common.fc.uv_mode_prob[i] = (vp8_prob) vp8_read_literal(bc, 8);
+                cm->fc.uv_mode_prob[i] = (vp8_prob) vp8_read_literal(bc, 8);
             }
             while (++i < 3);
         }
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -1351,7 +1351,7 @@
     vpx_memcpy(&xd->pre, &pc->yv12_fb[pc->lst_fb_idx], sizeof(YV12_BUFFER_CONFIG));
     vpx_memcpy(&xd->dst, &pc->yv12_fb[pc->new_fb_idx], sizeof(YV12_BUFFER_CONFIG));
 
-     // Create the encoder segmentation map and set all entries to 0
+     // Create the segmentation map structure and set to 0
      if (!pc->last_frame_seg_map)
        CHECK_MEM_ERROR(pc->last_frame_seg_map,
                        vpx_calloc((pc->mb_rows * pc->mb_cols), 1));
--- a/vp8/decoder/onyxd_int.h
+++ b/vp8/decoder/onyxd_int.h
@@ -129,10 +129,6 @@
     vp8_dequant_rtcd_vtable_t        dequant;
 #endif
 
-
-    vp8_prob prob_intra;
-    vp8_prob prob_last;
-    vp8_prob prob_gf;
     vp8_prob prob_skip_false;
 #if CONFIG_DUALPRED
     vp8_prob prob_dualpred[3];