Commit 1bd01661be for ffmpeg
commit 1bd01661bed0e140b911704ad8e4d9eb293c3059
Author: Ramiro Polla <ramiro.polla@gmail.com>
Date: Sat Oct 31 17:53:13 2026 +0100
swscale: treat float gray formats as full range
Legacy swscale was still reading float gray values as limited range,
whereas swscale2 correctly ignores the range for float gray formats.
Reproducible with sample EXR file with 2 levels of gray:
$ ffmpeg -f lavfi \
-i "color=black:s=128x64,format=grayf32,geq=lum='if(lt(X,64),1,0.93)'" \
-frames:v 1 grayf32.exr
Legacy only shows 1 level
$ ffplay -sws_backends legacy grayf32.exr
swscale2 shows the 2 levels
$ ffplay -sws_backends c grayf32.exr
Signed-off-by: Ramiro Polla <ramiro.polla@gmail.com>
diff --git a/libswscale/utils.c b/libswscale/utils.c
index c148813cd1..2361bb94c0 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -836,6 +836,15 @@ static int handle_jpeg(/* enum AVPixelFormat */ int *format)
case AV_PIX_FMT_GRAY16BE:
case AV_PIX_FMT_YA16BE:
case AV_PIX_FMT_YA16LE:
+ /* Floating point formats */
+ case AV_PIX_FMT_GRAYF16BE:
+ case AV_PIX_FMT_GRAYF16LE:
+ case AV_PIX_FMT_GRAYF32BE:
+ case AV_PIX_FMT_GRAYF32LE:
+ case AV_PIX_FMT_YAF16BE:
+ case AV_PIX_FMT_YAF16LE:
+ case AV_PIX_FMT_YAF32BE:
+ case AV_PIX_FMT_YAF32LE:
return 1;
default:
return 0;
diff --git a/tests/ref/fate/exr-ya-scanline-zip-half-12x8 b/tests/ref/fate/exr-ya-scanline-zip-half-12x8
index 6c07f19846..4861eda52f 100644
--- a/tests/ref/fate/exr-ya-scanline-zip-half-12x8
+++ b/tests/ref/fate/exr-ya-scanline-zip-half-12x8
@@ -3,4 +3,4 @@
#codec_id 0: rawvideo
#dimensions 0: 12x8
#sar 0: 1/1
-0, 0, 0, 1, 1536, 0xa33f5f69
+0, 0, 0, 1, 1536, 0x826d7637
diff --git a/tests/ref/fate/jpeg-mpf-gainmap b/tests/ref/fate/jpeg-mpf-gainmap
index 2c2cadac2c..17f3723651 100644
--- a/tests/ref/fate/jpeg-mpf-gainmap
+++ b/tests/ref/fate/jpeg-mpf-gainmap
@@ -1,5 +1,5 @@
-a94724be0101759474066d233ef14001 *tests/data/fate/jpeg-mpf-gainmap.jpeg_mpf
-5649 tests/data/fate/jpeg-mpf-gainmap.jpeg_mpf
+dcf02a726b98394f2084bb83c3f45311 *tests/data/fate/jpeg-mpf-gainmap.jpeg_mpf
+5607 tests/data/fate/jpeg-mpf-gainmap.jpeg_mpf
#tb 0: 1/25
#media_type 0: video
#codec_id 0: rawvideo
@@ -11,7 +11,7 @@ a94724be0101759474066d233ef14001 *tests/data/fate/jpeg-mpf-gainmap.jpeg_mpf
#dimensions 1: 64x48
#sar 1: 1/1
0, 0, 0, 1, 9216, 0xe5834dd7
-1, 0, 0, 1, 9216, 0x662fcc6a
+1, 0, 0, 1, 9216, 0x23c5fae7
frame|stream_index=0
frame|stream_index=1|side_datum/gain_map_parameters:side_data_type=Gain map parameters|side_datum/gain_map_parameters:version=0|side_datum/gain_map_parameters:use_base_color_space=1|side_datum/gain_map_parameters:base_hdr_headroom=0/1|side_datum/gain_map_parameters:alternate_hdr_headroom=5895489/1048576|component_entry/rgb:gain_map_min=-3392315/4194304|component_entry/rgb:gain_map_max=13278945/2097152|component_entry/rgb:gamma=691797/1048576|component_entry/rgb:base_offset=1/64|component_entry/rgb:alternate_offset=1/64
stream_group|index=0|nb_streams=2|type=Gain Map (Split base rendition and gain map)