Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakio Yamaoka <y.takio@gmail.com>2020-07-28 15:22:02 +0300
committerJan Ekström <jeebjp@gmail.com>2020-08-06 13:09:23 +0300
commitcc6c56f5d900f86167f6592215e613a69341858a (patch)
tree7a1233d786fa95a2dfd41791f28954b69291f6b6 /libavcodec/libx264.c
parent2c35797e183279530b623b4a2a1bea89a831cf50 (diff)
avcodec/libx264: fix chroma quantizer offset usage
The default for the chromaoffset field in AVCodecContext is zero, which until now always ended up overriding the AVOption-set value, thus leading to the AVOption not working. Additionally, the previous usage prevented the usage of negative values, while both the variable as well as x264's API would successfully handle such. Thus, the default value of the AVOption is changed to match the default of x264 (and what is currently the default for the AVCodecContext chromaoffset field), and the checks are changed to check for nonzero values. This way: 1. the library default is still utilized if the value is zero. 2. both negative and positive values are correctly passed to x264. For historical context, this was initially similarly implemented in 5764d38173661c29d954711dd5abfddf709e9ba4, and then b340bd8a58c32453172404a8e4240e3317e341da broke the value. Partially reverts commit b340bd8a58c32453172404a8e4240e3317e341da. Signed-off-by: Takio Yamaoka <y.takio@gmail.com>
Diffstat (limited to 'libavcodec/libx264.c')
-rw-r--r--libavcodec/libx264.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 7bbeab7d4c..347d29df27 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -681,11 +681,11 @@ static av_cold int X264_init(AVCodecContext *avctx)
#if FF_API_PRIVATE_OPT
FF_DISABLE_DEPRECATION_WARNINGS
- if (avctx->chromaoffset >= 0)
+ if (avctx->chromaoffset)
x4->chroma_offset = avctx->chromaoffset;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
- if (x4->chroma_offset >= 0)
+ if (x4->chroma_offset)
x4->params.analyse.i_chroma_qp_offset = x4->chroma_offset;
if (avctx->gop_size >= 0)
@@ -1140,7 +1140,7 @@ static const AVOption options[] = {
{ "vlc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "coder" },
{ "ac", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "coder" },
{ "b_strategy", "Strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 2, VE },
- { "chromaoffset", "QP difference between chroma and luma", OFFSET(chroma_offset), AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX, VE },
+ { "chromaoffset", "QP difference between chroma and luma", OFFSET(chroma_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, VE },
{ "sc_threshold", "Scene change threshold", OFFSET(scenechange_threshold), AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX, VE },
{ "noise_reduction", "Noise reduction", OFFSET(noise_reduction), AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX, VE },