Commit f88dba8401 for ffmpeg
commit f88dba8401a67092c0efecf5c4e9d4130a2f5af1
Author: Ramiro Polla <ramiro.polla@gmail.com>
Date: Wed Nov 4 18:31:55 2026 +0100
swscale/format: leave the range of float formats unspecified
Color range does not apply to floating point formats. Float gray formats
were already sanitized to AVCOL_RANGE_UNSPECIFIED, but float RGB formats
were sanitized to AVCOL_RANGE_JPEG along with the rest of the RGB family.
Move the float check out of the gray branch so that it applies to all
float formats.
This does not change any output: legacy swscale ignores the range of RGB
formats, and the ops backend passes floats through regardless of range.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ramiro Polla <ramiro.polla@gmail.com>
diff --git a/libswscale/format.c b/libswscale/format.c
index fbe2d813f9..447f11a894 100644
--- a/libswscale/format.c
+++ b/libswscale/format.c
@@ -315,12 +315,12 @@ static void sanitize_fmt(SwsFormat *fmt, const AVPixFmtDescriptor *desc)
/* Grayscale formats */
fmt->color.prim = AVCOL_PRI_UNSPECIFIED;
fmt->csp = AVCOL_SPC_UNSPECIFIED;
- if (desc->flags & AV_PIX_FMT_FLAG_FLOAT)
- fmt->range = AVCOL_RANGE_UNSPECIFIED;
- else
- fmt->range = AVCOL_RANGE_JPEG; // FIXME: this restriction should be lifted
+ fmt->range = AVCOL_RANGE_JPEG; // FIXME: this restriction should be lifted
}
+ if (desc->flags & AV_PIX_FMT_FLAG_FLOAT)
+ fmt->range = AVCOL_RANGE_UNSPECIFIED;
+
switch (av_pix_fmt_desc_get_id(desc)) {
case AV_PIX_FMT_YUVJ420P:
case AV_PIX_FMT_YUVJ411P: