Revert "Frame scaling loop restoration crash fix" This reverts commit 1c03b6d9ef8f29124f5e1519a13f094c547960fa. Reason for revert: breaks nightly tests with -DCONFIG_FPMT_TEST=1 Change-Id: I719e05786c632408c3bbac01fddd38b564385107
diff --git a/av1/common/thread_common.c b/av1/common/thread_common.c index 858b4e3..0ff6238 100644 --- a/av1/common/thread_common.c +++ b/av1/common/thread_common.c
@@ -623,14 +623,15 @@ lr_sync->num_workers = num_workers; for (int worker_idx = 0; worker_idx < num_workers; ++worker_idx) { - if (worker_idx == 0) { - lr_sync->lrworkerdata[worker_idx].rst_tmpbuf = cm->rst_tmpbuf; - lr_sync->lrworkerdata[worker_idx].rlbs = cm->rlbs; - } else { + if (worker_idx < num_workers - 1) { CHECK_MEM_ERROR(cm, lr_sync->lrworkerdata[worker_idx].rst_tmpbuf, (int32_t *)aom_memalign(16, RESTORATION_TMPBUF_SIZE)); CHECK_MEM_ERROR(cm, lr_sync->lrworkerdata[worker_idx].rlbs, aom_malloc(sizeof(RestorationLineBuffers))); + + } else { + lr_sync->lrworkerdata[worker_idx].rst_tmpbuf = cm->rst_tmpbuf; + lr_sync->lrworkerdata[worker_idx].rlbs = cm->rlbs; } } @@ -678,7 +679,7 @@ aom_free(lr_sync->job_queue); if (lr_sync->lrworkerdata) { - for (int worker_idx = 1; worker_idx < lr_sync->num_workers; + for (int worker_idx = 0; worker_idx < lr_sync->num_workers - 1; worker_idx++) { LRWorkerData *const workerdata_data = lr_sync->lrworkerdata + worker_idx;
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c index e76912c..4f5fe5d 100644 --- a/av1/encoder/ethread.c +++ b/av1/encoder/ethread.c
@@ -831,12 +831,14 @@ void av1_init_lr_mt_buffers(AV1_COMP *cpi) { AV1_COMMON *const cm = &cpi->common; AV1LrSync *lr_sync = &cpi->mt_info.lr_row_sync; - - if (lr_sync->sync_range && - cpi->ppi->gf_group.frame_parallel_level[cpi->gf_frame_index] == 0) { - assert(lr_sync->num_workers > 0); - lr_sync->lrworkerdata[0].rst_tmpbuf = cm->rst_tmpbuf; - lr_sync->lrworkerdata[0].rlbs = cm->rlbs; + if (lr_sync->sync_range) { + if (cpi->ppi->gf_group.frame_parallel_level[cpi->gf_frame_index] > 0) + return; + int num_lr_workers = + av1_get_num_mod_workers_for_alloc(&cpi->ppi->p_mt_info, MOD_LR); + assert(num_lr_workers <= lr_sync->num_workers); + lr_sync->lrworkerdata[num_lr_workers - 1].rst_tmpbuf = cm->rst_tmpbuf; + lr_sync->lrworkerdata[num_lr_workers - 1].rlbs = cm->rlbs; } } #endif