]> git.sesse.net Git - nageru/commitdiff
Support x264 >= 153.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 31 Aug 2018 20:13:45 +0000 (22:13 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 31 Aug 2018 20:13:45 +0000 (22:13 +0200)
Newer versions of x264 support multiple bit depths in one library,
so we don't need to load dynamically anymore. (On the other hand,
there's a new parameter we need to set.) Keep the old code around
for the time being, though, since we'd like to keep supporting
stretch for now.

x264_dynamic.cpp
x264_encoder.cpp

index 6aa649e43ff7ca51737cc943b8bea04dd2d9247f..f8b63cea69769d76480300dee7d50d63e6d4a0d0 100644 (file)
@@ -14,7 +14,14 @@ using namespace std;
 X264Dynamic load_x264_for_bit_depth(unsigned depth)
 {
        X264Dynamic dyn;
-       if (unsigned(x264_bit_depth) >= depth) {
+#if defined(X264_BIT_DEPTH) && X264_BIT_DEPTH == 0
+       bool suitable = true;  // x264 compiled to support all bit depths.
+#elif defined(X264_BIT_DEPTH)
+       bool suitable = X264_BIT_DEPTH >= depth;
+#else
+       bool suitable = unsigned(x264_bit_depth) >= depth;
+#endif
+       if (suitable) {
                // Just use the one we are linked to.
                dyn.handle = nullptr;
                dyn.x264_encoder_close = x264_encoder_close;
index 66c06344f4ce7710919241be4d9dd9e7d449b60c..8463d1bae285744a420aa47a1155504eb3f07b00 100644 (file)
@@ -150,6 +150,9 @@ void X264Encoder::init_x264()
        if (global_flags.x264_speedcontrol) {
                param.i_frame_reference = 16;  // Because speedcontrol is never allowed to change this above what we set at start.
        }
+#if X264_BUILD >= 153
+       param.i_bitdepth = global_flags.x264_bit_depth;
+#endif
 
        // NOTE: These should be in sync with the ones in quicksync_encoder.cpp (sps_rbsp()).
        param.vui.i_vidformat = 5;  // Unspecified.