shithub: libvpx

Download patch

ref: 5b65a71cdc93156d1f5c0a8090b441888a711306
parent: f53d007b9e5ccb499e62bd345b976968bf6af322
author: Dmitry Kovalev <[email protected]>
date: Tue Jul 16 12:34:54 EDT 2013

Changing signature of vp9_get_pred_probs_tx_size.

Removing VP9_COMMON* argument and adding struct tx_probs* instead of
MACROBLOCKD*.

Change-Id: Idf61074631a90ec51eac22c8dcd977f44ac0757c

--- a/vp9/common/vp9_pred_common.c
+++ b/vp9/common/vp9_pred_common.c
@@ -367,10 +367,9 @@
   return pred_context;
 }
 // Returns a context number for the given MB prediction signal
-unsigned char vp9_get_pred_context_tx_size(const VP9_COMMON *cm,
-                                           const MACROBLOCKD *xd) {
+unsigned char vp9_get_pred_context_tx_size(const MACROBLOCKD *xd) {
   const MODE_INFO *const mi = xd->mode_info_context;
-  const MODE_INFO *const above_mi = mi - cm->mode_info_stride;
+  const MODE_INFO *const above_mi = mi - xd->mode_info_stride;
   const MODE_INFO *const left_mi = mi - 1;
   const int left_in_image = xd->left_available && left_mi->mbmi.mb_in_image;
   const int above_in_image = xd->up_available && above_mi->mbmi.mb_in_image;
--- a/vp9/common/vp9_pred_common.h
+++ b/vp9/common/vp9_pred_common.h
@@ -110,19 +110,18 @@
   return cm->fc.single_ref_prob[pred_context][1];
 }
 
-unsigned char vp9_get_pred_context_tx_size(const VP9_COMMON *cm,
-                                           const MACROBLOCKD *xd);
+unsigned char vp9_get_pred_context_tx_size(const MACROBLOCKD *xd);
 
-static INLINE const vp9_prob *vp9_get_pred_probs_tx_size(const VP9_COMMON *cm,
-                                                         const MACROBLOCKD * xd) {
+static const vp9_prob *vp9_get_pred_probs_tx_size(const MACROBLOCKD *xd,
+                           const struct tx_probs *tx_probs) {
   const MODE_INFO *const mi = xd->mode_info_context;
-  const int pred_context = vp9_get_pred_context_tx_size(cm, xd);
+  const int pred_context = vp9_get_pred_context_tx_size(xd);
   if (mi->mbmi.sb_type < BLOCK_SIZE_MB16X16)
-    return cm->fc.tx_probs.p8x8[pred_context];
+    return tx_probs->p8x8[pred_context];
   else if (mi->mbmi.sb_type < BLOCK_SIZE_SB32X32)
-    return cm->fc.tx_probs.p16x16[pred_context];
+    return tx_probs->p16x16[pred_context];
   else
-    return cm->fc.tx_probs.p32x32[pred_context];
+    return tx_probs->p32x32[pred_context];
 }
 
 #endif  // VP9_COMMON_VP9_PRED_COMMON_H_
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -50,8 +50,8 @@
 
 static TX_SIZE read_selected_txfm_size(VP9_COMMON *cm, MACROBLOCKD *xd,
                                        BLOCK_SIZE_TYPE bsize, vp9_reader *r) {
-  const int context = vp9_get_pred_context_tx_size(cm, xd);
-  const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(cm, xd);
+  const int context = vp9_get_pred_context_tx_size(xd);
+  const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(xd, &cm->fc.tx_probs);
   TX_SIZE txfm_size = vp9_read(r, tx_probs[0]);
   if (txfm_size != TX_4X4 && bsize >= BLOCK_SIZE_MB16X16) {
     txfm_size += vp9_read(r, tx_probs[1]);
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -202,9 +202,9 @@
 
 static void write_selected_txfm_size(const VP9_COMP *cpi, TX_SIZE tx_size,
                                      BLOCK_SIZE_TYPE bsize, vp9_writer *w) {
-  const VP9_COMMON *const c = &cpi->common;
+  const VP9_COMMON *const cm = &cpi->common;
   const MACROBLOCKD *const xd = &cpi->mb.e_mbd;
-  const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(c, xd);
+  const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(xd, &cm->fc.tx_probs);
   vp9_write(w, tx_size != TX_4X4, tx_probs[0]);
   if (bsize >= BLOCK_SIZE_MB16X16 && tx_size != TX_4X4) {
     vp9_write(w, tx_size != TX_8X8, tx_probs[1]);
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -2386,7 +2386,7 @@
         !(mbmi->ref_frame[0] != INTRA_FRAME &&
             (mbmi->mb_skip_coeff ||
              vp9_segfeature_active(&xd->seg, segment_id, SEG_LVL_SKIP)))) {
-      const int context = vp9_get_pred_context_tx_size(cm, xd);
+      const int context = vp9_get_pred_context_tx_size(xd);
       if (bsize >= BLOCK_SIZE_SB32X32) {
         cm->fc.tx_counts.p32x32[context][mbmi->txfm_size]++;
       } else if (bsize >= BLOCK_SIZE_MB16X16) {
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -865,7 +865,7 @@
   int n, m;
   int s0, s1;
 
-  const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(cm, xd);
+  const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(xd, &cm->fc.tx_probs);
 
   for (n = TX_4X4; n <= max_txfm_size; n++) {
     r[n][1] = r[n][0];
@@ -972,7 +972,7 @@
   double scale_rd[TX_SIZE_MAX_SB] = {1.73, 1.44, 1.20, 1.00};
   // double scale_r[TX_SIZE_MAX_SB] = {2.82, 2.00, 1.41, 1.00};
 
-  const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(cm, xd);
+  const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(xd, &cm->fc.tx_probs);
 
   // for (n = TX_4X4; n <= max_txfm_size; n++)
   //   r[n][0] = (r[n][0] * scale_r[n]);