Commit b3c93d60 authored by Marco's avatar Marco

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
parent 8d471fce
......@@ -1255,13 +1255,13 @@ static int choose_partitioning(VP9_COMP *cpi, const TileInfo *const tile,
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 @@ static int choose_partitioning(VP9_COMP *cpi, const TileInfo *const tile,
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 @@ static int choose_partitioning(VP9_COMP *cpi, const TileInfo *const tile,
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 @@ static int choose_partitioning(VP9_COMP *cpi, const TileInfo *const tile,
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 @@ static int choose_partitioning(VP9_COMP *cpi, const TileInfo *const tile,
}
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) {
......
......@@ -3553,7 +3553,8 @@ static void encode_without_recode_loop(VP9_COMP *cpi, size_t *size,
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,
......
......@@ -607,7 +607,10 @@ static void set_rt_speed_feature_framesize_independent(
}
// 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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment