Message ID | 20250815113400.20623-5-laurent.pinchart@ideasonboard.com |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
Hi 2025. 08. 15. 13:33 keltezéssel, Laurent Pinchart írta: > Simplify a range-based for loop by replacing an iterator with structure > bindings. This makes the code easier to read. > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> The same transformation could be done in many places. Not sure if it's worth doing all of them in one go, or on a case by case basis. Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> > --- > src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp > index 563df198e6e4..09d30f34d9b7 100644 > --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp > +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp > @@ -882,10 +882,10 @@ void PipelineHandlerBase::mapBuffers(Camera *camera, const BufferMap &buffers, u > * This will allow us to identify buffers passed between the pipeline > * handler and the IPA. > */ > - for (auto const &it : buffers) { > - bufferIds.push_back(IPABuffer(mask | it.first, > - it.second.buffer->planes())); > - data->bufferIds_.insert(mask | it.first); > + for (auto const &[id, buffer] : buffers) { > + bufferIds.push_back(IPABuffer(mask | id, > + buffer.buffer->planes())); I suppose we might as well use emplace_back() here, but may that should be separate. > + data->bufferIds_.insert(mask | id); > } > > data->ipa_->mapBuffers(bufferIds);
2025. 08. 15. 13:53 keltezéssel, Barnabás Pőcze írta: > Hi > > 2025. 08. 15. 13:33 keltezéssel, Laurent Pinchart írta: >> Simplify a range-based for loop by replacing an iterator with structure >> bindings. This makes the code easier to read. >> >> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > The same transformation could be done in many places. Not sure if it's worth > doing all of them in one go, or on a case by case basis. > > Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> > > > >> --- >> src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp >> index 563df198e6e4..09d30f34d9b7 100644 >> --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp >> +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp >> @@ -882,10 +882,10 @@ void PipelineHandlerBase::mapBuffers(Camera *camera, const BufferMap &buffers, u >> * This will allow us to identify buffers passed between the pipeline >> * handler and the IPA. >> */ >> - for (auto const &it : buffers) { >> - bufferIds.push_back(IPABuffer(mask | it.first, >> - it.second.buffer->planes())); >> - data->bufferIds_.insert(mask | it.first); >> + for (auto const &[id, buffer] : buffers) { >> + bufferIds.push_back(IPABuffer(mask | id, >> + buffer.buffer->planes())); > > I suppose we might as well use emplace_back() here, but may that should be separate. Sorry, I see it is done later. > > >> + data->bufferIds_.insert(mask | id); >> } >> data->ipa_->mapBuffers(bufferIds); >
On Fri, Aug 15, 2025 at 01:53:08PM +0200, Barnabás Pőcze wrote: > 2025. 08. 15. 13:33 keltezéssel, Laurent Pinchart írta: > > Simplify a range-based for loop by replacing an iterator with structure > > bindings. This makes the code easier to read. > > > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > The same transformation could be done in many places. Not sure if it's worth > doing all of them in one go, or on a case by case basis. This one was really a drive-by patch. Addressing the other ones would be nice. > Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> > > > --- > > src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp > > index 563df198e6e4..09d30f34d9b7 100644 > > --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp > > +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp > > @@ -882,10 +882,10 @@ void PipelineHandlerBase::mapBuffers(Camera *camera, const BufferMap &buffers, u > > * This will allow us to identify buffers passed between the pipeline > > * handler and the IPA. > > */ > > - for (auto const &it : buffers) { > > - bufferIds.push_back(IPABuffer(mask | it.first, > > - it.second.buffer->planes())); > > - data->bufferIds_.insert(mask | it.first); > > + for (auto const &[id, buffer] : buffers) { > > + bufferIds.push_back(IPABuffer(mask | id, > > + buffer.buffer->planes())); > > I suppose we might as well use emplace_back() here, but may that should be separate. > > > + data->bufferIds_.insert(mask | id); > > } > > > > data->ipa_->mapBuffers(bufferIds);
diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp index 563df198e6e4..09d30f34d9b7 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp @@ -882,10 +882,10 @@ void PipelineHandlerBase::mapBuffers(Camera *camera, const BufferMap &buffers, u * This will allow us to identify buffers passed between the pipeline * handler and the IPA. */ - for (auto const &it : buffers) { - bufferIds.push_back(IPABuffer(mask | it.first, - it.second.buffer->planes())); - data->bufferIds_.insert(mask | it.first); + for (auto const &[id, buffer] : buffers) { + bufferIds.push_back(IPABuffer(mask | id, + buffer.buffer->planes())); + data->bufferIds_.insert(mask | id); } data->ipa_->mapBuffers(bufferIds);
Simplify a range-based for loop by replacing an iterator with structure bindings. This makes the code easier to read. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)