[libcamera-devel] [PATCH 05/20] libcamera: pipeline: simple: converter: Configure input stride
paul.elder at ideasonboard.com
paul.elder at ideasonboard.com
Wed Feb 17 11:10:40 CET 2021
Hi Laurent,
On Mon, Feb 01, 2021 at 12:46:47AM +0200, 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>
Reviewed-by: Paul Elder <paul.elder 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;
>
> 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,
>
> Laurent Pinchart
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
More information about the libcamera-devel
mailing list