Initialize thread_data->td for thread 0 in create_enc_workers
For --passes=1, the thread_data is shared between stats consumption
stage and stats generation stage, hence the thread_data->td that reaches
create_enc_workers is stale and is actually assigned the address of cpi_lap.
This patch reassigns thread_data->td of thread id 0 correctly to cpi->td.
BUG=aomedia:2925
Change-Id: Id9edeaa4ab6987b66c4ead8939e660654bad858f
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index bb0cd66..ba1572b 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -645,6 +645,8 @@
cm, thread_data->td->vt64x64,
aom_malloc(sizeof(*thread_data->td->vt64x64) * num_64x64_blocks));
}
+ } else {
+ thread_data->td = &cpi->td;
}
if (cpi->oxcf.row_mt == 1)
CHECK_MEM_ERROR(
@@ -1632,8 +1634,7 @@
int num_gm_workers = cpi->sf.gm_sf.prune_ref_frame_for_gm_search
? AOMMIN(MAX_DIRECTIONS, total_refs)
: total_refs;
- num_gm_workers = AOMMIN(num_gm_workers, cpi->oxcf.max_threads);
- assert(num_gm_workers <= cpi->mt_info.num_workers);
+ num_gm_workers = AOMMIN(num_gm_workers, cpi->mt_info.num_workers);
return (num_gm_workers);
}