ref: 0acc7365abf97214a045c14f66e5934884395e6d
parent: aab2aff9aa264d573852f4dce34bea47708cf1be
author: James Zern <[email protected]>
date: Tue Aug 7 16:07:09 EDT 2018
loop_filter_rows_mt: use sb_rows to limit workers Previously if the number of tiles decreased within a clip and there were fewer super block rows than workers the mi_row calculation would cause rows to be skipped. The num_workers stored is the max allocated amount, use sb_rows to limit the active ones if the row count is smaller as additional threads will provide no benefit. Change-Id: I1750296c8c21082de2594afecc4d6a3929db1f12
--- a/vp9/common/vp9_thread_common.c
+++ b/vp9/common/vp9_thread_common.c
@@ -91,6 +91,7 @@
int y_only, VP9LfSync *const lf_sync) {
const int num_planes = y_only ? 1 : MAX_MB_PLANE;
const int sb_cols = mi_cols_aligned_to_sb(cm->mi_cols) >> MI_BLOCK_SIZE_LOG2;
+ const int num_active_workers = VPXMIN(lf_sync->num_workers, lf_sync->rows);
int mi_row, mi_col;
enum lf_path path;
if (y_only)
@@ -103,7 +104,7 @@
path = LF_PATH_SLOW;
for (mi_row = start; mi_row < stop;
- mi_row += lf_sync->num_workers * MI_BLOCK_SIZE) {
+ mi_row += num_active_workers * MI_BLOCK_SIZE) {
MODE_INFO **const mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
LOOP_FILTER_MASK *lfm = get_lfm(&cm->lf, mi_row, 0);
@@ -157,10 +158,7 @@
const VPxWorkerInterface *const winterface = vpx_get_worker_interface();
// Number of superblock rows and cols
const int sb_rows = mi_cols_aligned_to_sb(cm->mi_rows) >> MI_BLOCK_SIZE_LOG2;
- // Decoder may allocate more threads than number of tiles based on user's
- // input.
- const int tile_cols = 1 << cm->log2_tile_cols;
- const int num_workers = VPXMIN(nworkers, tile_cols);
+ const int num_workers = VPXMIN(nworkers, sb_rows);
int i;
if (!lf_sync->sync_range || sb_rows != lf_sync->rows ||