[x265] [PATCH 3 of 3] cli: split x265_report_simd() from x265_setup_primitives()
Steve Borho
steve at borho.org
Tue Jun 30 19:30:50 CEST 2015
# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1435682215 18000
# Tue Jun 30 11:36:55 2015 -0500
# Node ID 61df434bea407ada1cfeea51ffb4fc7d8961476e
# Parent 38168ee9556053194264c07a563cae0844f4ea2a
cli: split x265_report_simd() from x265_setup_primitives()
The CLI shouldn't be calling into x265_setup_primitives() when all it wants to
do is report the SIMD architectures that the encoder will use.
diff -r 38168ee95560 -r 61df434bea40 source/common/common.h
--- a/source/common/common.h Tue Jun 30 11:27:46 2015 -0500
+++ b/source/common/common.h Tue Jun 30 11:36:55 2015 -0500
@@ -409,7 +409,7 @@
/* located in pixel.cpp */
void extendPicBorder(pixel* recon, intptr_t stride, int width, int height, int marginX, int marginY);
-/* outside x265 namespace, but prefixed. defined in common.cpp */
+/* located in common.cpp */
int64_t x265_mdate(void);
#define x265_log(param, ...) general_log(param, "x265", __VA_ARGS__)
void general_log(const x265_param* param, const char* caller, int level, const char* fmt, ...);
@@ -424,7 +424,9 @@
void x265_free(void *ptr);
char* x265_slurp_file(const char *filename);
-void x265_setup_primitives(x265_param* param); /* primitives.cpp */
+/* located in primitives.cpp */
+void x265_setup_primitives(x265_param* param);
+void x265_report_simd(x265_param* param);
}
#include "constants.h"
diff -r 38168ee95560 -r 61df434bea40 source/common/primitives.cpp
--- a/source/common/primitives.cpp Tue Jun 30 11:27:46 2015 -0500
+++ b/source/common/primitives.cpp Tue Jun 30 11:36:55 2015 -0500
@@ -188,33 +188,12 @@
p.chroma[X265_CSP_I422].cu[BLOCK_422_2x4].sse_pp = NULL;
}
-void x265_setup_primitives(x265_param *param)
+void x265_report_simd(x265_param* param)
{
- int cpuid = param->cpuid;
-
- // initialize global variables
- if (!primitives.pu[0].sad)
- {
- setupCPrimitives(primitives);
-
- /* We do not want the encoder to use the un-optimized intra all-angles
- * C references. It is better to call the individual angle functions
- * instead. We must check for NULL before using this primitive */
- for (int i = 0; i < NUM_TR_SIZE; i++)
- primitives.cu[i].intra_pred_allangs = NULL;
-
-#if ENABLE_ASSEMBLY
- setupInstrinsicPrimitives(primitives, cpuid);
- setupAssemblyPrimitives(primitives, cpuid);
-#else
- x265_log(param, X265_LOG_WARNING, "Assembly not supported in this binary\n");
-#endif
-
- setupAliasPrimitives(primitives);
- }
-
if (param->logLevel >= X265_LOG_INFO)
{
+ int cpuid = param->cpuid;
+
char buf[1000];
char *p = buf + sprintf(buf, "using cpu capabilities:");
char *none = p;
@@ -245,6 +224,31 @@
x265_log(param, X265_LOG_INFO, "%s\n", buf);
}
}
+
+void x265_setup_primitives(x265_param *param)
+{
+ if (!primitives.pu[0].sad)
+ {
+ setupCPrimitives(primitives);
+
+ /* We do not want the encoder to use the un-optimized intra all-angles
+ * C references. It is better to call the individual angle functions
+ * instead. We must check for NULL before using this primitive */
+ for (int i = 0; i < NUM_TR_SIZE; i++)
+ primitives.cu[i].intra_pred_allangs = NULL;
+
+#if ENABLE_ASSEMBLY
+ setupInstrinsicPrimitives(primitives, param->cpuid);
+ setupAssemblyPrimitives(primitives, param->cpuid);
+#else
+ x265_log(param, X265_LOG_WARNING, "Assembly not supported in this binary\n");
+#endif
+
+ setupAliasPrimitives(primitives);
+ }
+
+ x265_report_simd(param);
+}
}
#if ENABLE_ASSEMBLY
diff -r 38168ee95560 -r 61df434bea40 source/x265.cpp
--- a/source/x265.cpp Tue Jun 30 11:27:46 2015 -0500
+++ b/source/x265.cpp Tue Jun 30 11:36:55 2015 -0500
@@ -424,7 +424,7 @@
case 'V':
printVersion(param, api);
- x265_setup_primitives(param);
+ x265_report_simd(param);
exit(0);
default:
More information about the x265-devel
mailing list