Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Niklas Haas via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Niklas Haas <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] libavfilter/vf_libplacebo: add `temperature` option (PR #20650)
Date: Mon, 06 Oct 2025 12:20:49 -0000
Message-ID: <175975324971.65.13114031631911795892@bf249f23a2c8> (raw)

PR #20650 opened by Niklas Haas (haasn)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20650
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20650.patch


>From 7f9a5438fe3589eb33189f3f91a32021f6b2326f Mon Sep 17 00:00:00 2001
From: Niklas Haas <git@haasn.dev>
Date: Mon, 6 Oct 2025 14:06:30 +0200
Subject: [PATCH] libavfilter/vf_libplacebo: add `temperature` option

---
 doc/filters.texi            | 5 +++++
 libavfilter/vf_libplacebo.c | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 262e7ad009..5863041d1a 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -16795,6 +16795,11 @@ coefficients for RGB inputs.
 @item gamma
 Gamma adjustment, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
 
+@item temperature
+Color temperature adjustment. Lower values make the output warmer/redder,
+down to @code{1667}, while higher values make the output cooler/bluer, up to
+@code{25000}. Defaults to @code{6500} (neutral white).
+
 @item cones
 Cone model to use for color blindness simulation. Accepts any combination of
 @code{l}, @code{m} and @code{s}. Here are some examples:
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index 2b3738c8e0..2d8dd29be0 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -261,6 +261,7 @@ typedef struct LibplaceboContext {
     float saturation;
     float hue;
     float gamma;
+    float temperature;
 
     /* pl_peak_detect_params */
     int peakdetect;
@@ -446,6 +447,8 @@ static int update_settings(AVFilterContext *ctx)
         .saturation = s->saturation,
         .hue = s->hue,
         .gamma = s->gamma,
+        // libplacebo uses a normalized/relative scale for CCT
+        .temperature = (s->temperature - 6500.0) / 3500.0,
     };
 
     opts->peak_detect_params = *pl_peak_detect_params(
@@ -1723,6 +1726,7 @@ static const AVOption libplacebo_options[] = {
     { "saturation", "Saturation gain", OFFSET(saturation), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 16.0, DYNAMIC },
     { "hue", "Hue shift", OFFSET(hue), AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, -M_PI, M_PI, DYNAMIC },
     { "gamma", "Gamma adjustment", OFFSET(gamma), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 16.0, DYNAMIC },
+    { "temperature", "Color temperature adjustment (kelvin)", OFFSET(temperature), AV_OPT_TYPE_FLOAT, {.dbl = 6500.0}, 1667.0, 25000.0, DYNAMIC },
 
     { "peak_detect", "Enable dynamic peak detection for HDR tone-mapping", OFFSET(peakdetect), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DYNAMIC },
     { "smoothing_period", "Peak detection smoothing period", OFFSET(smoothing), AV_OPT_TYPE_FLOAT, {.dbl = 100.0}, 0.0, 1000.0, DYNAMIC },
-- 
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-06 12:21 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=175975324971.65.13114031631911795892@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 http://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/ http://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