[x264-devel] [PATCH 22/32] Move global symbols to the implementation file

Vittorio Giovara vittorio.giovara at gmail.com
Fri Jan 20 15:20:47 CET 2017


This is so that it is not declared multiple times.

Also deprecate x264_bit_depth since bitdepth is set at runtime now.
For backward compatibility always initialize it to 8.
---
 common/api.c    | 6 ++++++
 common/common.c | 4 ----
 common/common.h | 2 --
 x264.h          | 1 +
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/common/api.c b/common/api.c
index 3d246d1..e461850 100644
--- a/common/api.c
+++ b/common/api.c
@@ -29,6 +29,12 @@
 
 #include "x264.h"
 
+/****************************************************************************
+ * global symbols
+ ****************************************************************************/
+const int x264_bit_depth = 8;
+const int x264_chroma_format = X264_CHROMA_FORMAT;
+
 x264_t *x264_8_encoder_open( x264_param_t * );
 void x264_8_nal_encode( x264_t *h, uint8_t *dst, x264_nal_t *nal );
 int  x264_8_encoder_reconfig( x264_t *, x264_param_t * );
diff --git a/common/common.c b/common/common.c
index 1c22038..6691f8d 100644
--- a/common/common.c
+++ b/common/common.c
@@ -26,10 +26,6 @@
 
 #include "common.h"
 
-const int x264_bit_depth = BIT_DEPTH;
-
-const int x264_chroma_format = X264_CHROMA_FORMAT;
-
 /****************************************************************************
  * x264_log:
  ****************************************************************************/
diff --git a/common/common.h b/common/common.h
index a7d4b41..bbbb5d9 100644
--- a/common/common.h
+++ b/common/common.h
@@ -180,8 +180,6 @@ typedef union { x264_uint128_t i; uint64_t a[2]; uint32_t b[4]; uint16_t c[8]; u
 #   define MPIXEL_X4(src) M32(src)
 #endif
 
-#define BIT_DEPTH X264_BIT_DEPTH
-
 #define CPPIXEL_X4(dst,src) MPIXEL_X4(dst) = MPIXEL_X4(src)
 
 #define X264_SCAN8_LUMA_SIZE (5*8)
diff --git a/x264.h b/x264.h
index badefaa..e71c085 100644
--- a/x264.h
+++ b/x264.h
@@ -671,6 +671,7 @@ int     x264_param_apply_profile( x264_param_t *, const char *profile );
  ****************************************************************************/
 
 /* x264_bit_depth:
+ *      Warning: this symbol is deprecated and always set to 8.
  *      Specifies the number of bits per pixel that x264 uses. This is also the
  *      bit depth that x264 encodes in. If this value is > 8, x264 will read
  *      two bytes of input data for each pixel sample, and expect the upper
-- 
2.10.0



More information about the x264-devel mailing list