* [FFmpeg-devel] [PATCH] avutil/csp: correct gamma approximation to match BT.1886 EOTF (PR #20690)
@ 2025-10-11 15:53 Kacper Michajłow via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: Kacper Michajłow via ffmpeg-devel @ 2025-10-11 15:53 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Kacper Michajłow
PR #20690 opened by Kacper Michajłow (kasper93)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20690
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20690.patch
The previously used gamma value of 1.961 was derived from the BT.709
OETF, which does not define an EOTF. The proper EOTF was later specified
in BT.1886. This patch updates the approximation to match the BT.1886
EOTF assuming a perfect black level, which corresponds to a pure power
gamma of 2.4.
Fixes: https://github.com/mpv-player/mpv/issues/13438
From 6c6cb15777ae5d4005d2397fb088bffce899ee41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
Date: Sun, 3 Aug 2025 20:15:21 +0200
Subject: [PATCH] avutil/csp: correct gamma approximation to match BT.1886 EOTF
The previously used gamma value of 1.961 was derived from the BT.709
OETF, which does not define an EOTF. The proper EOTF was later specified
in BT.1886. This patch updates the approximation to match the BT.1886
EOTF assuming a perfect black level, which corresponds to a pure power
gamma of 2.4.
Fixes: https://github.com/mpv-player/mpv/issues/13438
---
libavutil/csp.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavutil/csp.c b/libavutil/csp.c
index 75ac871616..52a8f01ab1 100644
--- a/libavutil/csp.c
+++ b/libavutil/csp.c
@@ -133,12 +133,12 @@ enum AVColorPrimaries av_csp_primaries_id_from_desc(const AVColorPrimariesDesc *
}
static const double approximate_gamma[AVCOL_TRC_NB] = {
- [AVCOL_TRC_BT709] = 1.961,
- [AVCOL_TRC_SMPTE170M] = 1.961,
- [AVCOL_TRC_SMPTE240M] = 1.961,
- [AVCOL_TRC_BT1361_ECG] = 1.961,
- [AVCOL_TRC_BT2020_10] = 1.961,
- [AVCOL_TRC_BT2020_12] = 1.961,
+ [AVCOL_TRC_BT709] = 2.4,
+ [AVCOL_TRC_SMPTE170M] = 2.4,
+ [AVCOL_TRC_SMPTE240M] = 2.4,
+ [AVCOL_TRC_BT1361_ECG] = 2.4,
+ [AVCOL_TRC_BT2020_10] = 2.4,
+ [AVCOL_TRC_BT2020_12] = 2.4,
[AVCOL_TRC_GAMMA22] = 2.2,
[AVCOL_TRC_IEC61966_2_1] = 2.2,
[AVCOL_TRC_GAMMA28] = 2.8,
--
2.49.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-10-11 16:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-11 15:53 [FFmpeg-devel] [PATCH] avutil/csp: correct gamma approximation to match BT.1886 EOTF (PR #20690) Kacper Michajłow via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git