libcamera: virtual: Avoid some copies
There is no reason make copies, these functions return const lvalue references, access the data through those. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
35ed4b9129
commit
277a28691c
3 changed files with 3 additions and 4 deletions
|
@ -129,7 +129,7 @@ int ImageFrameGenerator::generateFrame(const Size &size, const FrameBuffer *buff
|
||||||
|
|
||||||
MappedFrameBuffer mappedFrameBuffer(buffer, MappedFrameBuffer::MapFlag::Write);
|
MappedFrameBuffer mappedFrameBuffer(buffer, MappedFrameBuffer::MapFlag::Write);
|
||||||
|
|
||||||
auto planes = mappedFrameBuffer.planes();
|
const auto &planes = mappedFrameBuffer.planes();
|
||||||
|
|
||||||
/* Loop only around the number of images available */
|
/* Loop only around the number of images available */
|
||||||
frameIndex_ %= imageFrameDatas_.size();
|
frameIndex_ %= imageFrameDatas_.size();
|
||||||
|
|
|
@ -25,7 +25,7 @@ int TestPatternGenerator::generateFrame(const Size &size,
|
||||||
MappedFrameBuffer mappedFrameBuffer(buffer,
|
MappedFrameBuffer mappedFrameBuffer(buffer,
|
||||||
MappedFrameBuffer::MapFlag::Write);
|
MappedFrameBuffer::MapFlag::Write);
|
||||||
|
|
||||||
auto planes = mappedFrameBuffer.planes();
|
const auto &planes = mappedFrameBuffer.planes();
|
||||||
|
|
||||||
shiftLeft(size);
|
shiftLeft(size);
|
||||||
|
|
||||||
|
|
|
@ -275,8 +275,7 @@ int PipelineHandlerVirtual::exportFrameBuffers([[maybe_unused]] Camera *camera,
|
||||||
return -ENOBUFS;
|
return -ENOBUFS;
|
||||||
|
|
||||||
const StreamConfiguration &config = stream->configuration();
|
const StreamConfiguration &config = stream->configuration();
|
||||||
|
const PixelFormatInfo &info = PixelFormatInfo::info(config.pixelFormat);
|
||||||
auto info = PixelFormatInfo::info(config.pixelFormat);
|
|
||||||
|
|
||||||
std::vector<unsigned int> planeSizes;
|
std::vector<unsigned int> planeSizes;
|
||||||
for (size_t i = 0; i < info.planes.size(); ++i)
|
for (size_t i = 0; i < info.planes.size(); ++i)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue