[segment] Remove coding of seg->abs_delta

Remove the option of raw data or delta when coding the
segment data, then only use delta coding.

Raw data coding of segment data has been nowhere used but
the option of "raw or delta codig of seg_data" has been coded to a bitstream.

Change-Id: Iaf8f21692452d0c9a127b958812c6151d3c5db05
diff --git a/av1/common/av1_loopfilter.c b/av1/common/av1_loopfilter.c
index 0fe2d3e..7f5c4dc 100644
--- a/av1/common/av1_loopfilter.c
+++ b/av1/common/av1_loopfilter.c
@@ -638,16 +638,12 @@
     const int seg_lf_feature_id = seg_lvl_lf_lut[plane][dir_idx];
     if (segfeature_active(&cm->seg, segment_id, seg_lf_feature_id)) {
       const int data = get_segdata(&cm->seg, segment_id, seg_lf_feature_id);
-      lvl_seg =
-          clamp(cm->seg.abs_delta == SEGMENT_ABSDATA ? data : lvl_seg + data, 0,
-                MAX_LOOP_FILTER);
+      lvl_seg = clamp(lvl_seg + data, 0, MAX_LOOP_FILTER);
     }
 #else
     if (segfeature_active(&cm->seg, segment_id, SEG_LVL_ALT_LF)) {
       const int data = get_segdata(&cm->seg, segment_id, SEG_LVL_ALT_LF);
-      lvl_seg =
-          clamp(cm->seg.abs_delta == SEGMENT_ABSDATA ? data : lvl_seg + data, 0,
-                MAX_LOOP_FILTER);
+      lvl_seg = clamp(lvl_seg + data, 0, MAX_LOOP_FILTER);
     }
 #endif  // CONFIG_LOOPFILTER_LEVEL
 
@@ -745,16 +741,12 @@
       const int seg_lf_feature_id = seg_lvl_lf_lut[plane][dir];
       if (segfeature_active(seg, seg_id, seg_lf_feature_id)) {
         const int data = get_segdata(&cm->seg, seg_id, seg_lf_feature_id);
-        lvl_seg =
-            clamp(seg->abs_delta == SEGMENT_ABSDATA ? data : lvl_seg + data, 0,
-                  MAX_LOOP_FILTER);
+        lvl_seg = clamp(lvl_seg + data, 0, MAX_LOOP_FILTER);
       }
 #else
       if (segfeature_active(seg, seg_id, SEG_LVL_ALT_LF)) {
         const int data = get_segdata(seg, seg_id, SEG_LVL_ALT_LF);
-        lvl_seg =
-            clamp(seg->abs_delta == SEGMENT_ABSDATA ? data : lvl_seg + data, 0,
-                  MAX_LOOP_FILTER);
+        lvl_seg = clamp(lvl_seg + data, 0, MAX_LOOP_FILTER);
       }
 #endif  // CONFIG_LOOPFILTER_LEVEL
 
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c
index 533bbe3..dcf52a1 100644
--- a/av1/common/entropymode.c
+++ b/av1/common/entropymode.c
@@ -6110,7 +6110,6 @@
 
   int i;
   av1_clearall_segfeatures(&cm->seg);
-  cm->seg.abs_delta = SEGMENT_DELTADATA;
 
   if (cm->last_frame_seg_map && !cm->frame_parallel_decode)
     memset(cm->last_frame_seg_map, 0, (cm->mi_rows * cm->mi_cols));
