shithub: libvpx

Download patch

ref: afe43d40896b82083c6273a97ac9919d9e061eda
parent: 561fb31d10695b71d6d03a8369e68c4cebc18836
author: Dmitry Kovalev <dkovalev@google.com>
date: Fri Jul 19 07:20:49 EDT 2013

Removing redundant VP9_COMMON* from function signatures.

Functions: vp9_get_pred_context_switchable_interp,
           vp9_get_pred_context_intra_inter,
           vp9_get_pred_context_single_ref_p1,
           vp9_get_pred_context_single_ref_p2.

Change-Id: I3d6fb8aee23c9062270768e1e6da416dd9bb8f96

--- a/vp9/common/vp9_pred_common.c
+++ b/vp9/common/vp9_pred_common.c
@@ -17,10 +17,9 @@
 #include "vp9/common/vp9_treecoder.h"
 
 // Returns a context number for the given MB prediction signal
-unsigned char vp9_get_pred_context_switchable_interp(const VP9_COMMON *cm,
-                                                     const MACROBLOCKD *xd) {
+unsigned char vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd) {
   const MODE_INFO *const mi = xd->mode_info_context;
-  const MB_MODE_INFO *const above_mbmi = &mi[-cm->mode_info_stride].mbmi;
+  const MB_MODE_INFO *const above_mbmi = &mi[-xd->mode_info_stride].mbmi;
   const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
   const int left_in_image = xd->left_available && left_mbmi->mb_in_image;
   const int above_in_image = xd->up_available && above_mbmi->mb_in_image;
@@ -55,11 +54,10 @@
     return VP9_SWITCHABLE_FILTERS;
 }
 // Returns a context number for the given MB prediction signal
-unsigned char vp9_get_pred_context_intra_inter(const VP9_COMMON *cm,
-                                               const MACROBLOCKD *xd) {
+unsigned char vp9_get_pred_context_intra_inter(const MACROBLOCKD *xd) {
   int pred_context;
   const MODE_INFO *const mi = xd->mode_info_context;
-  const MB_MODE_INFO *const above_mbmi = &mi[-cm->mode_info_stride].mbmi;
+  const MB_MODE_INFO *const above_mbmi = &mi[-xd->mode_info_stride].mbmi;
   const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
   const int left_in_image = xd->left_available && left_mbmi->mb_in_image;
   const int above_in_image = xd->up_available && above_mbmi->mb_in_image;
@@ -211,11 +209,10 @@
 
   return pred_context;
 }
-unsigned char vp9_get_pred_context_single_ref_p1(const VP9_COMMON *cm,
-                                                 const MACROBLOCKD *xd) {
+unsigned char vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) {
   int pred_context;
   const MODE_INFO *const mi = xd->mode_info_context;
-  const MB_MODE_INFO *const above_mbmi = &mi[-cm->mode_info_stride].mbmi;
+  const MB_MODE_INFO *const above_mbmi = &mi[-xd->mode_info_stride].mbmi;
   const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
   const int left_in_image = xd->left_available && left_mbmi->mb_in_image;
   const int above_in_image = xd->up_available && above_mbmi->mb_in_image;
@@ -277,11 +274,10 @@
   return pred_context;
 }
 
-unsigned char vp9_get_pred_context_single_ref_p2(const VP9_COMMON *cm,
-                                                 const MACROBLOCKD *xd) {
+unsigned char vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) {
   int pred_context;
   const MODE_INFO *const mi = xd->mode_info_context;
-  const MB_MODE_INFO *const above_mbmi = &mi[-cm->mode_info_stride].mbmi;
+  const MB_MODE_INFO *const above_mbmi = &mi[-xd->mode_info_stride].mbmi;
   const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
   const int left_in_image = xd->left_available && left_mbmi->mb_in_image;
   const int above_in_image = xd->up_available && above_mbmi->mb_in_image;
--- a/vp9/common/vp9_pred_common.h
+++ b/vp9/common/vp9_pred_common.h
@@ -55,21 +55,19 @@
 void vp9_set_pred_flag_mbskip(VP9_COMMON *cm, BLOCK_SIZE_TYPE bsize,
                               int mi_row, int mi_col, uint8_t pred_flag);
 
-unsigned char vp9_get_pred_context_switchable_interp(const VP9_COMMON *cm,
-                                                     const MACROBLOCKD *xd);
+unsigned char vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd);
 
 static INLINE const vp9_prob *vp9_get_pred_probs_switchable_interp(
     const VP9_COMMON *cm, const MACROBLOCKD *xd) {
-  const int pred_context = vp9_get_pred_context_switchable_interp(cm, xd);
+  const int pred_context = vp9_get_pred_context_switchable_interp(xd);
   return &cm->fc.switchable_interp_prob[pred_context][0];
 }
 
-unsigned char vp9_get_pred_context_intra_inter(const VP9_COMMON *cm,
-                                               const MACROBLOCKD *xd);
+unsigned char vp9_get_pred_context_intra_inter(const MACROBLOCKD *xd);
 
 static INLINE vp9_prob vp9_get_pred_prob_intra_inter(const VP9_COMMON *cm,
                                                      const MACROBLOCKD *xd) {
-  const int pred_context = vp9_get_pred_context_intra_inter(cm, xd);
+  const int pred_context = vp9_get_pred_context_intra_inter(xd);
   return cm->fc.intra_inter_prob[pred_context];
 }
 
@@ -92,21 +90,19 @@
   return cm->fc.comp_ref_prob[pred_context];
 }
 
