@@ -94,31 +94,7 @@ public:
*
* \return The valid size ranges or an empty range if there are none.
*/
- SizeRange sizes(PixelFormat inputFormat, const Size &inputSize)
- {
- Size pattern_size = patternSize(inputFormat);
-
- if (pattern_size.isNull())
- return {};
-
- /*
- * For debayer interpolation a border of pattern-height x pattern-width
- * is kept around the entire image. Combined with a minimum-size of
- * pattern-height x pattern-width this means the input-size needs to be
- * at least (3 * pattern-height) x (3 * pattern-width).
- */
- if (inputSize.width < (3 * pattern_size.width) ||
- inputSize.height < (3 * pattern_size.height)) {
- LOG(Debayer, Warning)
- << "Input format size too small: " << inputSize.toString();
- return {};
- }
-
- return SizeRange(Size(pattern_size.width, pattern_size.height),
- Size((inputSize.width - 2 * pattern_size.width) & ~(pattern_size.width - 1),
- (inputSize.height - 2 * pattern_size.height) & ~(pattern_size.height - 1)),
- pattern_size.width, pattern_size.height);
- }
+ virtual SizeRange sizes(PixelFormat inputFormat, const Size &inputSize) = 0;
/**
* \brief Signals when the input buffer is ready.
@@ -62,6 +62,7 @@ public:
strideAndFrameSize(const PixelFormat &outputFormat, const Size &size);
void process(FrameBuffer *input, FrameBuffer *output, DebayerParams params);
+ SizeRange sizes(PixelFormat inputFormat, const Size &inputSize);
/**
* \brief Get the file descriptor for the statistics.
@@ -945,4 +945,30 @@ void DebayerCpu::process(FrameBuffer *input, FrameBuffer *output, DebayerParams
inputBufferReady.emit(input);
}
+SizeRange DebayerCpu::sizes(PixelFormat inputFormat, const Size &inputSize)
+{
+ Size pattern_size = patternSize(inputFormat);
+
+ if (pattern_size.isNull())
+ return {};
+
+ /*
+ * For debayer interpolation a border of pattern-height x pattern-width
+ * is kept around the entire image. Combined with a minimum-size of
+ * pattern-height x pattern-width this means the input-size needs to be
+ * at least (3 * pattern-height) x (3 * pattern-width).
+ */
+ if (inputSize.width < (3 * pattern_size.width) ||
+ inputSize.height < (3 * pattern_size.height)) {
+ LOG(Debayer, Warning)
+ << "Input format size too small: " << inputSize.toString();
+ return {};
+ }
+
+ return SizeRange(Size(pattern_size.width, pattern_size.height),
+ Size((inputSize.width - 2 * pattern_size.width) & ~(pattern_size.width - 1),
+ (inputSize.height - 2 * pattern_size.height) & ~(pattern_size.height - 1)),
+ pattern_size.width, pattern_size.height);
+}
+
} /* namespace libcamera */
The amount of padding needed for interpolation at the borders depends on the implementation. Stop assuming that all implementations need a pattern-width x pattern-height border around the output size for padding and move the sizes() method out of the base-class. Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- .../libcamera/internal/software_isp/debayer.h | 26 +------------------ .../internal/software_isp/debayer_cpu.h | 1 + src/libcamera/software_isp/debayer_cpu.cpp | 26 +++++++++++++++++++ 3 files changed, 28 insertions(+), 25 deletions(-)