Files
FFmpeg/tests/ref/seek
Jun Zhao eb59f938ae swscale/range_convert: preserve chroma center in range conversion
solve_range_convert() anchored the range conversion offset at the upper
endpoint (src_max -> dst_max). For chroma, mapping the limited-range
interval [16, 240] to the full-range interval [0, 255] via the upper
endpoint shifts the neutral chroma center (128 << (bit_depth - 8)) to
127.5 in 8-bit units.

After 4bee010844 added the fixed-point rounding bias, that -0.5 LSB
shift canceled out the final output rounding bias for colored chroma,
leaving a systematic -0.5 LSB truncation bias in full-range chroma and
causing neutral gray to still round down to 127 on the x86 4:2:0 vertical
filter path.

Per ITU-T H.273 Section 8.3, the achromatic chroma center is
128 << (bit_depth - 8) in both limited and full range. Anchor the chroma
range conversion offset at the neutral chroma center while keeping the
luma offset anchored at the upper endpoint.

Based on the root-cause analysis and patch from Forgejo_Fairy and alec
in issues #24005 and #25521.

Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/24005
Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/25521
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-10-29 03:10:43 +00:00
..
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…