From 00c135bc9ff53cac815b909481c580cf91f205c6 Mon Sep 17 00:00:00 2001 From: Setsugennoao <41454651+Setsugennoao@users.noreply.github.com> Date: Sat, 25 Mar 2023 19:01:43 +0100 Subject: [PATCH 1/2] Add `use_scene_referred` to `zimg_graph_builder_params` --- ChangeLog | 3 +++ doc/example/hdr_example.cpp | 3 +++ src/zimg/api/zimg.cpp | 6 ++++++ src/zimg/api/zimg.h | 3 +++ 4 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index bd1548eb..4832136e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +3.0.5 +api: add 'use_scene_referred' flag to zimg_graph_builder_params + 3.0.4 colorspace: fix ARIB STD-B67 constant-luminance EOTF (introduced in 2.6) colorspace: filter negative values from sRGB-like transfer functions diff --git a/doc/example/hdr_example.cpp b/doc/example/hdr_example.cpp index 6afe656d..d39f90d3 100644 --- a/doc/example/hdr_example.cpp +++ b/doc/example/hdr_example.cpp @@ -60,6 +60,7 @@ struct Arguments { char fast; char hlg; char wcg; + char scene_referred; }; const ArgparseOption program_switches[] = { @@ -69,6 +70,7 @@ const ArgparseOption program_switches[] = { { OPTION_FLOAT, "l", "luminance", offsetof(Arguments, luminance), nullptr, "legacy peak brightness (cd/m^2)" }, { OPTION_USER1, "k", "key", offsetof(Arguments, mask_key), decode_mask_key, "HDR color key (RRGGBB hex string)" }, { OPTION_STRING, "m", "mask", offsetof(Arguments, hdrpath), nullptr, "HDR difference mask" }, + { OPTION_STRING, "s", "sceneref", offsetof(Arguments, hdrpath), nullptr, "use scene-referred transfer functions" }, { OPTION_NULL } }; @@ -241,6 +243,7 @@ void execute(const Arguments &args) zimgxx::zfilter_graph_builder_params params; params.nominal_peak_luminance = args.luminance; params.allow_approximate_gamma = !!args.fast; + params.use_scene_referred = !!args.scene_referred; // HDR10 specification. zimgxx::zimage_format src_format; diff --git a/src/zimg/api/zimg.cpp b/src/zimg/api/zimg.cpp index 1fd704a4..3fd1a9e9 100644 --- a/src/zimg/api/zimg.cpp +++ b/src/zimg/api/zimg.cpp @@ -459,6 +459,9 @@ zimg::graph::GraphBuilder::params import_graph_params(const zimg_graph_builder_p params.peak_luminance = src.nominal_peak_luminance; params.approximate_gamma = !!src.allow_approximate_gamma; } + if (src.version >= API_VERSION_2_4) { + params.scene_referred = !!src.use_scene_referred; + } return params; } @@ -709,6 +712,9 @@ void zimg_graph_builder_params_default(zimg_graph_builder_params *ptr, unsigned ptr->nominal_peak_luminance = NAN; ptr->allow_approximate_gamma = 0; } + if (version >= API_VERSION_2_4) { + ptr->use_scene_referred = 0; + } } zimg_filter_graph *zimg_filter_graph_build(const zimg_image_format *src_format, const zimg_image_format *dst_format, const zimg_graph_builder_params *params) diff --git a/src/zimg/api/zimg.h b/src/zimg/api/zimg.h index fcfcfb85..7e0131a8 100644 --- a/src/zimg/api/zimg.h +++ b/src/zimg/api/zimg.h @@ -632,6 +632,9 @@ typedef struct zimg_graph_builder_params { /** Allow evaluating transfer functions at reduced precision (default false). */ char allow_approximate_gamma; + + /** Use scene-referred transfer functions (default false).*/ + char use_scene_referred; } zimg_graph_builder_params; /** From eea2f0f23aac7ebaf296d650ca2cd08a951cce01 Mon Sep 17 00:00:00 2001 From: Setsugennoao Date: Mon, 23 Oct 2023 19:27:41 +0200 Subject: [PATCH 2/2] Fix typo --- doc/example/hdr_example.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/example/hdr_example.cpp b/doc/example/hdr_example.cpp index d39f90d3..e1e35abe 100644 --- a/doc/example/hdr_example.cpp +++ b/doc/example/hdr_example.cpp @@ -70,7 +70,7 @@ const ArgparseOption program_switches[] = { { OPTION_FLOAT, "l", "luminance", offsetof(Arguments, luminance), nullptr, "legacy peak brightness (cd/m^2)" }, { OPTION_USER1, "k", "key", offsetof(Arguments, mask_key), decode_mask_key, "HDR color key (RRGGBB hex string)" }, { OPTION_STRING, "m", "mask", offsetof(Arguments, hdrpath), nullptr, "HDR difference mask" }, - { OPTION_STRING, "s", "sceneref", offsetof(Arguments, hdrpath), nullptr, "use scene-referred transfer functions" }, + { OPTION_STRING, "s", "sceneref", offsetof(Arguments, scene_referred), nullptr, "use scene-referred transfer functions" }, { OPTION_NULL } };