[v4,5/6] ipa: simple: Report contrast in metadata
diff mbox series

Message ID 20250130173254.112895-6-mzamazal@redhat.com
State New
Headers show
Series
  • ipa: simple: Introduce metadata reporting
Related show

Commit Message

Milan Zamazal Jan. 30, 2025, 5:32 p.m. UTC
Provide the requested contrast value, if any, in the metadata to add to
the completed requests.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
---
 src/ipa/simple/algorithms/lut.cpp | 17 +++++++++++++++--
 src/ipa/simple/algorithms/lut.h   |  5 +++++
 src/ipa/simple/ipa_context.h      |  1 +
 3 files changed, 21 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp
index 0ba2391f..a6a77b7c 100644
--- a/src/ipa/simple/algorithms/lut.cpp
+++ b/src/ipa/simple/algorithms/lut.cpp
@@ -1,6 +1,6 @@ 
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 /*
- * Copyright (C) 2024, Red Hat Inc.
+ * Copyright (C) 2024-2025 Red Hat Inc.
  *
  * Color lookup tables construction
  */
@@ -82,9 +82,11 @@  void Lut::updateGammaTable(IPAContext &context)
 
 void Lut::prepare(IPAContext &context,
 		  [[maybe_unused]] const uint32_t frame,
-		  [[maybe_unused]] IPAFrameContext &frameContext,
+		  IPAFrameContext &frameContext,
 		  [[maybe_unused]] DebayerParams *params)
 {
+	frameContext.contrast = context.activeState.knobs.contrast;
+
 	/*
 	 * Update the gamma table if needed. This means if black level changes
 	 * and since the black level gets updated only if a lower value is
@@ -116,6 +118,17 @@  void Lut::prepare(IPAContext &context,
 	}
 }
 
+void Lut::process([[maybe_unused]] IPAContext &context,
+		  [[maybe_unused]] const uint32_t frame,
+		  [[maybe_unused]] IPAFrameContext &frameContext,
+		  [[maybe_unused]] const SwIspStats *stats,
+		  ControlList &metadata)
+{
+	const auto &contrast = frameContext.contrast;
+	if (contrast)
+		metadata.set(controls::Contrast, contrast.value());
+}
+
 REGISTER_IPA_ALGORITHM(Lut, "Lut")
 
 } /* namespace ipa::soft::algorithms */
diff --git a/src/ipa/simple/algorithms/lut.h b/src/ipa/simple/algorithms/lut.h
index 889f864b..ab4e1094 100644
--- a/src/ipa/simple/algorithms/lut.h
+++ b/src/ipa/simple/algorithms/lut.h
@@ -30,6 +30,11 @@  public:
 		     const uint32_t frame,
 		     IPAFrameContext &frameContext,
 		     DebayerParams *params) override;
+	void process(IPAContext &context,
+		     const uint32_t frame,
+		     IPAFrameContext &frameContext,
+		     const SwIspStats *stats,
+		     ControlList &metadata) override;
 
 private:
 	void updateGammaTable(IPAContext &context);
diff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h
index 99cb6284..07fd641a 100644
--- a/src/ipa/simple/ipa_context.h
+++ b/src/ipa/simple/ipa_context.h
@@ -62,6 +62,7 @@  struct IPAFrameContext : public FrameContext {
 		double red;
 		double blue;
 	} gains;
+	std::optional<double> contrast;
 };
 
 struct IPAContext {