diff options
author | Marco Paniconi <marpan@google.com> | 2018-08-09 09:34:05 -0700 |
---|---|---|
committer | Marco Paniconi <marpan@google.com> | 2018-08-09 13:49:42 -0700 |
commit | 45ce790711d0b3bdcc1dc60589731939c3d1b749 (patch) | |
tree | 02c7c2f2489edc1e8dd2d9c8c5d0d1f7ac96e045 /vp9/encoder | |
parent | aab2aff9aa264d573852f4dce34bea47708cf1be (diff) | |
download | libvpx-45ce790711d0b3bdcc1dc60589731939c3d1b749.tar libvpx-45ce790711d0b3bdcc1dc60589731939c3d1b749.tar.gz libvpx-45ce790711d0b3bdcc1dc60589731939c3d1b749.tar.bz2 libvpx-45ce790711d0b3bdcc1dc60589731939c3d1b749.zip |
vp9-svc: Fix for scene detection for SVC
For spatial layers: use the correct mi_cols/rows in the
scene detection. The scene detection for spatial layers
is only called once per superframe, but we were using wrong
mi_cols/rows (those for base spatial were being used).
Also increase frame_since_key threshold to account for spatial
layers.
Change-Id: I2731da49684a798c4718693a0468eda7db82d2bd
Diffstat (limited to 'vp9/encoder')
-rw-r--r-- | vp9/encoder/vp9_ratectrl.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index 1ec696517..e0c877833 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -2636,6 +2636,8 @@ void vp9_scene_detection_onepass(VP9_COMP *cpi) { if (cpi->svc.spatial_layer_id == 0 && src_width == last_src_width && src_height == last_src_height) { YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS] = { NULL }; + int num_mi_cols = cm->mi_cols; + int num_mi_rows = cm->mi_rows; int start_frame = 0; int frames_to_buffer = 1; int frame = 0; @@ -2650,6 +2652,12 @@ void vp9_scene_detection_onepass(VP9_COMP *cpi) { min_thresh = 65000; thresh = 2.1f; } + if (cpi->use_svc && cpi->svc.number_spatial_layers > 1) { + const int aligned_width = ALIGN_POWER_OF_TWO(src_width, MI_SIZE_LOG2); + const int aligned_height = ALIGN_POWER_OF_TWO(src_height, MI_SIZE_LOG2); + num_mi_cols = aligned_width >> MI_SIZE_LOG2; + num_mi_rows = aligned_height >> MI_SIZE_LOG2; + } if (cpi->oxcf.lag_in_frames > 0) { frames_to_buffer = (cm->current_video_frame == 1) ? (int)vp9_lookahead_depth(cpi->lookahead) - 1 @@ -2696,8 +2704,8 @@ void vp9_scene_detection_onepass(VP9_COMP *cpi) { uint64_t avg_sad = 0; uint64_t tmp_sad = 0; int num_samples = 0; - int sb_cols = (cm->mi_cols + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE; - int sb_rows = (cm->mi_rows + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE; + int sb_cols = (num_mi_cols + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE; + int sb_rows = (num_mi_rows + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE; if (cpi->oxcf.lag_in_frames > 0) { src_y = frames[frame]->y_buffer; src_ystride = frames[frame]->y_stride; @@ -2733,7 +2741,7 @@ void vp9_scene_detection_onepass(VP9_COMP *cpi) { if (avg_sad > VPXMAX(min_thresh, (unsigned int)(rc->avg_source_sad[0] * thresh)) && - rc->frames_since_key > 1 && + rc->frames_since_key > 1 + cpi->svc.number_spatial_layers && num_zero_temp_sad < 3 * (num_samples >> 2)) rc->high_source_sad = 1; else |