Commit 3ffee588d7 for ffmpeg
commit 3ffee588d75d6cb3d0df1d6d8f598621715bbdd1
Author: Ramiro Polla <ramiro.polla@gmail.com>
Date: Sat Oct 31 17:53:32 2026 +0100
swscale/graph: do not flag an unspecified float range as incomplete
Legacy swscale was still expecting range information and rejecting
float formats that had the value unspecified under SWS_STRICT, whereas
swscale2 correctly ignores the range for float gray formats.
Reproducible with:
$ ffmpeg -f lavfi \
-i "color=gray:s=64x64,format=grayf32,setparams=color_primaries=bt709:color_trc=bt709:colorspace=unknown" \
-frames:v 1 \
-sws_flags strict -sws_backends legacy \
-vf "scale=out_range=pc:out_chroma_loc=left,format=yuv420p" -f null -
Signed-off-by: Ramiro Polla <ramiro.polla@gmail.com>
diff --git a/libswscale/graph.c b/libswscale/graph.c
index f4ae0f5871..d34d298901 100644
--- a/libswscale/graph.c
+++ b/libswscale/graph.c
@@ -612,8 +612,10 @@ static int add_legacy_sws_pass(SwsGraph *graph, const SwsFormat *src,
ff_sws_chroma_pos(src, &graph->incomplete, &sws->src_h_chr_pos, &sws->src_v_chr_pos);
ff_sws_chroma_pos(dst, &graph->incomplete, &sws->dst_h_chr_pos, &sws->dst_v_chr_pos);
- graph->incomplete |= src->range == AVCOL_RANGE_UNSPECIFIED;
- graph->incomplete |= dst->range == AVCOL_RANGE_UNSPECIFIED;
+ if (!isFloat(src->format))
+ graph->incomplete |= src->range == AVCOL_RANGE_UNSPECIFIED;
+ if (!isFloat(dst->format))
+ graph->incomplete |= dst->range == AVCOL_RANGE_UNSPECIFIED;
/* Allow overriding chroma position with the legacy API */
legacy_chr_pos(graph, &sws->src_h_chr_pos, ctx->src_h_chr_pos, &warned);