-unsigned char vp9_get_pred_context_single_ref_p1(const VP9_COMMON *cm,
-                                                 const MACROBLOCKD *xd);
+unsigned char vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd);
 
 static INLINE vp9_prob vp9_get_pred_prob_single_ref_p1(const VP9_COMMON *cm,
                                                        const MACROBLOCKD *xd) {
-  const int pred_context = vp9_get_pred_context_single_ref_p1(cm, xd);
+  const int pred_context = vp9_get_pred_context_single_ref_p1(xd);
   return cm->fc.single_ref_prob[pred_context][0];
 }
 
-unsigned char vp9_get_pred_context_single_ref_p2(const VP9_COMMON *cm,
-                                                 const MACROBLOCKD *xd);
+unsigned char vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd);
 
 static INLINE vp9_prob vp9_get_pred_prob_single_ref_p2(const VP9_COMMON *cm,
                                                        const MACROBLOCKD *xd) {
-  const int pred_context = vp9_get_pred_context_single_ref_p2(cm, xd);
+  const int pred_context = vp9_get_pred_context_single_ref_p2(xd);
   return cm->fc.single_ref_prob[pred_context][1];
 }
 
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -330,10 +330,10 @@
       ref_frame[fix_ref_idx] = cm->comp_fixed_ref;
       ref_frame[!fix_ref_idx] = cm->comp_var_ref[b];
     } else {
-      const int ref1_ctx = vp9_get_pred_context_single_ref_p1(cm, xd);
+      const int ref1_ctx = vp9_get_pred_context_single_ref_p1(xd);
       ref_frame[1] = NONE;
       if (vp9_read(r, fc->single_ref_prob[ref1_ctx][0])) {
-        const int ref2_ctx = vp9_get_pred_context_single_ref_p2(cm, xd);
+        const int ref2_ctx = vp9_get_pred_context_single_ref_p2(xd);
         const int b = vp9_read(r, fc->single_ref_prob[ref2_ctx][1]);
         ref_frame[0] = b ? ALTREF_FRAME : GOLDEN_FRAME;
         fc->single_ref_count[ref1_ctx][0][1]++;
@@ -385,7 +385,7 @@
   MACROBLOCKD *const xd = &pbi->mb;
   const vp9_prob *probs = vp9_get_pred_probs_switchable_interp(cm, xd);
   const int index = treed_read(r, vp9_switchable_interp_tree, probs);
-  const int ctx = vp9_get_pred_context_switchable_interp(cm, xd);
+  const int ctx = vp9_get_pred_context_switchable_interp(xd);
   ++cm->fc.switchable_interp_count[ctx][index];
   return vp9_switchable_interp[index];
 }
@@ -433,7 +433,7 @@
 
   MV_REFERENCE_FRAME ref;
   if (!vp9_segfeature_active(&xd->seg, segment_id, SEG_LVL_REF_FRAME)) {
-    const int ctx = vp9_get_pred_context_intra_inter(cm, xd);
+    const int ctx = vp9_get_pred_context_intra_inter(xd);
     ref = (MV_REFERENCE_FRAME)
               vp9_read(r, vp9_get_pred_prob_intra_inter(cm, xd));
     cm->fc.intra_inter_count[ctx][ref != INTRA_FRAME]++;
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -422,7 +422,7 @@
     if (cpi->common.mcomp_filter_type == SWITCHABLE
         && is_inter_mode(mbmi->mode)) {
       ++cpi->common.fc.switchable_interp_count[
-          vp9_get_pred_context_switchable_interp(&cpi->common, xd)]
+          vp9_get_pred_context_switchable_interp(xd)]
             [vp9_switchable_interp_map[mbmi->interp_filter]];
     }
 
@@ -581,7 +581,7 @@
                                                      SEG_LVL_REF_FRAME);
 
     if (!seg_ref_active)
-      cpi->intra_inter_count[vp9_get_pred_context_intra_inter(cm, xd)][mbmi
+      cpi->intra_inter_count[vp9_get_pred_context_intra_inter(xd)][mbmi
           ->ref_frame[0] > INTRA_FRAME]++;
 
     // If the segment reference feature is enabled we have only a single
@@ -596,10 +596,10 @@
         cpi->comp_ref_count[vp9_get_pred_context_comp_ref_p(cm, xd)][mbmi
             ->ref_frame[0] == GOLDEN_FRAME]++;
       } else {
-        cpi->single_ref_count[vp9_get_pred_context_single_ref_p1(cm, xd)]
+        cpi->single_ref_count[vp9_get_pred_context_single_ref_p1(xd)]
                               [0][mbmi->ref_frame[0] != LAST_FRAME]++;
         if (mbmi->ref_frame[0] != LAST_FRAME)
-          cpi->single_ref_count[vp9_get_pred_context_single_ref_p2(cm, xd)][1]
+          cpi->single_ref_count[vp9_get_pred_context_single_ref_p2(xd)][1]
               [mbmi->ref_frame[0] != GOLDEN_FRAME]++;
       }
     }
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -2379,7 +2379,7 @@
   MACROBLOCKD *xd = &x->e_mbd;
   MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
 
-  const int c = vp9_get_pred_context_switchable_interp(cm, xd);
+  const int c = vp9_get_pred_context_switchable_interp(xd);
   const int m = vp9_switchable_interp_map[mbmi->interp_filter];
   return SWITCHABLE_INTERP_RATE_FACTOR * x->switchable_interp_costs[c][m];
 }
--