aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheng Chen <chengchen@google.com>2023-10-10 11:48:54 -0700
committerWan-Teh Chang <wtc@google.com>2023-11-17 02:10:09 +0000
commit24467e8ac3b0f6f5d09457d342327393b8e3da3d (patch)
tree2bab389ff216402dbc380ffb541af3275d450390
parent8b9ea452396a00f2d019b8b11b8876d363d62659 (diff)
downloadlibaom-24467e8ac3b0f6f5d09457d342327393b8e3da3d.tar.gz
Initialize multi-thread workers
When multi-threading is on, we could always initialize these workers and associated memory. BUG=aomedia:3491 Change-Id: Ifef1f243381e1899537eceb818e5a82529b4fbf9 (cherry picked from commit fcfdc09d81b122cd5e70f66dc55833065127bf47)
-rw-r--r--av1/av1_cx_iface.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index 2ba7de579..182a09816 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -3102,7 +3102,9 @@ static aom_codec_err_t encoder_encode(aom_codec_alg_priv_t *ctx,
}
av1_create_workers(ppi, num_workers);
av1_init_tile_thread_data(ppi, cpi->oxcf.pass == AOM_RC_FIRST_PASS);
+ }
#if CONFIG_MULTITHREAD
+ if (ppi->p_mt_info.num_workers > 1) {
for (int i = 0; i < ppi->num_fp_contexts; i++) {
av1_init_mt_sync(ppi->parallel_cpi[i],
ppi->parallel_cpi[i]->oxcf.pass == AOM_RC_FIRST_PASS);
@@ -3110,8 +3112,8 @@ static aom_codec_err_t encoder_encode(aom_codec_alg_priv_t *ctx,
if (cpi_lap != NULL) {
av1_init_mt_sync(cpi_lap, 1);
}
-#endif // CONFIG_MULTITHREAD
}
+#endif // CONFIG_MULTITHREAD
// Re-allocate thread data if workers for encoder multi-threading stage
// exceeds prev_num_enc_workers.