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.
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;
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.