From: Niklas Haas <g...@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

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to