ref: 545f096ef23d4f70062379d9c4184b15189c2143
parent: 09ed15d255d96e87ef388ddda7c276dd14042c37
author: Jerome Jiang <jianj@google.com>
date: Mon Nov 26 12:10:37 EST 2018
VP9 SVC: fix crash on scaling partition. When scaling up partition from lower resolution layer L, mi_row and mi_col from L must be smaller than mi_rows and mi_cols from L. Before this change, the condition was based on mi_rows from top layer divided by 2, which is not necessarily equal to the mi_rows from lower resolution layer. Added variable in SVC structure to keep track of mi_rows and mi_cols from each spatial layer. Re-enable partition scaling for 1080p. BUG=webm:1578 Change-Id: Icc1c701b095cfe0a92bfecca1ed39dbe21da12b6
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -930,7 +930,9 @@
PARTITION_TYPE partition_high;
if (mi_row_high >= cm->mi_rows || mi_col_high >= cm->mi_cols) return 0;
- if (mi_row >= (cm->mi_rows >> 1) || mi_col >= (cm->mi_cols >> 1)) return 0;
+ if (mi_row >= svc->mi_rows[svc->spatial_layer_id - 1] ||
+ mi_col >= svc->mi_cols[svc->spatial_layer_id - 1])
+ return 0;
// Find corresponding (mi_col/mi_row) block down-scaled by 2x2.
start_pos = mi_row * (svc->mi_stride[svc->spatial_layer_id - 1]) + mi_col;
@@ -5658,7 +5660,6 @@
xd->mi = cm->mi_grid_visible;
xd->mi[0] = cm->mi;
-
vp9_zero(*td->counts);
vp9_zero(cpi->td.rd_counts);
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -713,8 +713,7 @@
// TODO(jianj): Investigate webm:1578
if (cpi->use_svc && cpi->svc.use_partition_reuse &&
cpi->svc.number_spatial_layers == 3 && cpi->svc.temporal_layer_id > 0 &&
- cpi->oxcf.width * cpi->oxcf.height > 640 * 480 &&
- cpi->oxcf.width * cpi->oxcf.height < 1920 * 1080)
+ cpi->oxcf.width * cpi->oxcf.height > 640 * 480)
sf->svc_use_lowres_part = 1;
// For SVC when golden is used as second temporal reference: to avoid
// encode time increase only use this feature on base temporal layer.
--- a/vp9/encoder/vp9_svc_layercontext.c
+++ b/vp9/encoder/vp9_svc_layercontext.c
@@ -737,6 +737,8 @@
}
svc->force_zero_mode_spatial_ref = 1;
svc->mi_stride[svc->spatial_layer_id] = cpi->common.mi_stride;
+ svc->mi_rows[svc->spatial_layer_id] = cpi->common.mi_rows;
+ svc->mi_cols[svc->spatial_layer_id] = cpi->common.mi_cols;
if (svc->temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_0212) {
set_flags_and_fb_idx_for_temporal_mode3(cpi);
--- a/vp9/encoder/vp9_svc_layercontext.h
+++ b/vp9/encoder/vp9_svc_layercontext.h
@@ -125,6 +125,8 @@
BLOCK_SIZE *prev_partition_svc;
int mi_stride[VPX_MAX_LAYERS];
+ int mi_rows[VPX_MAX_LAYERS];
+ int mi_cols[VPX_MAX_LAYERS];
int first_layer_denoise;