diff options
author | Jacopo Mondi <jacopo.mondi@ideasonboard.com> | 2024-05-31 12:20:34 +0200 |
---|---|---|
committer | Jacopo Mondi <jacopo.mondi@ideasonboard.com> | 2024-06-20 18:22:17 +0200 |
commit | 4acc8e35cff7548eba9fb1e4be4052d5340a9254 (patch) | |
tree | 91a9ca3ee7c882b710c4bbc2bbb0d1db22709ddb /src/ipa/rkisp1/rkisp1.cpp | |
parent | e689b2f0c9fef525364ba518054297558086a051 (diff) |
ipa: rkisp1: Use the extensible parameters formatimx8mp/extensible-format
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Diffstat (limited to 'src/ipa/rkisp1/rkisp1.cpp')
-rw-r--r-- | src/ipa/rkisp1/rkisp1.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 6687c91e..05e5ed26 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -325,16 +325,40 @@ void IPARkISP1::queueRequest(const uint32_t frame, const ControlList &controls) void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) { IPAFrameContext &frameContext = context_.frameContexts.get(frame); + rkisp1_ext_params_block_header *block; + size_t totalSize = 0; - rkisp1_params_cfg *params = - reinterpret_cast<rkisp1_params_cfg *>( - mappedBuffers_.at(bufferId).planes()[0].data()); + rkisp1_ext_params_cfg *params = + reinterpret_cast<rkisp1_ext_params_cfg *>( + mappedBuffers_.at(bufferId).planes()[0].data()); /* Prepare parameters buffer. */ memset(params, 0, sizeof(*params)); - for (auto const &algo : algorithms()) - algo->prepare(context_, frame, frameContext, params); + params->version = RKISP1_EXT_PARAM_BUFFER_V1; + + block = reinterpret_cast<rkisp1_ext_params_block_header *>(params->data); + for (auto const &algo : algorithms()) { + + algo->prepare(context_, frame, frameContext, block); + + /* + * Each algorithm could add multiple parameter blocks, each of + * which will have its own embedded header struct with the size + * of that block. We need to iterate through them, sum all of + * the block sizes and advance the 'block' pointer to the next + * empty one. + */ + while (totalSize < RKISP1_EXT_PARAMS_MAX_SIZE && block->size) { + totalSize += block->size; + block = reinterpret_cast<rkisp1_ext_params_block_header *> + (params->data + totalSize); + } + + ASSERT(totalSize <= RKISP1_EXT_PARAMS_MAX_SIZE); + } + + params->total_size = totalSize; paramsBufferReady.emit(frame); } |