diff options
author | Barnabás Pőcze <pobrn@protonmail.com> | 2024-12-10 18:55:40 +0100 |
---|---|---|
committer | Barnabás Pőcze <pobrn@protonmail.com> | 2025-01-06 10:18:44 +0100 |
commit | 277a28691c08f46a0a80e61bd19436dde0fae004 (patch) | |
tree | c36b05abb16c3eee3822e61c9fad4fd30a50a554 /src | |
parent | 35ed4b91291d9f3d08e4b51acfb51163e65df8f8 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/pipeline/virtual/image_frame_generator.cpp | 2 | ||||
-rw-r--r-- | src/libcamera/pipeline/virtual/test_pattern_generator.cpp | 2 | ||||
-rw-r--r-- | src/libcamera/pipeline/virtual/virtual.cpp | 3 |
3 files changed, 3 insertions, 4 deletions
diff --git a/src/libcamera/pipeline/virtual/image_frame_generator.cpp b/src/libcamera/pipeline/virtual/image_frame_generator.cpp index 277efbb0..d1545b5d 100644 --- a/src/libcamera/pipeline/virtual/image_frame_generator.cpp +++ b/src/libcamera/pipeline/virtual/image_frame_generator.cpp @@ -129,7 +129,7 @@ int ImageFrameGenerator::generateFrame(const Size &size, const FrameBuffer *buff MappedFrameBuffer mappedFrameBuffer(buffer, MappedFrameBuffer::MapFlag::Write); - auto planes = mappedFrameBuffer.planes(); + const auto &planes = mappedFrameBuffer.planes(); /* Loop only around the number of images available */ frameIndex_ %= imageFrameDatas_.size(); diff --git a/src/libcamera/pipeline/virtual/test_pattern_generator.cpp b/src/libcamera/pipeline/virtual/test_pattern_generator.cpp index 7bc2b338..47d34191 100644 --- a/src/libcamera/pipeline/virtual/test_pattern_generator.cpp +++ b/src/libcamera/pipeline/virtual/test_pattern_generator.cpp @@ -25,7 +25,7 @@ int TestPatternGenerator::generateFrame(const Size &size, MappedFrameBuffer mappedFrameBuffer(buffer, MappedFrameBuffer::MapFlag::Write); - auto planes = mappedFrameBuffer.planes(); + const auto &planes = mappedFrameBuffer.planes(); shiftLeft(size); diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp index cec8a85b..62e440ae 100644 --- a/src/libcamera/pipeline/virtual/virtual.cpp +++ b/src/libcamera/pipeline/virtual/virtual.cpp @@ -275,8 +275,7 @@ int PipelineHandlerVirtual::exportFrameBuffers([[maybe_unused]] Camera *camera, return -ENOBUFS; const StreamConfiguration &config = stream->configuration(); - - auto info = PixelFormatInfo::info(config.pixelFormat); + const PixelFormatInfo &info = PixelFormatInfo::info(config.pixelFormat); std::vector<unsigned int> planeSizes; for (size_t i = 0; i < info.planes.size(); ++i) |