From 32042af14b4a106d5c38d14db66a004bcf536628 Mon Sep 17 00:00:00 2001
From: Paul Wilkins <paulwilkins@google.com>
Date: Tue, 23 Jul 2013 12:09:04 +0100
Subject: [PATCH] Renaming of segment constants.

Renamed:
  MAX_MB_SEGMENTS to MAX_SEGMENTS
  MB_SEG_TREE_PROBS to SEG_TREE_PROBS

The minimum unit for segmentation in the segment map
is now 8x8 so it is misleading to use MB_ as macro-block
traditionally refers to a 16x16 region.

Change-Id: I0b55a6f0426bb46dd13435fcfa5bae0a30a7fa22
---
 vp9/common/vp9_loopfilter.c    |  2 +-
 vp9/common/vp9_loopfilter.h    |  2 +-
 vp9/common/vp9_onyx.h          |  8 ++++----
 vp9/common/vp9_pred_common.c   |  2 +-
 vp9/common/vp9_seg_common.h    | 12 ++++++------
 vp9/decoder/vp9_decodemv.c     |  2 +-
 vp9/decoder/vp9_decodframe.c   |  4 ++--
 vp9/encoder/vp9_bitstream.c    |  4 ++--
 vp9/encoder/vp9_onyx_if.c      | 14 +++++++-------
 vp9/encoder/vp9_onyx_int.h     |  2 +-
 vp9/encoder/vp9_segmentation.c |  8 ++++----
 11 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/vp9/common/vp9_loopfilter.c b/vp9/common/vp9_loopfilter.c
index d8be8765a8..5498b1717c 100644
--- a/vp9/common/vp9_loopfilter.c
+++ b/vp9/common/vp9_loopfilter.c
@@ -87,7 +87,7 @@ void vp9_loop_filter_frame_init(VP9_COMMON *const cm, MACROBLOCKD *const xd,
     lf->last_sharpness_level = lf->sharpness_level;
   }
 
