Commit d728c216 authored by Yushin Cho's avatar Yushin Cho

[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
parent accfe39a
......@@ -638,16 +638,12 @@ static uint8_t get_filter_level(const AV1_COMMON *cm,
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 @@ void av1_loop_filter_frame_init(AV1_COMMON *cm, int default_filt_lvl,
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
......
......@@ -6110,7 +6110,6 @@ void av1_setup_past_independence(AV1_COMMON *cm) {
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));
......
......@@ -333,8 +333,7 @@ int av1_get_qindex(const struct segmentation *seg, int segment_id,
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;
......
......@@ -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 @@ struct segmentation {
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];
......
......@@ -1089,8 +1089,6 @@ static void setup_segmentation(AV1_COMMON *const cm,
// 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++) {
......
......@@ -74,9 +74,6 @@ void av1_setup_in_frame_q_adj(AV1_COMP *cpi) {
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);
......
......@@ -509,8 +509,6 @@ void av1_cyclic_refresh_setup(AV1_COMP *const cpi) {
// 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
......
......@@ -57,8 +57,6 @@ void av1_vaq_frame_setup(AV1_COMP *cpi) {
av1_enable_segmentation(seg);
av1_clearall_segfeatures(seg);
seg->abs_delta = SEGMENT_DELTADATA;
aom_clear_system_state();
for (i = 0; i < MAX_SEGMENTS; ++i) {
......
......@@ -2728,8 +2728,6 @@ static void encode_segmentation(AV1_COMMON *cm, MACROBLOCKD *xd,
// 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 @@ static void write_uncompressed_header_frame(AV1_COMP *cpi,
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 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
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);
......
......@@ -194,7 +194,7 @@ static void apply_active_map(AV1_COMP *cpi) {
#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 @@ static void configure_static_seg_features(AV1_COMP *cpi) {
#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 @@ static void configure_static_seg_features(AV1_COMP *cpi) {
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment