* [FFmpeg-devel] [PATCH] libavfilter/vf_libplacebo: add `temperature` option (PR #20650)
@ 2025-10-06 12:20 Niklas Haas via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: Niklas Haas via ffmpeg-devel @ 2025-10-06 12:20 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-10-06 12:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-06 12:20 [FFmpeg-devel] [PATCH] libavfilter/vf_libplacebo: add `temperature` option (PR #20650) Niklas Haas 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 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