[libcamera-devel] [PATCH 05/20] libcamera: pipeline: simple: converter: Configure input stride
Kieran Bingham
kieran.bingham at ideasonboard.com
Fri Feb 19 18:19:14 CET 2021
On 31/01/2021 22:46, Laurent Pinchart wrote:
> Use the stride of the video capture device to configure the converter
> input. This ensures that no stride mismatch occurs inadvertently along
> the pipeline.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
> src/libcamera/pipeline/simple/converter.cpp | 5 ++++-
> src/libcamera/pipeline/simple/simple.cpp | 1 +
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp
> index 6f4e41db2e00..550b2bcfb001 100644
> --- a/src/libcamera/pipeline/simple/converter.cpp
> +++ b/src/libcamera/pipeline/simple/converter.cpp
> @@ -159,6 +159,8 @@ int SimpleConverter::configure(const StreamConfiguration &inputCfg,
> V4L2DeviceFormat format;
> format.fourcc = videoFormat;
> format.size = inputCfg.size;
> + format.planesCount = 1;
> + format.planes[0].bpl = inputCfg.stride;
Are we lacking multiple plane description in the StreamConfiguration or
such ?
I guess it doesn't matter if this only supports a single planar format
anyway, given the hardcoded planesCount.
Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
>
> ret = m2m_->output()->setFormat(&format);
> if (ret < 0) {
> @@ -167,7 +169,8 @@ int SimpleConverter::configure(const StreamConfiguration &inputCfg,
> return ret;
> }
>
> - if (format.fourcc != videoFormat || format.size != inputCfg.size) {
> + if (format.fourcc != videoFormat || format.size != inputCfg.size ||
> + format.planes[0].bpl != inputCfg.stride) {
> LOG(SimplePipeline, Error)
> << "Input format not supported";
> return -EINVAL;
> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
> index 0a53fa934261..1ed67bcec490 100644
> --- a/src/libcamera/pipeline/simple/simple.cpp
> +++ b/src/libcamera/pipeline/simple/simple.cpp
> @@ -606,6 +606,7 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)
> StreamConfiguration inputCfg;
> inputCfg.pixelFormat = pipeConfig.pixelFormat;
> inputCfg.size = pipeConfig.captureSize;
> + inputCfg.stride = captureFormat.planes[0].bpl;
>
> ret = converter_->configure(inputCfg, cfg);
> if (ret < 0) {
>
--
Regards
--
Kieran
More information about the libcamera-devel
mailing list