diff options
author | James Zern <jzern@google.com> | 2019-04-14 00:21:50 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-04-14 00:21:50 +0000 |
commit | a708bf5e0fc97ac883d1b4f7f0e2f9d4291c22da (patch) | |
tree | a3b019f70d09346ff9812645a38c9e9d1f65fb7a /vp9 | |
parent | c88b592dc7d3848edbe590709b219675a8b0ed95 (diff) | |
parent | e8b2750904fd78cf168fa196b38d35594b060e8a (diff) | |
download | libvpx-a708bf5e0fc97ac883d1b4f7f0e2f9d4291c22da.tar libvpx-a708bf5e0fc97ac883d1b4f7f0e2f9d4291c22da.tar.gz libvpx-a708bf5e0fc97ac883d1b4f7f0e2f9d4291c22da.tar.bz2 libvpx-a708bf5e0fc97ac883d1b4f7f0e2f9d4291c22da.zip |
Merge "loop_filter_rows_mt: unify worker count calculation"
Diffstat (limited to 'vp9')
-rw-r--r-- | vp9/common/vp9_thread_common.c | 7 | ||||
-rw-r--r-- | vp9/common/vp9_thread_common.h | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/vp9/common/vp9_thread_common.c b/vp9/common/vp9_thread_common.c index 00882a5f9..c79d9b7f0 100644 --- a/vp9/common/vp9_thread_common.c +++ b/vp9/common/vp9_thread_common.c @@ -8,6 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include <assert.h> #include <limits.h> #include "./vpx_config.h" #include "vpx_dsp/vpx_dsp_common.h" @@ -92,7 +93,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); + const int num_active_workers = lf_sync->num_active_workers; int mi_row, mi_col; enum lf_path path; if (y_only) @@ -104,6 +105,8 @@ static INLINE void thread_loop_filter_rows( else path = LF_PATH_SLOW; + assert(num_active_workers > 0); + for (mi_row = start; mi_row < stop; mi_row += num_active_workers * MI_BLOCK_SIZE) { MODE_INFO **const mi = cm->mi_grid_visible + mi_row * cm->mi_stride; @@ -172,6 +175,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, VP9_COMMON *cm, vp9_loop_filter_dealloc(lf_sync); vp9_loop_filter_alloc(lf_sync, cm, sb_rows, cm->width, num_workers); } + lf_sync->num_active_workers = num_workers; // Initialize cur_sb_col to -1 for all SB rows. memset(lf_sync->cur_sb_col, -1, sizeof(*lf_sync->cur_sb_col) * sb_rows); @@ -319,6 +323,7 @@ void vp9_loop_filter_alloc(VP9LfSync *lf_sync, VP9_COMMON *cm, int rows, CHECK_MEM_ERROR(cm, lf_sync->lfdata, vpx_malloc(num_workers * sizeof(*lf_sync->lfdata))); lf_sync->num_workers = num_workers; + lf_sync->num_active_workers = lf_sync->num_workers; CHECK_MEM_ERROR(cm, lf_sync->cur_sb_col, vpx_malloc(sizeof(*lf_sync->cur_sb_col) * rows)); diff --git a/vp9/common/vp9_thread_common.h b/vp9/common/vp9_thread_common.h index 1a2d79abd..94c9de659 100644 --- a/vp9/common/vp9_thread_common.h +++ b/vp9/common/vp9_thread_common.h @@ -36,7 +36,8 @@ typedef struct VP9LfSyncData { // Row-based parallel loopfilter data LFWorkerData *lfdata; - int num_workers; + int num_workers; // number of allocated workers. + int num_active_workers; // number of scheduled workers. #if CONFIG_MULTITHREAD pthread_mutex_t lf_mutex; |