-  for (seg = 0; seg < MAX_MB_SEGMENTS; seg++) {
+  for (seg = 0; seg < MAX_SEGMENTS; seg++) {
     int lvl_seg = default_filt_lvl, ref, mode, intra_lvl;
 
     // Set the baseline filter values for each segment
diff --git a/vp9/common/vp9_loopfilter.h b/vp9/common/vp9_loopfilter.h
index fddf2ce827..e59cc64850 100644
--- a/vp9/common/vp9_loopfilter.h
+++ b/vp9/common/vp9_loopfilter.h
@@ -31,7 +31,7 @@ typedef struct {
                   lim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
   DECLARE_ALIGNED(SIMD_WIDTH, uint8_t,
                   hev_thr[4][SIMD_WIDTH]);
-  uint8_t lvl[MAX_MB_SEGMENTS][MAX_REF_FRAMES][MAX_MODE_LF_DELTAS];
+  uint8_t lvl[MAX_SEGMENTS][MAX_REF_FRAMES][MAX_MODE_LF_DELTAS];
   uint8_t mode_lf_lut[MB_MODE_COUNT];
 } loop_filter_info_n;
 
diff --git a/vp9/common/vp9_onyx.h b/vp9/common/vp9_onyx.h
index fe8122b467..152046f6f7 100644
--- a/vp9/common/vp9_onyx.h
+++ b/vp9/common/vp9_onyx.h
@@ -22,7 +22,7 @@ extern "C"
 #include "vpx_scale/yv12config.h"
 #include "vp9/common/vp9_ppflags.h"
 
-#define MAX_MB_SEGMENTS 8
+#define MAX_SEGMENTS 8
 
   typedef int *VP9_PTR;
 
@@ -200,9 +200,9 @@ extern "C"
 
   int vp9_set_roimap(VP9_PTR comp, unsigned char *map,
                      unsigned int rows, unsigned int cols,
-                     int delta_q[MAX_MB_SEGMENTS],
-                     int delta_lf[MAX_MB_SEGMENTS],
-                     unsigned int threshold[MAX_MB_SEGMENTS]);
+                     int delta_q[MAX_SEGMENTS],
+                     int delta_lf[MAX_SEGMENTS],
+                     unsigned int threshold[MAX_SEGMENTS]);
 
   int vp9_set_active_map(VP9_PTR comp, unsigned char *map,
                          unsigned int rows, unsigned int cols);
diff --git a/vp9/common/vp9_pred_common.c b/vp9/common/vp9_pred_common.c
index ea2b0f4186..71fca4cb9e 100644
--- a/vp9/common/vp9_pred_common.c
+++ b/vp9/common/vp9_pred_common.c
@@ -445,6 +445,6 @@ int vp9_get_segment_id(VP9_COMMON *cm, const uint8_t *segment_ids,
       segment_id = MIN(segment_id,
                        segment_ids[mi_offset + y * cm->mi_cols + x]);
 
-  assert(segment_id >= 0 && segment_id < MAX_MB_SEGMENTS);
+  assert(segment_id >= 0 && segment_id < MAX_SEGMENTS);
   return segment_id;
 }
diff --git a/vp9/common/vp9_seg_common.h b/vp9/common/vp9_seg_common.h
index f072a518dd..f22239b92e 100644
--- a/vp9/common/vp9_seg_common.h
+++ b/vp9/common/vp9_seg_common.h
@@ -16,8 +16,8 @@
 #define SEGMENT_DELTADATA   0
 #define SEGMENT_ABSDATA     1
 
-#define MAX_MB_SEGMENTS     8
-#define MB_SEG_TREE_PROBS   (MAX_MB_SEGMENTS-1)
+#define MAX_SEGMENTS     8
+#define SEG_TREE_PROBS   (MAX_SEGMENTS-1)
 
 #define PREDICTION_PROBS 3
 
@@ -27,7 +27,7 @@ typedef enum {
   SEG_LVL_ALT_LF = 1,              // Use alternate loop filter value...
   SEG_LVL_REF_FRAME = 2,           // Optional Segment reference frame
   SEG_LVL_SKIP = 3,                // Optional Segment (0,0) + skip mode
-  SEG_LVL_MAX = 4                  // Number of MB level features supported
+  SEG_LVL_MAX = 4                  // Number of features supported
 } SEG_LVL_FEATURES;
 
 
@@ -38,11 +38,11 @@ struct segmentation {
   uint8_t abs_delta;
   uint8_t temporal_update;
 
-  vp9_prob tree_probs[MB_SEG_TREE_PROBS];
+  vp9_prob tree_probs[SEG_TREE_PROBS];
   vp9_prob pred_probs[PREDICTION_PROBS];
 
-  int16_t feature_data[MAX_MB_SEGMENTS][SEG_LVL_MAX];
-  unsigned int feature_mask[MAX_MB_SEGMENTS];
+  int16_t feature_data[MAX_SEGMENTS][SEG_LVL_MAX];
+  unsigned int feature_mask[MAX_SEGMENTS];
 };
 
 int vp9_segfeature_active(const struct segmentation *seg,
diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c
index 6660f5b8e6..0fdba805dc 100644
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -86,7 +86,7 @@ static void set_segment_id(VP9_COMMON *cm, BLOCK_SIZE_TYPE bsize,
   const int ymis = MIN(cm->mi_rows - mi_row, bh);
   int x, y;
 
-  assert(segment_id >= 0 && segment_id < MAX_MB_SEGMENTS);
+  assert(segment_id >= 0 && segment_id < MAX_SEGMENTS);
 
   for (y = 0; y < ymis; y++)
     for (x = 0; x < xmis; x++)
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c
index 61c14b8dcf..6f7908ffc1 100644
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -400,7 +400,7 @@ static void setup_segmentation(struct segmentation *seg,
   // Segmentation map update
   seg->update_map = vp9_rb_read_bit(rb);
   if (seg->update_map) {
-    for (i = 0; i < MB_SEG_TREE_PROBS; i++)
+    for (i = 0; i < SEG_TREE_PROBS; i++)
       seg->tree_probs[i] = vp9_rb_read_bit(rb) ? vp9_rb_read_literal(rb, 8)
                                                : MAX_PROB;
 
@@ -422,7 +422,7 @@ static void setup_segmentation(struct segmentation *seg,
 
     vp9_clearall_segfeatures(seg);
 
-    for (i = 0; i < MAX_MB_SEGMENTS; i++) {
+    for (i = 0; i < MAX_SEGMENTS; i++) {
       for (j = 0; j < SEG_LVL_MAX; j++) {
         int data = 0;
         const int feature_enabled = vp9_rb_read_bit(rb);
diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c
index 07cb2b83e0..d176b3b4e0 100644
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -1011,7 +1011,7 @@ static void encode_segmentation(VP9_COMP *cpi,
     // Select the coding strategy (temporal or spatial)
     vp9_choose_segmap_coding_method(cpi);
     // Write out probabilities used to decode unpredicted  macro-block segments
-    for (i = 0; i < MB_SEG_TREE_PROBS; i++) {
+    for (i = 0; i < SEG_TREE_PROBS; i++) {
       const int prob = seg->tree_probs[i];
       const int update = prob != MAX_PROB;
       vp9_wb_write_bit(wb, update);
@@ -1037,7 +1037,7 @@ static void encode_segmentation(VP9_COMP *cpi,
   if (seg->update_data) {
     vp9_wb_write_bit(wb, seg->abs_delta);
 
-    for (i = 0; i < MAX_MB_SEGMENTS; i++) {
+    for (i = 0; i < MAX_SEGMENTS; i++) {
       for (j = 0; j < SEG_LVL_MAX; j++) {
         const int active = vp9_segfeature_active(seg, i, j);
         vp9_wb_write_bit(wb, active);
diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c
index fe276fa6b7..482b75dedd 100644
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -1222,7 +1222,7 @@ void vp9_change_config(VP9_PTR ptr, VP9_CONFIG *oxcf) {
   {
     int i;
 
-    for (i = 0; i < MAX_MB_SEGMENTS; i++)
+    for (i = 0; i < MAX_SEGMENTS; i++)
       cpi->segment_encode_breakout[i] = cpi->oxcf.encode_breakout;
   }
 
@@ -3973,11 +3973,11 @@ int vp9_get_preview_raw_frame(VP9_PTR comp, YV12_BUFFER_CONFIG *dest,
 }
 
 int vp9_set_roimap(VP9_PTR comp, unsigned char *map, unsigned int rows,
-                   unsigned int cols, int delta_q[MAX_MB_SEGMENTS],
-                   int delta_lf[MAX_MB_SEGMENTS],
-                   unsigned int threshold[MAX_MB_SEGMENTS]) {
+                   unsigned int cols, int delta_q[MAX_SEGMENTS],
+                   int delta_lf[MAX_SEGMENTS],
+                   unsigned int threshold[MAX_SEGMENTS]) {
   VP9_COMP *cpi = (VP9_COMP *) comp;
-  signed char feature_data[SEG_LVL_MAX][MAX_MB_SEGMENTS];
+  signed char feature_data[SEG_LVL_MAX][MAX_SEGMENTS];
   MACROBLOCKD *xd = &cpi->mb.e_mbd;
   int i;
 
@@ -3996,14 +3996,14 @@ int vp9_set_roimap(VP9_PTR comp, unsigned char *map, unsigned int rows,
   vp9_enable_segmentation((VP9_PTR)cpi);
 
   // Set up the quan, LF and breakout threshold segment data
-  for (i = 0; i < MAX_MB_SEGMENTS; i++) {
+  for (i = 0; i < MAX_SEGMENTS; i++) {
     feature_data[SEG_LVL_ALT_Q][i] = delta_q[i];
     feature_data[SEG_LVL_ALT_LF][i] = delta_lf[i];
     cpi->segment_encode_breakout[i] = threshold[i];
   }
 
   // Enable the loop and quant changes in the feature mask
-  for (i = 0; i < MAX_MB_SEGMENTS; i++) {
+  for (i = 0; i < MAX_SEGMENTS; i++) {
     if (delta_q[i])
       vp9_enable_segfeature(&xd->seg, i, SEG_LVL_ALT_Q);
     else
diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h
index 2c65fecd17..5ad81d10f9 100644
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -513,7 +513,7 @@ typedef struct VP9_COMP {
   unsigned char *segmentation_map;
 
   // segment threashold for encode breakout
-  int  segment_encode_breakout[MAX_MB_SEGMENTS];
+  int  segment_encode_breakout[MAX_SEGMENTS];
 
   unsigned char *active_map;
   unsigned int active_map_enabled;
diff --git a/vp9/encoder/vp9_segmentation.c b/vp9/encoder/vp9_segmentation.c
index 8d5b3860c8..ef84cc5c09 100644
--- a/vp9/encoder/vp9_segmentation.c
+++ b/vp9/encoder/vp9_segmentation.c
@@ -219,11 +219,11 @@ void vp9_choose_segmap_coding_method(VP9_COMP *cpi) {
   int i, tile_col, mi_row, mi_col;
 
   int temporal_predictor_count[PREDICTION_PROBS][2];
-  int no_pred_segcounts[MAX_MB_SEGMENTS];
-  int t_unpred_seg_counts[MAX_MB_SEGMENTS];
+  int no_pred_segcounts[MAX_SEGMENTS];
+  int t_unpred_seg_counts[MAX_SEGMENTS];
 
-  vp9_prob no_pred_tree[MB_SEG_TREE_PROBS];
-  vp9_prob t_pred_tree[MB_SEG_TREE_PROBS];
+  vp9_prob no_pred_tree[SEG_TREE_PROBS];
+  vp9_prob t_pred_tree[SEG_TREE_PROBS];
   vp9_prob t_nopred_prob[PREDICTION_PROBS];
 
   const int mis = cm->mode_info_stride;
-- 
GitLab