pipeline: virtual: Provide and validate colorspace

Virtual pipeline handler should provide colorSpace in
generateConfiguration() and validate the colorspace in validate().
It is mandatory for a pipeline handler to set the colorspace if it
is unset in the stream configuration, during validate().

For choosing the colorspace for the generated NV12 frames, following
points have been taken into account:
- The transfer function should be Rec.709 for NV12
- The YCbCr encoding has been chosen Rec.709 as it is the most common
  than Rec.601/Rec.2020
- Range should be 'Limited' as with the NV12 pixel format.

Hence, the closest colorspace match is ColorSpace::Rec709 which is
set for the virtual pipeline handler.

Signed-off-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Robert Mader <robert.mader@collabora.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Umang Jain
2025-11-03 22:13:14 +00:00
committed by Kieran Bingham
parent 7e8c274d18
commit 5d2d005306
@@ -214,6 +214,17 @@ CameraConfiguration::Status VirtualCameraConfiguration::validate()
adjusted = true;
}
if (cfg.colorSpace != ColorSpace::Rec709) {
cfg.colorSpace = ColorSpace::Rec709;
status = Adjusted;
adjusted = true;
}
if (validateColorSpaces() == Adjusted) {
status = Adjusted;
adjusted = true;
}
if (adjusted)
LOG(Virtual, Info)
<< "Stream configuration adjusted to " << cfg.toString();
@@ -278,6 +289,7 @@ PipelineHandlerVirtual::generateConfiguration(Camera *camera,
cfg.pixelFormat = pixelFormat;
cfg.size = data->config_.maxResolutionSize;
cfg.bufferCount = VirtualCameraConfiguration::kBufferCount;
cfg.colorSpace = ColorSpace::Rec709;
config->addConfiguration(cfg);
}