libx264 has a few data exports which require X264_API_IMPORTS
to be defined if we link to libx264 dynamically on Windows.
In a similar fashion to how we handle our compat snprintf
implementation, if we define it all the time, the compiler
will first try and link to __imp_x264_symbol_name, and failing
that, as in the case of a static libx264, will attempt to link
to the non-prefixed symbol, which has already been pulled in by
other x264 functions' object files.
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
This also allows libx264 to modify its i_qfactor value
when using the "-tune" setting. Previously it had a static
value of 1.25
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Also break some long lines, remove codec function placeholder comments
and add spaces in sample/pixel format lists.
Signed-off-by: Martin Storsjö <martin@martin.st>
max_b_frames is initialized to -1 for libx264, to allow
distinguishing between an explicit user set 0 and a default not
touched 0 (see bb73cda2).
If max_b_frames is left as -1, this affects dts generation (where
expressions like max_b_frames != 0 are used), so make sure it is
left at the default 0 after the libx264 init function returns.
This avoids unnecessarily producing dts != pts when using
profile=baseline.
Signed-off-by: Martin Storsjö <martin@martin.st>
Some external codecs have their own code to determine the best number
of threads. This number is not necessary the number of cpu cores.
Thread_count will be only 0 if the codec has CODEC_CAP_AUTO_THREADS.
Specifically, trellis, nr, me_range, me_method, subq, b_strategy,
keyint_min, chroma_me and coder.
Change their defaults to -1 and apply them after
x264_param_default_preset() if the user explicitly set them.
Specifically: gop_size, max_b_frames, scenechange_threshold, qmin, qmax,
max_qdiff, qblur, qcompress and refs.
Change their default values to -1 and only use them if the user
explicitly set them. Otherwise x264 defaults are used.
Move setting those options after x264_param_default_preset(), so they
don't get overwritten by it.