| Message ID | 20251125162851.2301793-19-stefan.klug@ideasonboard.com |
|---|---|
| State | Accepted |
| Headers | show |
| Series |
|
| Related | show |
Quoting Stefan Klug (2025-11-25 16:28:30) > In raw mode the number of configurations is actively limited to 1. It is > therefore safe to move isRaw up one level to simplify the code and > prepare for later use. > > During that rework it was noticed that the old code actually has a bug > in that it reduces the number of configurations to 1 in case a raw > config is found, but it doesn't reduce the config vector to that raw > config, but the first config. > > Change that behavior to check the first config and either remove all > remaining configs if the first is raw or drop all raw configs if the > first is non-raw. > > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> > > --- > > Changes in v3: > - Added fix for cases where only one stream is requested > - Fix adjustment in case of multiple configs > - Small code cleanup > --- > src/libcamera/pipeline/rkisp1/rkisp1.cpp | 35 ++++++++++++------------ > 1 file changed, 17 insertions(+), 18 deletions(-) > > diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp > index 6256a67bc31e..a11d70849121 100644 > --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp > +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp > @@ -551,31 +551,30 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate() > status = Adjusted; > > /* > - * Simultaneous capture of raw and processed streams isn't possible. If > - * there is any raw stream, cap the number of streams to one. > + * Simultaneous capture of raw and processed streams isn't possible. > + * Let the first stream decide on the type. > */ > - if (config_.size() > 1) { > - for (const auto &cfg : config_) { > - if (PixelFormatInfo::info(cfg.pixelFormat).colourEncoding == > + bool isRaw = (PixelFormatInfo::info(config_[0].pixelFormat).colourEncoding == > + PixelFormatInfo::ColourEncodingRAW); > + if (isRaw) { > + if (config_.size() > 1) { > + config_.resize(1); > + status = Adjusted; > + } > + } else { > + /* Drop all raw configs. */ > + for (auto it = config_.begin(); it != config_.end();) { > + if (PixelFormatInfo::info(it->pixelFormat).colourEncoding == > PixelFormatInfo::ColourEncodingRAW) { > - config_.resize(1); > + it = config_.erase(it); Yes, this seems more reasonable > status = Adjusted; > - break; > + continue; > } > + ++it; > } > } > > - bool useDewarper = false; > - if (pipe->dewarper_) { > - /* > - * Platforms with dewarper support, such as i.MX8MP, support > - * only a single stream. We can inspect config_[0] only here. > - */ > - bool isRaw = PixelFormatInfo::info(config_[0].pixelFormat).colourEncoding == > - PixelFormatInfo::ColourEncodingRAW; > - if (!isRaw) > - useDewarper = true; > - } > + bool useDewarper = (pipe->dewarper_ && !isRaw); Ack. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > /* > * If there are more than one stream in the configuration figure out the > -- > 2.51.0 >
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 6256a67bc31e..a11d70849121 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -551,31 +551,30 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate() status = Adjusted; /* - * Simultaneous capture of raw and processed streams isn't possible. If - * there is any raw stream, cap the number of streams to one. + * Simultaneous capture of raw and processed streams isn't possible. + * Let the first stream decide on the type. */ - if (config_.size() > 1) { - for (const auto &cfg : config_) { - if (PixelFormatInfo::info(cfg.pixelFormat).colourEncoding == + bool isRaw = (PixelFormatInfo::info(config_[0].pixelFormat).colourEncoding == + PixelFormatInfo::ColourEncodingRAW); + if (isRaw) { + if (config_.size() > 1) { + config_.resize(1); + status = Adjusted; + } + } else { + /* Drop all raw configs. */ + for (auto it = config_.begin(); it != config_.end();) { + if (PixelFormatInfo::info(it->pixelFormat).colourEncoding == PixelFormatInfo::ColourEncodingRAW) { - config_.resize(1); + it = config_.erase(it); status = Adjusted; - break; + continue; } + ++it; } } - bool useDewarper = false; - if (pipe->dewarper_) { - /* - * Platforms with dewarper support, such as i.MX8MP, support - * only a single stream. We can inspect config_[0] only here. - */ - bool isRaw = PixelFormatInfo::info(config_[0].pixelFormat).colourEncoding == - PixelFormatInfo::ColourEncodingRAW; - if (!isRaw) - useDewarper = true; - } + bool useDewarper = (pipe->dewarper_ && !isRaw); /* * If there are more than one stream in the configuration figure out the
In raw mode the number of configurations is actively limited to 1. It is therefore safe to move isRaw up one level to simplify the code and prepare for later use. During that rework it was noticed that the old code actually has a bug in that it reduces the number of configurations to 1 in case a raw config is found, but it doesn't reduce the config vector to that raw config, but the first config. Change that behavior to check the first config and either remove all remaining configs if the first is raw or drop all raw configs if the first is non-raw. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> --- Changes in v3: - Added fix for cases where only one stream is requested - Fix adjustment in case of multiple configs - Small code cleanup --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 35 ++++++++++++------------ 1 file changed, 17 insertions(+), 18 deletions(-)