@@ -437,6 +437,11 @@ int DebayerCpu::setDebayerFunctions(PixelFormat inputFormat,
return invalidFmt();
}
+ if (inputConfig_.patternSize.height == 2)
+ processInner_ = &DebayerCpu::process2;
+ else
+ processInner_ = &DebayerCpu::process4;
+
if ((bayerFormat.bitDepth == 8 || bayerFormat.bitDepth == 10 || bayerFormat.bitDepth == 12) &&
bayerFormat.packing == BayerFormat::Packing::None &&
isStandardBayerOrder(bayerFormat.order)) {
@@ -890,10 +895,7 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output
threadData_[0].yStart = 0;
threadData_[0].yEnd = window_.height;
- if (inputConfig_.patternSize.height == 2)
- process2(frame, in.planes()[0].data(), out.planes()[0].data(), &threadData_[0]);
- else
- process4(frame, in.planes()[0].data(), out.planes()[0].data(), &threadData_[0]);
+ (this->*processInner_)(frame, in.planes()[0].data(), out.planes()[0].data(), &threadData_[0]);
metadata.planes()[0].bytesused = out.planes()[0].size();
@@ -87,6 +87,9 @@ private:
bool processLastLinesSeperately;
};
+ using processFn = void (DebayerCpu::*)(uint32_t frame, const uint8_t *src, uint8_t *dst,
+ DebayerCpuThreadData *threadData);
+
/* 8-bit raw bayer format */
template<bool addAlphaByte, bool ccmEnabled>
void debayer8_BGBG_BGR888(uint8_t *dst, const uint8_t *src[]);
@@ -164,6 +167,7 @@ private:
unsigned int threadCount_;
bool ccmEnabled_;
DebayerParams params_;
+ processFn processInner_;
};
} /* namespace libcamera */
At a processInner_ function pointer and set this to process2() / process4() in configure instead of making the choise inline in process(). This is a preparation patch for making DebayerCpu support multi-threading. Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com> --- src/libcamera/software_isp/debayer_cpu.cpp | 10 ++++++---- src/libcamera/software_isp/debayer_cpu.h | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-)