Define the MAX_NUM_THREADS macro in enc_enums.h The MAX_NUM_THREADS macro is unrelated to the AVxWorkerInterface, so it doesn't need to be defined in aom_util/aom_thread.h. Move the definition of the MAX_NUM_THREADS macro to av1/encoder/enc_enums.h. Note: The ideal place to define the MAX_NUM_THREADS macro is av1/encoder/ethread.h. Unfortunately av1/encoder/ethread.h must be included after av1/encoder/encoder.h, but av1/encoder/encoder.h uses the MAX_NUM_THREADS macro. I could not fix the mutual dependency. Bug: aomedia:3554 Change-Id: I6add9d8a920fe7a0095b79aeebd2abe4a4f625be
diff --git a/aom_util/aom_thread.h b/aom_util/aom_thread.h index 92e162f..80ed314 100644 --- a/aom_util/aom_thread.h +++ b/aom_util/aom_thread.h
@@ -21,8 +21,6 @@ extern "C" { #endif -#define MAX_NUM_THREADS 64 - // State of the worker thread object typedef enum { AVX_WORKER_STATUS_NOT_OK = 0, // object is unusable
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c index 2b6b150..39c03c9 100644 --- a/av1/av1_cx_iface.c +++ b/av1/av1_cx_iface.c
@@ -32,6 +32,7 @@ #include "av1/common/enums.h" #include "av1/common/scale.h" #include "av1/encoder/bitstream.h" +#include "av1/encoder/enc_enums.h" #include "av1/encoder/encoder.h" #include "av1/encoder/encoder_alloc.h" #include "av1/encoder/encoder_utils.h"
diff --git a/av1/encoder/enc_enums.h b/av1/encoder/enc_enums.h index 20cefa1..0a8b0f2 100644 --- a/av1/encoder/enc_enums.h +++ b/av1/encoder/enc_enums.h
@@ -12,10 +12,14 @@ #ifndef AOM_AV1_ENCODER_ENC_ENUMS_H_ #define AOM_AV1_ENCODER_ENC_ENUMS_H_ +#include "aom_ports/mem.h" + #ifdef __cplusplus extern "C" { #endif +#define MAX_NUM_THREADS 64 + // This enumerator type needs to be kept aligned with the mode order in // const MODE_DEFINITION av1_mode_defs[MAX_MODES] used in the rd code. enum {
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h index 4de5d42..a919bd9 100644 --- a/av1/encoder/encoder.h +++ b/av1/encoder/encoder.h
@@ -37,6 +37,7 @@ #include "av1/encoder/av1_quantize.h" #include "av1/encoder/block.h" #include "av1/encoder/context_tree.h" +#include "av1/encoder/enc_enums.h" #include "av1/encoder/encodemb.h" #include "av1/encoder/external_partition.h" #include "av1/encoder/firstpass.h" @@ -74,7 +75,6 @@ #endif #include "aom/internal/aom_codec_internal.h" -#include "aom_util/aom_thread.h" #ifdef __cplusplus extern "C" {
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c index 3cc8e20..1d0092a 100644 --- a/av1/encoder/ethread.c +++ b/av1/encoder/ethread.c
@@ -19,6 +19,7 @@ #include "av1/encoder/allintra_vis.h" #include "av1/encoder/bitstream.h" +#include "av1/encoder/enc_enums.h" #include "av1/encoder/encodeframe.h" #include "av1/encoder/encodeframe_utils.h" #include "av1/encoder/encoder.h"
diff --git a/av1/encoder/global_motion.h b/av1/encoder/global_motion.h index dc18940..2645f93 100644 --- a/av1/encoder/global_motion.h +++ b/av1/encoder/global_motion.h
@@ -14,9 +14,8 @@ #include "aom/aom_integer.h" #include "aom_dsp/flow_estimation/flow_estimation.h" -#include "aom_scale/yv12config.h" #include "aom_util/aom_pthread.h" -#include "aom_util/aom_thread.h" +#include "av1/encoder/enc_enums.h" #ifdef __cplusplus extern "C" {
diff --git a/test/ethread_test.cc b/test/ethread_test.cc index ce45394..415f5de 100644 --- a/test/ethread_test.cc +++ b/test/ethread_test.cc
@@ -18,6 +18,7 @@ #include "test/util.h" #include "test/y4m_video_source.h" #include "test/yuv_video_source.h" +#include "av1/encoder/enc_enums.h" #include "av1/encoder/firstpass.h" namespace { @@ -411,9 +412,7 @@ const std::vector<size_t> ref_size_enc, const std::vector<std::string> ref_md5_enc, const std::vector<std::string> ref_md5_dec) { - // This value should be kept the same as MAX_NUM_THREADS - // in aom_thread.h - cfg_.g_threads = 64; + cfg_.g_threads = MAX_NUM_THREADS; ASSERT_NO_FATAL_FAILURE(RunLoop(video)); std::vector<size_t> multi_thr_max_row_mt_size_enc; std::vector<std::string> multi_thr_max_row_mt_md5_enc;