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>
This commit is contained in:
Jean-Michel Hautbois 2021-09-06 18:01:26 +02:00
parent acf6b42ab4
commit acbad32b2e
3 changed files with 9 additions and 0 deletions

View file

@ -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 */

View file

@ -48,6 +48,7 @@ struct IPAFrameContext {
} awb;
struct {
double gamma;
struct ipu3_uapi_gamma_corr_lut gammaCorrection;
} toneMapping;
};

View file

@ -151,6 +151,9 @@
* \struct IPAFrameContext::toneMapping
* \brief Context for ToneMapping and Gamma control
*
* \var IPAFrameContext::toneMapping::gamma
* \brief Gamma value for the LUT
*
* \var IPAFrameContext::toneMapping::gammaCorrection
* \brief Per-pixel tone mapping implemented as a LUT
*