diff --git a/av1/common/quant_common.c b/av1/common/quant_common.c
index 10dd88a..f14c539 100644
--- a/av1/common/quant_common.c
+++ b/av1/common/quant_common.c
@@ -333,8 +333,7 @@
                    int base_qindex) {
   if (segfeature_active(seg, segment_id, SEG_LVL_ALT_Q)) {
     const int data = get_segdata(seg, segment_id, SEG_LVL_ALT_Q);
-    const int seg_qindex =
-        seg->abs_delta == SEGMENT_ABSDATA ? data : base_qindex + data;
+    const int seg_qindex = base_qindex + data;
     return clamp(seg_qindex, 0, MAXQ);
   } else {
     return base_qindex;
diff --git a/av1/common/seg_common.h b/av1/common/seg_common.h
index f548276..44011dc 100644
--- a/av1/common/seg_common.h
+++ b/av1/common/seg_common.h
@@ -18,9 +18,6 @@
 extern "C" {
 #endif
 
-#define SEGMENT_DELTADATA 0
-#define SEGMENT_ABSDATA 1
-
 #define MAX_SEGMENTS 8
 #define SEG_TREE_PROBS (MAX_SEGMENTS - 1)
 
@@ -62,7 +59,6 @@
   uint8_t enabled;
   uint8_t update_map;
   uint8_t update_data;
-  uint8_t abs_delta;
   uint8_t temporal_update;
 
   int16_t feature_data[MAX_SEGMENTS][SEG_LVL_MAX];
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index d6f7084..d46b5a1 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -1089,8 +1089,6 @@
   // Segmentation data update
   seg->update_data = aom_rb_read_bit(rb);
   if (seg->update_data) {
-    seg->abs_delta = aom_rb_read_bit(rb);
-
     av1_clearall_segfeatures(seg);
 
     for (i = 0; i < MAX_SEGMENTS; i++) {
diff --git a/av1/encoder/aq_complexity.c b/av1/encoder/aq_complexity.c
index 054b0e0..33e53bc 100644
--- a/av1/encoder/aq_complexity.c
+++ b/av1/encoder/aq_complexity.c
@@ -74,9 +74,6 @@
 
     av1_enable_segmentation(seg);
 
-    // Select delta coding method.
-    seg->abs_delta = SEGMENT_DELTADATA;
-
     // Default segment "Q" feature is disabled so it defaults to the baseline Q.
     av1_disable_segfeature(seg, DEFAULT_AQ2_SEG, SEG_LVL_ALT_Q);
 
diff --git a/av1/encoder/aq_cyclicrefresh.c b/av1/encoder/aq_cyclicrefresh.c
index 44a4a94..12bdc80 100644
--- a/av1/encoder/aq_cyclicrefresh.c
+++ b/av1/encoder/aq_cyclicrefresh.c
@@ -509,8 +509,6 @@
     // Clear down the segment map.
     av1_enable_segmentation(&cm->seg);
     av1_clearall_segfeatures(seg);
-    // Select delta coding method.
-    seg->abs_delta = SEGMENT_DELTADATA;
 
     // Note: setting temporal_update has no effect, as the seg-map coding method
     // (temporal or spatial) is determined in
diff --git a/av1/encoder/aq_variance.c b/av1/encoder/aq_variance.c
index 84d9672..da713df 100644
--- a/av1/encoder/aq_variance.c
+++ b/av1/encoder/aq_variance.c
@@ -57,8 +57,6 @@
     av1_enable_segmentation(seg);
     av1_clearall_segfeatures(seg);
 
-    seg->abs_delta = SEGMENT_DELTADATA;
-
     aom_clear_system_state();
 
     for (i = 0; i < MAX_SEGMENTS; ++i) {
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index e180030..d2a8c3a 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -2728,8 +2728,6 @@
   // Segmentation data
   aom_wb_write_bit(wb, seg->update_data);
   if (seg->update_data) {
-    aom_wb_write_bit(wb, seg->abs_delta);
-
     for (i = 0; i < MAX_SEGMENTS; i++) {
       for (j = 0; j < SEG_LVL_MAX; j++) {
         const int active = segfeature_active(seg, i, j);
@@ -3942,7 +3940,6 @@
         aom_wb_write_literal(wb, OD_ILOG_NZ(cm->delta_q_res) - 1, 2);
         xd->prev_qindex = cm->base_qindex;
 #if CONFIG_EXT_DELTA_Q
-        assert(cm->seg.abs_delta == SEGMENT_DELTADATA);
         aom_wb_write_bit(wb, cm->delta_lf_present_flag);
         if (cm->delta_lf_present_flag) {
           aom_wb_write_literal(wb, OD_ILOG_NZ(cm->delta_lf_res) - 1, 2);
@@ -4292,7 +4289,6 @@
         aom_wb_write_literal(wb, OD_ILOG_NZ(cm->delta_q_res) - 1, 2);
         xd->prev_qindex = cm->base_qindex;
 #if CONFIG_EXT_DELTA_Q
-        assert(cm->seg.abs_delta == SEGMENT_DELTADATA);
         aom_wb_write_bit(wb, cm->delta_lf_present_flag);
         if (cm->delta_lf_present_flag) {
           aom_wb_write_literal(wb, OD_ILOG_NZ(cm->delta_lf_res) - 1, 2);
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 202e133..fbc00eb 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -194,7 +194,7 @@
 #else
       av1_enable_segfeature(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_ALT_LF);
       // Setting the data to -MAX_LOOP_FILTER will result in the computed loop
-      // filter level being zero regardless of the value of seg->abs_delta.
+      // filter level being zero.
       av1_set_segdata(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_ALT_LF,
                       -MAX_LOOP_FILTER);
 #endif  // CONFIG_LOOPFILTER_LEVEL
@@ -663,9 +663,6 @@
 #endif  // CONFIG_LOOPFILTER_LEVEL
 
       av1_enable_segfeature(seg, 1, SEG_LVL_ALT_Q);
-
-      // Where relevant assume segment data is delta data
-      seg->abs_delta = SEGMENT_DELTADATA;
     }
   } else if (seg->enabled) {
     // All other frames if segmentation has been enabled
@@ -676,7 +673,6 @@
       if (rc->source_alt_ref_active) {
         seg->update_map = 0;
         seg->update_data = 1;
-        seg->abs_delta = SEGMENT_DELTADATA;
 
         qi_delta =
             av1_compute_qdelta(rc, rc->avg_q, rc->avg_q * 1.125, cm->bit_depth);