Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Kacper Michajłow via ffmpeg-devel" <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: "Kacper Michajłow" <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avutil/csp: correct gamma approximation to match BT.1886 EOTF (PR #20690)
Date: Sat, 11 Oct 2025 15:53:24 -0000
Message-ID: <176019933070.49.17226230272728028686@bf249f23a2c8> (raw)

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

                 reply	other threads:[~2025-10-11 16:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=176019933070.49.17226230272728028686@bf249f23a2c8 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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