ref: c37d012ada8e985adcfecbb4591d276f7e427eb0
parent: cfd92dab18639c7f1198393ce04613e6d2b126eb
parent: 7a730d5901e095093dcbc7201f2f2c72d566317d
author: Yury Gitman <yuryg@google.com>
date: Mon Aug 8 17:29:40 EDT 2016
Merge "Add cpi parameter for forcing segmentation update"
--- a/vp9/encoder/vp9_aq_360.c
+++ b/vp9/encoder/vp9_aq_360.c
@@ -41,7 +41,8 @@
struct segmentation *seg = &cm->seg;
int i;
- if (frame_is_intra_only(cm) || cm->error_resilient_mode) {
+ if (frame_is_intra_only(cm) || cpi->force_update_segmentation ||
+ cm->error_resilient_mode) {
vp9_enable_segmentation(seg);
vp9_clearall_segfeatures(seg);
--- a/vp9/encoder/vp9_aq_complexity.c
+++ b/vp9/encoder/vp9_aq_complexity.c
@@ -52,7 +52,7 @@
vpx_clear_system_state();
if (frame_is_intra_only(cm) || cm->error_resilient_mode ||
- cpi->refresh_alt_ref_frame ||
+ cpi->refresh_alt_ref_frame || cpi->force_update_segmentation ||
(cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref)) {
int segment;
const int aq_strength = get_aq_c_strength(cm->base_qindex, cm->bit_depth);
--- a/vp9/encoder/vp9_aq_cyclicrefresh.c
+++ b/vp9/encoder/vp9_aq_cyclicrefresh.c
@@ -502,7 +502,7 @@
if (cm->current_video_frame == 0) cr->low_content_avg = 0.0;
// Don't apply refresh on key frame or temporal enhancement layer frames.
if (!apply_cyclic_refresh || (cm->frame_type == KEY_FRAME) ||
- (cpi->svc.temporal_layer_id > 0)) {
+ (cpi->force_update_segmentation) || (cpi->svc.temporal_layer_id > 0)) {
// Set segmentation map to 0 and disable.
unsigned char *const seg_map = cpi->segmentation_map;
memset(seg_map, 0, cm->mi_rows * cm->mi_cols);
--- a/vp9/encoder/vp9_aq_variance.c
+++ b/vp9/encoder/vp9_aq_variance.c
@@ -49,7 +49,7 @@
int i;
if (frame_is_intra_only(cm) || cm->error_resilient_mode ||
- cpi->refresh_alt_ref_frame ||
+ cpi->refresh_alt_ref_frame || cpi->force_update_segmentation ||
(cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref)) {
vp9_enable_segmentation(seg);
vp9_clearall_segfeatures(seg);
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -1338,7 +1338,9 @@
if (aq_mode == VARIANCE_AQ) {
const int energy =
bsize <= BLOCK_16X16 ? x->mb_energy : vp9_block_energy(cpi, x, bsize);
+
if (cm->frame_type == KEY_FRAME || cpi->refresh_alt_ref_frame ||
+ cpi->force_update_segmentation ||
(cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref)) {
mi->segment_id = vp9_vaq_segment_id(energy);
} else {
@@ -1348,7 +1350,7 @@
}
x->rdmult = set_segment_rdmult(cpi, x, mi->segment_id);
} else if (aq_mode == EQUATOR360_AQ) {
- if (cm->frame_type == KEY_FRAME) {
+ if (cm->frame_type == KEY_FRAME || cpi->force_update_segmentation) {
mi->segment_id = vp9_360aq_segment_id(mi_row, cm->mi_rows);
} else {
const uint8_t *const map =
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -477,6 +477,9 @@
TWO_PASS twopass;
+ // Force recalculation of segment_ids for each mode info
+ uint8_t force_update_segmentation;
+
YV12_BUFFER_CONFIG alt_ref_buffer;
#if CONFIG_INTERNAL_STATS