diff options
Diffstat (limited to 'src/ipa/rkisp1/algorithms/af.cpp')
-rw-r--r-- | src/ipa/rkisp1/algorithms/af.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/ipa/rkisp1/algorithms/af.cpp b/src/ipa/rkisp1/algorithms/af.cpp new file mode 100644 index 00000000..6e047804 --- /dev/null +++ b/src/ipa/rkisp1/algorithms/af.cpp @@ -0,0 +1,70 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2022, Theobroma Systems + * + * af.cpp - RkISP1 AF hill climbing based control algorithm + */ + +#include "af.h" + +/** + * \file af.h + */ + +namespace libcamera::ipa::rkisp1::algorithms { + +/** + * \class Af + * \brief AF control algorithm + */ + +LOG_DEFINE_CATEGORY(RkISP1Af) + +/** + * \copydoc libcamera::ipa::Algorithm::configure + */ +int Af::configure([[maybe_unused]] IPAContext &context, + [[maybe_unused]] const IPACameraSensorInfo &configInfo) +{ + return 0; +} + +/** + * \copydoc libcamera::ipa::Algorithm::prepare + */ +void Af::prepare([[maybe_unused]] IPAContext &context, [[maybe_unused]] rkisp1_params_cfg *params) +{ +} + +/** + * \copydoc libcamera::ipa::Algorithm::process + */ +void Af::process(IPAContext &context, + [[maybe_unused]] IPAFrameContext *frameCtx, + const rkisp1_stat_buffer *stats) +{ + uint32_t sharpness = stats->params.af.window[0].sum; + uint32_t luminance = stats->params.af.window[0].lum; + + LOG(RkISP1Af, Debug) << "lensPosition: " << context.frameContext.af.focus + << ", Sharpness: " << sharpness + << ", Luminance: " << luminance; + + uint32_t lensPosition = processAutofocus(sharpness); + + context.frameContext.af.focus = lensPosition; +} + +void Af::setMetering([[maybe_unused]] controls::AfMeteringEnum metering) +{ + LOG(RkISP1Af, Error) << __FUNCTION__ << " not implemented!"; +} + +void Af::setWindows([[maybe_unused]] Span<const Rectangle> windows) +{ + LOG(RkISP1Af, Error) << __FUNCTION__ << " not implemented!"; +} + +REGISTER_IPA_ALGORITHM(Af, "Af") + +} /* namespace libcamera::ipa::rkisp1::algorithms */ |