mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 07:19:45 +03:00
libcamera: camera: Fix validateColorSpaces to choose "main" colour space
The intention is that the "main" colour space is the colour space of the largest non-raw stream. Unfortunately the use of "config_[i].size" is clearly incorrect, and has been copied from prior versions of the code. This patch corrects the error. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
This commit is contained in:
parent
d81505b834
commit
13986d6ce3
1 changed files with 4 additions and 2 deletions
|
@ -361,6 +361,7 @@ CameraConfiguration::Status CameraConfiguration::validateColorSpaces(ColorSpaceF
|
||||||
* largest non-raw stream with a defined color space (if there is one).
|
* largest non-raw stream with a defined color space (if there is one).
|
||||||
*/
|
*/
|
||||||
std::optional<ColorSpace> colorSpace;
|
std::optional<ColorSpace> colorSpace;
|
||||||
|
Size size;
|
||||||
|
|
||||||
for (auto [i, cfg] : utils::enumerate(config_)) {
|
for (auto [i, cfg] : utils::enumerate(config_)) {
|
||||||
if (!cfg.colorSpace)
|
if (!cfg.colorSpace)
|
||||||
|
@ -369,9 +370,10 @@ CameraConfiguration::Status CameraConfiguration::validateColorSpaces(ColorSpaceF
|
||||||
if (cfg.colorSpace->adjust(cfg.pixelFormat))
|
if (cfg.colorSpace->adjust(cfg.pixelFormat))
|
||||||
status = Adjusted;
|
status = Adjusted;
|
||||||
|
|
||||||
if (cfg.colorSpace != ColorSpace::Raw &&
|
if (cfg.colorSpace != ColorSpace::Raw && cfg.size > size) {
|
||||||
(!colorSpace || cfg.size > config_[i].size))
|
|
||||||
colorSpace = cfg.colorSpace;
|
colorSpace = cfg.colorSpace;
|
||||||
|
size = cfg.size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!colorSpace || !(flags & ColorSpaceFlag::StreamsShareColorSpace))
|
if (!colorSpace || !(flags & ColorSpaceFlag::StreamsShareColorSpace))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue