android: Modify PostProcessor interface
In PostProcessor::process(), the |source| argument doesn't have to be a pointer. This replaces its type, const pointer, with const reference as the latter is preferred to the former. libcamera::Span is cheap to construct/copy/move. We should deal with the type as pass-by-value parameter. Therefore this also drops the const reference in the |destination| argument. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Umang Jain <email@uajain.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
88919c1e17
commit
b8dd5ce944
4 changed files with 8 additions and 8 deletions
|
@ -102,7 +102,7 @@ int CameraStream::process(const libcamera::FrameBuffer &source,
|
||||||
if (!postProcessor_)
|
if (!postProcessor_)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return postProcessor_->process(&source, dest->maps()[0], metadata);
|
return postProcessor_->process(source, dest->maps()[0], metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameBuffer *CameraStream::getBuffer()
|
FrameBuffer *CameraStream::getBuffer()
|
||||||
|
|
|
@ -44,8 +44,8 @@ int PostProcessorJpeg::configure(const StreamConfiguration &inCfg,
|
||||||
return encoder_->configure(inCfg);
|
return encoder_->configure(inCfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int PostProcessorJpeg::process(const libcamera::FrameBuffer *source,
|
int PostProcessorJpeg::process(const libcamera::FrameBuffer &source,
|
||||||
const libcamera::Span<uint8_t> &destination,
|
libcamera::Span<uint8_t> destination,
|
||||||
CameraMetadata *metadata)
|
CameraMetadata *metadata)
|
||||||
{
|
{
|
||||||
if (!encoder_)
|
if (!encoder_)
|
||||||
|
@ -67,7 +67,7 @@ int PostProcessorJpeg::process(const libcamera::FrameBuffer *source,
|
||||||
if (exif.generate() != 0)
|
if (exif.generate() != 0)
|
||||||
LOG(JPEG, Error) << "Failed to generate valid EXIF data";
|
LOG(JPEG, Error) << "Failed to generate valid EXIF data";
|
||||||
|
|
||||||
int jpeg_size = encoder_->encode(source, destination, exif.data());
|
int jpeg_size = encoder_->encode(&source, destination, exif.data());
|
||||||
if (jpeg_size < 0) {
|
if (jpeg_size < 0) {
|
||||||
LOG(JPEG, Error) << "Failed to encode stream image";
|
LOG(JPEG, Error) << "Failed to encode stream image";
|
||||||
return jpeg_size;
|
return jpeg_size;
|
||||||
|
|
|
@ -23,8 +23,8 @@ public:
|
||||||
|
|
||||||
int configure(const libcamera::StreamConfiguration &incfg,
|
int configure(const libcamera::StreamConfiguration &incfg,
|
||||||
const libcamera::StreamConfiguration &outcfg) override;
|
const libcamera::StreamConfiguration &outcfg) override;
|
||||||
int process(const libcamera::FrameBuffer *source,
|
int process(const libcamera::FrameBuffer &source,
|
||||||
const libcamera::Span<uint8_t> &destination,
|
libcamera::Span<uint8_t> destination,
|
||||||
CameraMetadata *metadata) override;
|
CameraMetadata *metadata) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -20,8 +20,8 @@ public:
|
||||||
|
|
||||||
virtual int configure(const libcamera::StreamConfiguration &inCfg,
|
virtual int configure(const libcamera::StreamConfiguration &inCfg,
|
||||||
const libcamera::StreamConfiguration &outCfg) = 0;
|
const libcamera::StreamConfiguration &outCfg) = 0;
|
||||||
virtual int process(const libcamera::FrameBuffer *source,
|
virtual int process(const libcamera::FrameBuffer &source,
|
||||||
const libcamera::Span<uint8_t> &destination,
|
libcamera::Span<uint8_t> destination,
|
||||||
CameraMetadata *metadata) = 0;
|
CameraMetadata *metadata) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue