[x264-devel] [PATCH 26/29] x264cli: Duplicate threaded input module

Vittorio Giovara vittorio.giovara at gmail.com
Thu Feb 2 10:05:38 CET 2017


Unfortunately this input module inherits a common.h dependency
(input/frame -> common/threadpool -> common/frame -> common/common)
which is extremely complicated to address.

Instead duplicate this module and select the correct one at run time.
---
 Makefile       | 2 +-
 input/input.h  | 3 ++-
 input/thread.c | 2 ++
 x264.c         | 1 +
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 4b076ae..961954b 100644
--- a/Makefile
+++ b/Makefile
@@ -58,7 +58,7 @@ SRCCLI += input/avs.c
 endif
 
 ifneq ($(findstring HAVE_THREAD 1, $(CONFIG)),)
-SRCCLI += input/thread.c
+SRCCLIBD += input/thread.c
 SRCS   += common/threadpool.c
 endif
 
diff --git a/input/input.h b/input/input.h
index 084c3e3..816ee32 100644
--- a/input/input.h
+++ b/input/input.h
@@ -107,7 +107,8 @@ typedef struct
 extern const cli_input_t raw_input;
 extern const cli_input_t y4m_input;
 extern const cli_input_t avs_input;
-extern const cli_input_t thread_input;
+extern const cli_input_t thread_8_input;
+extern const cli_input_t thread_10_input;
 extern const cli_input_t lavf_input;
 extern const cli_input_t ffms_input;
 extern const cli_input_t timecode_input;
diff --git a/input/thread.c b/input/thread.c
index d9622b7..84db83a 100644
--- a/input/thread.c
+++ b/input/thread.c
@@ -28,6 +28,8 @@
 #include "common/threadpool.h"
 #include "common/mathematics.h"
 
+#define thread_input x264_glue3(thread, BIT_DEPTH, input)
+
 typedef struct
 {
     cli_input_t input;
diff --git a/x264.c b/x264.c
index 1112340..4f16eb7 100644
--- a/x264.c
+++ b/x264.c
@@ -1633,6 +1633,7 @@ generic_option:
 
     /* init threaded input while the information about the input video is unaltered by filtering */
 #if HAVE_THREAD
+    cli_input_t thread_input = param->i_bitdepth == 8 ? thread_8_input : thread_10_input;
     if( info.thread_safe && (b_thread_input || param->i_threads > 1
         || (param->i_threads == X264_THREADS_AUTO && x264_cpu_num_processors() > 1)) )
     {
-- 
2.10.0



More information about the x264-devel mailing list