summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
authorPaul Wilkins <paulwilkins@google.com>2013-05-31 02:56:20 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2013-05-31 02:56:20 -0700
commitaaf61dfbcab414bfacc3171501be17d191ff8506 (patch)
tree55d21504fdd3ea63cc633cfc329f40aaaf1a33d5 /vp9
parent7ca651a38391a3e8ec42f8de56fe7264dc3a6d2f (diff)
parent1b103f250f36f6b20d245f717faa477649f9fec7 (diff)
downloadlibvpx-aaf61dfbcab414bfacc3171501be17d191ff8506.tar
libvpx-aaf61dfbcab414bfacc3171501be17d191ff8506.tar.gz
libvpx-aaf61dfbcab414bfacc3171501be17d191ff8506.tar.bz2
libvpx-aaf61dfbcab414bfacc3171501be17d191ff8506.zip
Merge "Patch to remove implicit segmentation." into experimental
Diffstat (limited to 'vp9')
-rw-r--r--vp9/common/vp9_blockd.h4
-rw-r--r--vp9/common/vp9_seg_common.c79
-rw-r--r--vp9/common/vp9_seg_common.h5
-rw-r--r--vp9/decoder/vp9_decodframe.c13
-rw-r--r--vp9/encoder/vp9_bitstream.c3
-rw-r--r--vp9/encoder/vp9_onyx_if.c78
6 files changed, 0 insertions, 182 deletions
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h
index 1b6ed68d8..8d155fc3d 100644
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -306,10 +306,6 @@ typedef struct macroblockd {
/* 0 (do not update) 1 (update) the macroblock segmentation map. */
unsigned char update_mb_segmentation_map;
-#if CONFIG_IMPLICIT_SEGMENTATION
- unsigned char allow_implicit_segment_update;
-#endif
-
/* 0 (do not update) 1 (update) the macroblock segmentation feature data. */
unsigned char update_mb_segmentation_data;
diff --git a/vp9/common/vp9_seg_common.c b/vp9/common/vp9_seg_common.c
index e5511a123..67dfeaed6 100644
--- a/vp9/common/vp9_seg_common.c
+++ b/vp9/common/vp9_seg_common.c
@@ -86,85 +86,6 @@ int vp9_check_segref(const MACROBLOCKD *xd, int segment_id,
}
-#if CONFIG_IMPLICIT_SEGMENTATION
-// This function defines an implicit segmentation for the next frame based
-// on predcition and transform decisions in the current frame.
-// For test purposes at the moment it uses ref frame and prediction size
-void vp9_implicit_segment_map_update(VP9_COMMON * cm) {
- int row, col;
- MODE_INFO *mi, *mi_ptr = cm->mi;
- unsigned char * map_ptr = cm->last_frame_seg_map;
-
- for (row = 0; row < cm->mb_rows; row++) {
- mi = mi_ptr;
-
- for (col = 0; col < cm->mb_cols; ++col, ++mi) {
- // Inter prediction
- if (mi->mbmi.ref_frame != INTRA_FRAME) {
- // Zero motion and prediction block size >= 16
- if ((mi->mbmi.sb_type >= BLOCK_SIZE_MB16X16) &&
- (mi->mbmi.mv[0].as_int == 0))
- map_ptr[col] = 1;
- else if (mi->mbmi.sb_type >= BLOCK_SIZE_SB32X32)
- map_ptr[col] = 2;
- else if (mi->mbmi.sb_type >= BLOCK_SIZE_MB16X16)
- map_ptr[col] = 3;
- else
- map_ptr[col] = 6;
-
- // Intra prediction
- } else {
- if (mi->mbmi.sb_type >= BLOCK_SIZE_SB32X32)
- map_ptr[col] = 4;
- else if (mi->mbmi.sb_type >= BLOCK_SIZE_MB16X16)
- map_ptr[col] = 5;
- else
- map_ptr[col] = 7;
- }
- }
- mi_ptr += cm->mode_info_stride;
- map_ptr += cm->mb_cols;
- }
-}
-
-// This function defines an implicit segmentation for the next frame based
-// on predcition and transform decisions in the current frame.
-// For test purposes at the moment only TX size is used.
-void vp9_implicit_segment_map_update_tx(VP9_COMMON * cm) {
- int row, col;
- MODE_INFO *mi, *mi_ptr = cm->mi;
- unsigned char * map_ptr = cm->last_frame_seg_map;
-
- for (row = 0; row < cm->mb_rows; row++) {
- mi = mi_ptr;
- for (col = 0; col < cm->mb_cols; ++col, ++mi) {
- // Intra modes
- if (mi->mbmi.ref_frame == INTRA_FRAME) {
- if (mi->mbmi.txfm_size == TX_4X4)
- map_ptr[col] = 7;
- else if (mi->mbmi.txfm_size <= TX_16X16)
- map_ptr[col] = 5;
- else
- map_ptr[col] = 4;
- } else {
- // Inter Modes
- if (mi->mbmi.txfm_size == TX_4X4)
- map_ptr[col] = 6;
- else if (mi->mbmi.txfm_size == TX_8X8)
- map_ptr[col] = 3;
- else if (mi->mbmi.txfm_size == TX_16X16)
- map_ptr[col] = 2;
- else
- map_ptr[col] = 1;
- }
- }
- mi_ptr += cm->mode_info_stride;
- map_ptr += cm->mb_cols;
- }
-}
-#endif
-
-
const vp9_tree_index vp9_segment_tree[14] = {
2, 4, 6, 8, 10, 12,
0, -1, -2, -3, -4, -5, -6, -7
diff --git a/vp9/common/vp9_seg_common.h b/vp9/common/vp9_seg_common.h
index 53d22a385..c424a57f4 100644
--- a/vp9/common/vp9_seg_common.h
+++ b/vp9/common/vp9_seg_common.h
@@ -55,11 +55,6 @@ int vp9_check_segref(const MACROBLOCKD *xd,
int segment_id,
MV_REFERENCE_FRAME ref_frame);
-#if CONFIG_IMPLICIT_SEGMENTATION
-void vp9_implicit_segment_map_update(VP9_COMMON * cm);
-#endif
-
-
extern const vp9_tree_index vp9_segment_tree[14];
#endif // VP9_COMMON_VP9_SEG_COMMON_H_
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c
index a1cfba73b..8e5e83c95 100644
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -629,9 +629,6 @@ static void setup_segmentation(VP9_COMMON *pc, MACROBLOCKD *xd, vp9_reader *r) {
xd->update_mb_segmentation_map = 0;
xd->update_mb_segmentation_data = 0;
-#if CONFIG_IMPLICIT_SEGMENTATION
- xd->allow_implicit_segment_update = 0;
-#endif
xd->segmentation_enabled = vp9_read_bit(r);
if (!xd->segmentation_enabled)
@@ -639,9 +636,6 @@ static void setup_segmentation(VP9_COMMON *pc, MACROBLOCKD *xd, vp9_reader *r) {
// Segmentation map update
xd->update_mb_segmentation_map = vp9_read_bit(r);
-#if CONFIG_IMPLICIT_SEGMENTATION
- xd->allow_implicit_segment_update = vp9_read_bit(r);
-#endif
if (xd->update_mb_segmentation_map) {
for (i = 0; i < MB_SEG_TREE_PROBS; i++)
xd->mb_segment_tree_probs[i] = vp9_read_bit(r) ? vp9_read_prob(r)
@@ -1129,13 +1123,6 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
}
}
-#if CONFIG_IMPLICIT_SEGMENTATION
- // If signalled at the frame level apply implicit updates to the segment map.
- if (!pc->error_resilient_mode && xd->allow_implicit_segment_update) {
- vp9_implicit_segment_map_update(pc);
- }
-#endif
-
if (pc->refresh_frame_context)
pc->frame_contexts[pc->frame_context_idx] = pc->fc;
diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c
index 7d250b346..a95d7eb46 100644
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -1364,9 +1364,6 @@ static void encode_segmentation(VP9_COMP *cpi, vp9_writer *w) {
// Segmentation map
vp9_write_bit(w, xd->update_mb_segmentation_map);
-#if CONFIG_IMPLICIT_SEGMENTATION
- vp9_write_bit(w, xd->allow_implicit_segment_update);
-#endif
if (xd->update_mb_segmentation_map) {
// Select the coding strategy (temporal or spatial)
vp9_choose_segmap_coding_method(cpi);
diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c
index e61d212d7..f0dba737a 100644
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -267,9 +267,6 @@ static void setup_features(VP9_COMP *cpi) {
xd->update_mb_segmentation_map = 0;
xd->update_mb_segmentation_data = 0;
-#if CONFIG_IMPLICIT_SEGMENTATION
- xd->allow_implicit_segment_update = 0;
-#endif
vpx_memset(xd->mb_segment_tree_probs, 255, sizeof(xd->mb_segment_tree_probs));
vp9_clearall_segfeatures(xd);
@@ -354,9 +351,6 @@ static void configure_static_seg_features(VP9_COMP *cpi) {
vpx_memset(cpi->segmentation_map, 0, cm->mi_rows * cm->mi_cols);
xd->update_mb_segmentation_map = 0;
xd->update_mb_segmentation_data = 0;
-#if CONFIG_IMPLICIT_SEGMENTATION
- xd->allow_implicit_segment_update = 0;
-#endif
cpi->static_mb_pct = 0;
// Disable segmentation
@@ -370,9 +364,6 @@ static void configure_static_seg_features(VP9_COMP *cpi) {
vpx_memset(cpi->segmentation_map, 0, cm->mi_rows * cm->mi_cols);
xd->update_mb_segmentation_map = 0;
xd->update_mb_segmentation_data = 0;
-#if CONFIG_IMPLICIT_SEGMENTATION
- xd->allow_implicit_segment_update = 0;
-#endif
cpi->static_mb_pct = 0;
// Disable segmentation and individual segment features by default
@@ -471,53 +462,6 @@ static void configure_static_seg_features(VP9_COMP *cpi) {
}
}
-#if CONFIG_IMPLICIT_SEGMENTATION
-static double implict_seg_q_modifiers[MAX_MB_SEGMENTS] =
- {1.0, 0.95, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
-static void configure_implicit_segmentation(VP9_COMP *cpi, int frame_qindex) {
- VP9_COMMON *cm = &cpi->common;
- MACROBLOCKD *xd = &cpi->mb.e_mbd;
- int i;
- int qi_delta;
- double q_baseline = vp9_convert_qindex_to_q(frame_qindex);
-
- // Set the flags to allow implicit segment update but disallow explicit update
- xd->segmentation_enabled = 1;
- xd->allow_implicit_segment_update = 1;
- xd->update_mb_segmentation_map = 0;
-
- // For key frames clear down the segment map to a default state.
- if (cm->frame_type == KEY_FRAME) {
- // Clear down the global segmentation map
- vpx_memset(cpi->segmentation_map, 0, (cm->mb_rows * cm->mb_cols));
-
- // Clear down the segment features.
- vp9_clearall_segfeatures(xd);
-
- xd->update_mb_segmentation_data = 0;
-
- // Update the segment data if it is an arf or non overlay gf.
- } else if (cpi->refresh_alt_ref_frame ||
- (cpi->refresh_golden_frame && !cpi->is_src_frame_alt_ref)) {
- xd->update_mb_segmentation_data = 1;
-
- // Enable use of q deltas on segments 1 and up
- // Segment 0 is treated as a neutral segment with no changes
- for (i = 1; i < MAX_MB_SEGMENTS; ++i) {
- qi_delta = compute_qdelta(cpi, q_baseline,
- implict_seg_q_modifiers[i] * q_baseline);
- vp9_set_segdata(xd, i, SEG_LVL_ALT_Q, qi_delta);
- vp9_enable_segfeature(xd, i, SEG_LVL_ALT_Q);
- }
-
- // Where relevant assume segment data is delta data
- xd->mb_segment_abs_delta = SEGMENT_DELTADATA;
- } else {
- xd->update_mb_segmentation_data = 0;
- }
-}
-#endif
-
#ifdef ENTROPY_STATS
void vp9_update_mode_context_stats(VP9_COMP *cpi) {
VP9_COMMON *cm = &cpi->common;
@@ -799,12 +743,8 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
// Switch segmentation off.
sf->static_segmentation = 0;
#else
-#if CONFIG_IMPLICIT_SEGMENTATION
- sf->static_segmentation = 0;
-#else
sf->static_segmentation = 0;
#endif
-#endif
sf->mb16_breakout = 0;
switch (mode) {
@@ -817,12 +757,8 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
// Switch segmentation off.
sf->static_segmentation = 0;
#else
-#if CONFIG_IMPLICIT_SEGMENTATION
- sf->static_segmentation = 0;
-#else
sf->static_segmentation = 0;
#endif
-#endif
sf->mb16_breakout = 0;
break;
@@ -2907,12 +2843,6 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
}
}
-#if CONFIG_IMPLICIT_SEGMENTATION
- if (!cm->error_resilient_mode && !cpi->sf.static_segmentation) {
- configure_implicit_segmentation(cpi, q);
- }
-#endif
-
// transform / motion compensation build reconstruction frame
vp9_encode_frame(cpi);
@@ -3156,15 +3086,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
cpi->dummy_packing = 0;
vp9_pack_bitstream(cpi, dest, size);
-#if CONFIG_IMPLICIT_SEGMENTATION
- // Should we allow implicit update of the segment map.
- if (xd->allow_implicit_segment_update && !cm->error_resilient_mode) {
- vp9_implicit_segment_map_update(cm);
- // or has there been an explicit update
- } else if (xd->update_mb_segmentation_map) {
-#else
if (xd->update_mb_segmentation_map) {
-#endif
update_reference_segmentation_map(cpi);
}