ref: b3c93d60c224a672c403bf36fbdecf20314aa2fa
parent: 8d471fcee21b0d33ec7b0980addedd4d38324c5a
author: Marco <marpan@google.com>
date: Tue Nov 14 14:52:54 EST 2017
vp9-svc: Fix flag for usage of reuse-lowres partition Fix/cleaup the conditioning for usage of the reuse-lowres partition feature. Replace the non-reference condition with the top temporal layer, and put this condition in the speed feature. This prevents doing update_partition_svc() on every VGA frame, instead it will now only do update for VGA in the top temporal layer frames. Also this makes it easier to test/enable this feature for lower layer temporal frames. Change-Id: Ia897afbc6fe5c84c5693e310bcaa6a87ce017be5
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -1255,13 +1255,13 @@
if (cpi->content_state_sb_fd != NULL)
x->last_sb_high_content = cpi->content_state_sb_fd[sb_offset2];
- // For SVC on top spatial layer and non_reference frame: copy partition
- // from lower spatial resolution if svc_use_lowres_part is enabled.
+ // For SVC on top spatial layer: use/scale the partition from
+ // the lower spatial resolution if svc_use_lowres_part is enabled.
// TODO(jianj): Fix to allow it to work on boundary.
- if (cpi->sf.svc_use_lowres_part && cpi->svc.spatial_layer_id == 2 &&
- cpi->svc.non_reference_frame && cpi->svc.prev_partition_svc != NULL &&
- mi_row < cm->mi_rows - 8 && mi_col < cm->mi_cols - 8 &&
- content_state != kVeryHighSad) {
+ if (cpi->sf.svc_use_lowres_part &&
+ cpi->svc.spatial_layer_id == cpi->svc.number_spatial_layers - 1 &&
+ cpi->svc.prev_partition_svc != NULL && mi_row < cm->mi_rows - 8 &&
+ mi_col < cm->mi_cols - 8 && content_state != kVeryHighSad) {
copy_partitioning_svc(cpi, x, xd, BLOCK_64X64, mi_row >> 1, mi_col >> 1,
mi_row >> 1, mi_col >> 1, mi_row, mi_col);
return 0;
@@ -1270,7 +1270,8 @@
if (x->skip_low_source_sad && cpi->sf.copy_partition_flag &&
copy_partitioning(cpi, x, xd, mi_row, mi_col, segment_id, sb_offset)) {
x->sb_use_mv_part = 1;
- if (cpi->sf.svc_use_lowres_part && cpi->svc.spatial_layer_id == 1)
+ if (cpi->sf.svc_use_lowres_part &&
+ cpi->svc.spatial_layer_id == cpi->svc.number_spatial_layers - 2)
update_partition_svc(cpi, BLOCK_64X64, mi_row, mi_col);
return 0;
}
@@ -1396,7 +1397,8 @@
set_block_size(cpi, x, xd, mi_row, mi_col, BLOCK_64X64);
x->variance_low[0] = 1;
chroma_check(cpi, x, bsize, y_sad, is_key_frame);
- if (cpi->sf.svc_use_lowres_part && cpi->svc.spatial_layer_id == 1)
+ if (cpi->sf.svc_use_lowres_part &&
+ cpi->svc.spatial_layer_id == cpi->svc.number_spatial_layers - 2)
update_partition_svc(cpi, BLOCK_64X64, mi_row, mi_col);
return 0;
}
@@ -1409,7 +1411,8 @@
if (cpi->sf.copy_partition_flag && y_sad_last < cpi->vbp_threshold_copy &&
copy_partitioning(cpi, x, xd, mi_row, mi_col, segment_id, sb_offset)) {
chroma_check(cpi, x, bsize, y_sad, is_key_frame);
- if (cpi->sf.svc_use_lowres_part && cpi->svc.spatial_layer_id == 1)
+ if (cpi->sf.svc_use_lowres_part &&
+ cpi->svc.spatial_layer_id == cpi->svc.number_spatial_layers - 2)
update_partition_svc(cpi, BLOCK_64X64, mi_row, mi_col);
return 0;
}
@@ -1634,7 +1637,7 @@
}
if (cm->frame_type != KEY_FRAME && cpi->sf.svc_use_lowres_part &&
- cpi->svc.spatial_layer_id == 1)
+ cpi->svc.spatial_layer_id == cpi->svc.number_spatial_layers - 2)
update_partition_svc(cpi, BLOCK_64X64, mi_row, mi_col);
if (cpi->sf.short_circuit_low_temp_var) {
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -3553,7 +3553,8 @@
if (cpi->sf.copy_partition_flag) alloc_copy_partition_data(cpi);
- if (cpi->sf.svc_use_lowres_part && cpi->svc.spatial_layer_id == 1) {
+ if (cpi->sf.svc_use_lowres_part &&
+ cpi->svc.spatial_layer_id == cpi->svc.number_spatial_layers - 2) {
if (cpi->svc.prev_partition_svc == NULL) {
CHECK_MEM_ERROR(
cm, cpi->svc.prev_partition_svc,
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -607,7 +607,10 @@
}
// For SVC: enable use of lower resolution partition for higher resolution,
// only for 3 spatial layers and when config/top resolution is above VGA.
+ // Enable only for top temporal enhancement layer (which are non-reference
+ // frames for the fixed SVC patterns).
if (cpi->use_svc && cpi->svc.number_spatial_layers == 3 &&
+ cpi->svc.temporal_layer_id == cpi->svc.number_temporal_layers - 1 &&
cpi->oxcf.width * cpi->oxcf.height > 640 * 480)
sf->svc_use_lowres_part = 1;
}