summaryrefslogtreecommitdiff
path: root/src/ipa/ipu3/algorithms
diff options
context:
space:
mode:
authorJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>2021-09-06 18:01:26 +0200
committerJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>2021-10-26 14:02:41 +0200
commitacbad32b2e419558a55c7a2a26c19397d7c28191 (patch)
treea9dbb5da93a2c8becf1416b88d66854feb988d07 /src/ipa/ipu3/algorithms
parentacf6b42ab47b6de8b8e620f51dffa9c988ef7950 (diff)
ipa: ipu3: tonemapping: Generate the LUT only on gamma change
The tone mapping algorithm calculates the gamma curve for every frame, regardless of whether the gamma value has changed or not. This issue is exasperated as we currently hardcode the gamma to a single value. Optimise the implementation to only recalculate the look up table when the gamma setting is changed, and store the gamma setting of the LUT curve as part of the IPA context. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/ipa/ipu3/algorithms')
-rw-r--r--src/ipa/ipu3/algorithms/tone_mapping.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ipa/ipu3/algorithms/tone_mapping.cpp b/src/ipa/ipu3/algorithms/tone_mapping.cpp
index 3af96261..40337f9d 100644
--- a/src/ipa/ipu3/algorithms/tone_mapping.cpp
+++ b/src/ipa/ipu3/algorithms/tone_mapping.cpp
@@ -43,6 +43,9 @@ void ToneMapping::process([[maybe_unused]] IPAContext &context,
*/
gamma_ = 1.1;
+ if (context.frameContext.toneMapping.gamma == gamma_)
+ return;
+
struct ipu3_uapi_gamma_corr_lut &lut =
context.frameContext.toneMapping.gammaCorrection;
@@ -53,6 +56,8 @@ void ToneMapping::process([[maybe_unused]] IPAContext &context,
/* The output value is expressed on 13 bits. */
lut.lut[i] = gamma * 8191;
}
+
+ context.frameContext.toneMapping.gamma = gamma_;
}
} /* namespace ipa::ipu3::algorithms */