From patchwork Sun Aug 7 02:17:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 17005 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id D95AEBE173 for ; Sun, 7 Aug 2022 02:17:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 514DB6332F; Sun, 7 Aug 2022 04:17:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1659838650; bh=fMcU8iv+QcFfB6PnVplcf+n6XKNjTQQd6jhd4MaRAXI=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=WEH/uVeQL+EjgKuAadPLNpIw4jaqUCOX52QhDD0J22CfxjH8qHn8zBPlT9MEGQuHV tB8o9qL2JNFh2xCKrLGWgyLWo/weenHJsYlQ0sNL1AZ9/1AFX4nnFoB30zv3eE2WDw I6Q5ML+WFXoLZwqUQSacdrdnS3hPGm72TfOYHziX3lIkMzX0O4Cu9OfBLBO3eQS0mE QUjLTcu3tcg3+WGXKaHWt+nn6iru1R9qafs6xDO57t9D8xWe8Cbeqh5kQAPX8enGEZ xqiibrRrks8V7ghRFeE2RfpKaw9RKxzO32PP31Ft51LzLb6UDOoItA0pbiOlJoarUT HgQkdMjs0qgCA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 86E2263325 for ; Sun, 7 Aug 2022 04:17:28 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="BPdF4Y+s"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1E60E749; Sun, 7 Aug 2022 04:17:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1659838648; bh=fMcU8iv+QcFfB6PnVplcf+n6XKNjTQQd6jhd4MaRAXI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BPdF4Y+stEQuFV0TjyBP5dpjS3DuvniBE8APHGOhXHijBsFIzESuPOxtdk7MWovzs 2MjZ/r42sLuRCq1qZrzSfAwCjsWgxsa5P5yJcgQyr1rIKL+gW+b4JOZjG/2d/gbbIZ BPwDTF0ppefpl8a8LbR614cQyMrBYiOIKpSB35XY= To: libcamera-devel@lists.libcamera.org Date: Sun, 7 Aug 2022 05:17:15 +0300 Message-Id: <20220807021718.9789-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220807021718.9789-1-laurent.pinchart@ideasonboard.com> References: <20220807021718.9789-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/4] cam: sdl_texture_yuyv: Make line stride configurable X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The line stride of the texture is currently hardcoded based on the image width, which may not match the real stride. Use the stride value from the stream configuration instead. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi Reviewed-by: Eric Curtin --- src/cam/sdl_sink.cpp | 2 +- src/cam/sdl_texture_yuyv.cpp | 4 ++-- src/cam/sdl_texture_yuyv.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cam/sdl_sink.cpp b/src/cam/sdl_sink.cpp index 19fdfd6dced5..a59d07519e1f 100644 --- a/src/cam/sdl_sink.cpp +++ b/src/cam/sdl_sink.cpp @@ -68,7 +68,7 @@ int SDLSink::configure(const libcamera::CameraConfiguration &config) break; #endif case libcamera::formats::YUYV: - texture_ = std::make_unique(rect_); + texture_ = std::make_unique(rect_, cfg.stride); break; default: std::cerr << "Unsupported pixel format " diff --git a/src/cam/sdl_texture_yuyv.cpp b/src/cam/sdl_texture_yuyv.cpp index 637c0900edff..cb51fb0ef478 100644 --- a/src/cam/sdl_texture_yuyv.cpp +++ b/src/cam/sdl_texture_yuyv.cpp @@ -9,8 +9,8 @@ using namespace libcamera; -SDLTextureYUYV::SDLTextureYUYV(const SDL_Rect &rect) - : SDLTexture(rect, SDL_PIXELFORMAT_YUY2, 4 * ((rect.w + 1) / 2)) +SDLTextureYUYV::SDLTextureYUYV(const SDL_Rect &rect, unsigned int stride) + : SDLTexture(rect, SDL_PIXELFORMAT_YUY2, stride) { } diff --git a/src/cam/sdl_texture_yuyv.h b/src/cam/sdl_texture_yuyv.h index 529a72d6a40e..81e51381ec62 100644 --- a/src/cam/sdl_texture_yuyv.h +++ b/src/cam/sdl_texture_yuyv.h @@ -12,6 +12,6 @@ class SDLTextureYUYV : public SDLTexture { public: - SDLTextureYUYV(const SDL_Rect &rect); + SDLTextureYUYV(const SDL_Rect &rect, unsigned int stride); void update(libcamera::Span data) override; };