[FFmpeg-devel] [PATCH v2 01/13] avfilter/vf_scale: don't change range by default
Niklas Haas
ffmpeg at haasn.xyz
Fri Oct 13 17:24:39 EEST 2023
From: Niklas Haas <git at haasn.dev>
If we don't convert the pixel format, then we shouldn't touch the pixel
range by default, either. Ensures full-range YUV input comes out as
full-range YUV output, unless we go through a pixel format conversion.
In theory, we may also want to extend this logic to YUV->YUV
conversions, but a few special cases (YUVJ, Gray, RGB) make this more
annoying than it needs to be, so I'll defer it to a future commit.
---
libavfilter/vf_scale.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index b0221e8538..9bbf0f8ed5 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -863,6 +863,8 @@ scale:
in_full = (in_range == AVCOL_RANGE_JPEG);
if (scale->out_range != AVCOL_RANGE_UNSPECIFIED)
out_full = (scale->out_range == AVCOL_RANGE_JPEG);
+ else if (in->format == out->format)
+ out_full = in_full; /* preserve pixel range by default */
sws_setColorspaceDetails(scale->sws, inv_table, in_full,
table, out_full,
--
2.42.0
More information about the ffmpeg-devel
mailing list