]> granicus.if.org Git - libvpx/commitdiff
loop_filter_rows_mt: use sb_rows to limit workers
authorJames Zern <jzern@google.com>
Wed, 8 Aug 2018 03:07:09 +0000 (20:07 -0700)
committerJames Zern <jzern@google.com>
Wed, 8 Aug 2018 03:14:42 +0000 (20:14 -0700)
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

vp9/common/vp9_thread_common.c

index 8d44e91f2e52f070dca35a59fe12fb04581570bb..e0f5e0d834ce6a860f6c758f98e127c5ce04944d 100644 (file)
@@ -91,6 +91,7 @@ static INLINE void thread_loop_filter_rows(
     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 @@ static INLINE void thread_loop_filter_rows(
     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 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, VP9_COMMON *cm,
   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 ||