ref: 9a03154f4657f62ef21901a9117910eb569626b9
parent: 42bcb4a7ad17f5dabf030920929ff32946fef92b
author: Guillaume Martres <[email protected]>
date: Thu Oct 10 07:03:36 EDT 2013
Make the static_segmentation feature work again Change-Id: I766c4b74db526efa4ff6dd2d95ef3e0beb45b6e5
--- a/vp9/encoder/vp9_mbgraph.c
+++ b/vp9/encoder/vp9_mbgraph.c
@@ -312,6 +312,7 @@
static void separate_arf_mbs(VP9_COMP *cpi) {
VP9_COMMON *const cm = &cpi->common;
int mb_col, mb_row, offset, i;
+ int mi_row, mi_col;
int ncnt[4] = { 0 };
int n_frames = cpi->mbgraph_n_frames;
@@ -348,22 +349,17 @@
}
}
- for (offset = 0, mb_row = 0; mb_row < cm->mb_rows;
- offset += cm->mb_cols, mb_row++) {
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) {
+ // arf_not_zz is indexed by MB, but this loop is indexed by MI to avoid out
+ // of bound access in segmentation_map
+ for (mi_row = 0; mi_row < cm->mi_rows; mi_row++) {
+ for (mi_col = 0; mi_col < cm->mi_cols; mi_col++) {
// If any of the blocks in the sequence failed then the MB
// goes in segment 0
- if (arf_not_zz[offset + mb_col]) {
+ if (arf_not_zz[mi_row/2*cm->mb_cols + mi_col/2]) {
ncnt[0]++;
- cpi->segmentation_map[offset * 4 + 2 * mb_col] = 0;
- cpi->segmentation_map[offset * 4 + 2 * mb_col + 1] = 0;
- cpi->segmentation_map[offset * 4 + 2 * mb_col + cm->mi_cols] = 0;
- cpi->segmentation_map[offset * 4 + 2 * mb_col + cm->mi_cols + 1] = 0;
+ cpi->segmentation_map[mi_row * cm->mi_cols + mi_col] = 0;
} else {
- cpi->segmentation_map[offset * 4 + 2 * mb_col] = 1;
- cpi->segmentation_map[offset * 4 + 2 * mb_col + 1] = 1;
- cpi->segmentation_map[offset * 4 + 2 * mb_col + cm->mi_cols] = 1;
- cpi->segmentation_map[offset * 4 + 2 * mb_col + cm->mi_cols + 1] = 1;
+ cpi->segmentation_map[mi_row * cm->mi_cols + mi_col] = 1;
ncnt[1]++;
}
}
@@ -374,7 +370,7 @@
if (1) {
// Note % of blocks that are marked as static
if (cm->MBs)
- cpi->static_mb_pct = (ncnt[1] * 100) / cm->MBs;
+ cpi->static_mb_pct = (ncnt[1] * 100) / (cm->mi_rows * cm->mi_cols);
// This error case should not be reachable as this function should
// never be called with the common data structure uninitialized.
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -445,8 +445,8 @@
// Skip all MBs if high Q (0,0 mv and skip coeffs)
if (high_q) {
- vp9_enable_segfeature(seg, 0, SEG_LVL_SKIP);
- vp9_enable_segfeature(seg, 1, SEG_LVL_SKIP);
+ vp9_enable_segfeature(seg, 0, SEG_LVL_SKIP);
+ vp9_enable_segfeature(seg, 1, SEG_LVL_SKIP);
}
// Enable data update
seg->update_data = 1;
@@ -2912,7 +2912,8 @@
// Set various flags etc to special state if it is a key frame.
if (frame_is_intra_only(cm)) {
- // Reset the loop filter deltas and segmentation map
+ vp9_setup_key_frame(cpi);
+ // Reset the loop filter deltas and segmentation map.
setup_features(cm);
// If segmentation is enabled force a map update for key frames.