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
..
2026-10-29 03:10:43 +00:00
2019-12-21 11:57:28 -03:00
2022-05-12 11:19:12 +02:00
2017-03-24 15:44:01 +01:00
2025-10-24 00:16:21 +00:00
2025-10-24 00:16:21 +00:00
2025-10-24 00:16:21 +00:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2022-05-30 12:13:29 +02:00
2024-09-30 09:07:54 -03:00
2024-08-01 10:09:25 +02:00
2020-10-06 17:56:52 +02:00
2025-12-14 10:13:29 +01:00
2024-10-16 17:38:57 -03:00
2025-03-04 12:51:54 +01:00
2024-06-20 18:58:39 +02:00
2022-08-18 16:53:41 +02:00
2025-12-14 10:13:29 +01:00
2020-08-30 16:18:37 +02:00
2024-11-08 08:30:07 -08:00
2023-04-02 23:54:52 +02:00
2023-06-24 14:39:04 -03:00
2025-04-20 22:04:36 +02:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2025-04-10 03:01:33 +02:00
2023-06-20 14:37:52 +02:00
2024-01-10 23:33:02 +01:00
2024-01-10 23:33:02 +01:00
2024-07-03 11:38:52 +02:00
2024-07-03 11:38:52 +02:00
2024-01-10 23:33:02 +01:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2020-10-06 17:56:52 +02:00
2026-10-29 03:10:43 +00:00
2023-09-07 20:58:08 +02:00
2023-07-02 21:08:59 +02:00
2023-03-26 01:46:48 +01:00
2023-03-26 01:46:48 +01:00
2022-10-06 15:00:21 +02:00
2022-10-06 15:00:21 +02:00
2022-10-06 15:00:21 +02:00
2022-11-01 09:24:29 +11:00
2024-10-16 10:05:55 -03:00
2024-10-17 17:04:57 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2024-10-16 17:38:57 -03:00
2026-10-29 03:10:43 +00:00
2019-12-21 11:57:28 -03:00
2022-05-12 11:19:12 +02:00
2025-10-24 00:16:21 +00:00
2025-10-24 00:16:21 +00:00
2025-10-24 00:16:21 +00:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2022-05-30 12:13:29 +02:00
2024-09-30 09:07:54 -03:00
2024-08-01 10:09:25 +02:00
2020-10-06 17:56:52 +02:00
2025-12-14 10:13:29 +01:00
2024-10-16 17:38:57 -03:00
2025-03-04 12:51:54 +01:00
2024-06-20 18:58:39 +02:00
2022-08-18 16:53:41 +02:00
2023-04-02 23:54:49 +02:00
2024-11-08 08:30:07 -08:00
2023-04-02 23:54:52 +02:00
2023-06-24 14:39:04 -03:00
2025-04-20 22:04:36 +02:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2025-04-10 03:01:33 +02:00
2023-06-20 14:37:52 +02:00
2024-01-10 23:33:02 +01:00
2024-01-10 23:33:02 +01:00
2024-07-03 11:38:52 +02:00
2024-07-03 11:38:52 +02:00
2024-01-10 23:33:02 +01:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2020-10-06 17:56:52 +02:00
2026-10-29 03:10:43 +00:00
2023-09-07 20:58:08 +02:00
2023-07-02 21:08:59 +02:00
2023-03-26 01:46:48 +01:00
2023-03-26 01:46:48 +01:00
2022-10-06 15:00:21 +02:00
2022-10-06 15:00:21 +02:00
2022-10-06 15:00:21 +02:00
2022-11-01 09:24:29 +11:00
2024-10-16 10:05:55 -03:00
2024-10-17 17:04:57 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2024-10-16 17:38:57 -03:00
2026-10-29 03:10:43 +00:00
2025-05-26 03:37:09 +02:00
2025-05-26 03:37:09 +02:00
2025-10-24 00:16:21 +00:00
2025-10-24 00:16:21 +00:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2022-05-30 12:13:29 +02:00
2024-09-30 09:07:54 -03:00
2024-08-01 10:09:25 +02:00
2020-10-06 17:56:52 +02:00
2025-12-14 10:13:29 +01:00
2024-10-16 17:38:57 -03:00
2023-04-02 23:54:49 +02:00
2024-11-08 08:30:07 -08:00
2023-04-02 23:54:52 +02:00
2023-06-24 14:39:04 -03:00
2025-04-20 22:04:36 +02:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2025-04-10 03:01:33 +02:00
2023-06-20 14:37:52 +02:00
2024-01-10 23:33:02 +01:00
2024-01-10 23:33:02 +01:00
2024-07-03 11:38:52 +02:00
2024-07-03 11:38:52 +02:00
2024-01-10 23:33:02 +01:00
2019-12-21 11:57:28 -03:00
2020-10-06 17:56:52 +02:00
2023-09-07 20:58:08 +02:00
2023-07-02 21:08:59 +02:00
2022-11-01 09:24:29 +11:00
2024-10-16 10:05:55 -03:00
2024-10-17 17:04:57 -03:00
2024-10-16 17:38:57 -03:00
2026-10-29 03:10:43 +00:00
2019-12-21 11:57:28 -03:00
2022-05-12 11:19:12 +02:00
2025-10-24 00:16:21 +00:00
2025-10-24 00:16:21 +00:00
2025-10-24 00:16:21 +00:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2022-05-30 12:13:29 +02:00
2024-09-30 09:07:54 -03:00
2024-08-01 10:09:25 +02:00
2020-10-06 17:56:52 +02:00
2025-12-14 10:13:29 +01:00
2024-10-16 17:38:57 -03:00
2025-03-04 12:51:54 +01:00
2024-06-20 18:58:39 +02:00
2022-08-18 16:53:41 +02:00
2023-04-02 23:54:49 +02:00
2024-11-08 08:30:07 -08:00
2023-04-02 23:54:52 +02:00
2023-06-24 14:39:04 -03:00
2025-04-20 22:04:36 +02:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2026-10-29 03:10:43 +00:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2026-10-01 14:31:15 +00:00
2025-04-10 03:01:33 +02:00
2023-06-20 14:37:52 +02:00
2024-01-10 23:33:02 +01:00
2024-01-10 23:33:02 +01:00
2024-07-03 11:38:52 +02:00
2024-07-03 11:38:52 +02:00
2024-01-10 23:33:02 +01:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2020-10-06 17:56:52 +02:00
2026-10-29 03:10:43 +00:00
2023-09-07 22:57:01 +02:00
2023-07-02 21:08:59 +02:00
2023-03-26 01:46:48 +01:00
2023-03-26 01:46:48 +01:00
2022-10-06 15:00:21 +02:00
2022-10-06 15:00:21 +02:00
2022-10-06 15:00:21 +02:00
2022-11-01 09:24:29 +11:00
2024-10-16 10:05:55 -03:00
2024-10-17 17:04:57 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2019-12-21 11:57:28 -03:00
2024-10-16 17:38:57 -03:00