From patchwork Tue Dec 12 17:36:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Machek X-Patchwork-Id: 19313 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 57EA8C31E9 for ; Tue, 12 Dec 2023 17:36:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 17D3662B32; Tue, 12 Dec 2023 18:36:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1702402593; bh=asjbcICJpQmziGzEPJcpTG5VbXkzK/GaaGtVXUNU+JI=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=iUReS/3K1luV7v6ojaXsGrW0GRWH+OOdIbNxJM+bwLP+MQULkOfYRg+RhS0Dydd+b lUJhi7a2MKzlI0L4SxyTj99OxDwsa/U5xrXCVONXWT1MAMPHte+/UJU0TH9HnYtizn q+aittSRRrMnGFFYNVpZ0nU3UnkFqOzX+Q/Y/T54n9KfOCC6k/cdl4sf44IxrBqDeE qcwr7MtU67FJhlM/313tG9SAGlXMflq5FjS2rUu+C3z9IzpyISTYBOyqvxJEsbx3X7 wfhLkReLRcOR6Eav4OVTkZibuYbc7v2yWZmpWjuG+Z3f+W32GwerZYNBF67/ZxY0W7 JLH/SKOhBuWcw== Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8F05E629BD for ; Tue, 12 Dec 2023 18:36:31 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ucw.cz header.i=@ucw.cz header.b="cH1kz3kf"; dkim-atps=neutral Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 476871C006F; Tue, 12 Dec 2023 18:36:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1702402591; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=MWPoHTCR6MsqC6PNiRzS0XfCXTSOYTY+Bfgbje+TrCU=; b=cH1kz3kfvnv1S+3psua1oglk7o5Eg0U2qFcZeplI5S+GwxgIaUonoqUJyQOCZppeXTtflx hZt13qD+fJE+OCSvDCU1QJCMgxxBP487TdL/+fsweMCOJpCUXoDXPW+fgvPezgFEttPxjm vamO7Q8iltDUQmPPSHrrIwI2uIoJurs= Date: Tue, 12 Dec 2023 18:36:30 +0100 To: kieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org Message-ID: MIME-Version: 1.0 Content-Disposition: inline Subject: [libcamera-devel] cam: Support RGB888 texture in sdl sink 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: Pavel Machek via libcamera-devel From: Pavel Machek Reply-To: Pavel Machek Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Briefly tested on PinePhone, it is useful for SoftISP testing. Signed-off-by: Pavel Machek diff --git a/src/apps/cam/sdl_sink.cpp b/src/apps/cam/sdl_sink.cpp index a2f4abc1..105fa781 100644 --- a/src/apps/cam/sdl_sink.cpp +++ b/src/apps/cam/sdl_sink.cpp @@ -76,6 +76,9 @@ int SDLSink::configure(const libcamera::CameraConfiguration &config) case libcamera::formats::YUYV: texture_ = std::make_unique(rect_, cfg.stride); break; + case libcamera::formats::RGB888: + texture_ = std::make_unique(rect_, cfg.stride); + break; default: std::cerr << "Unsupported pixel format " << cfg.pixelFormat.toString() << std::endl; diff --git a/src/apps/cam/sdl_texture_yuv.cpp b/src/apps/cam/sdl_texture_yuv.cpp index b29c3b93..bb066540 100644 --- a/src/apps/cam/sdl_texture_yuv.cpp +++ b/src/apps/cam/sdl_texture_yuv.cpp @@ -31,3 +31,13 @@ void SDLTextureYUYV::update(const std::vector> &d { SDL_UpdateTexture(ptr_, &rect_, data[0].data(), stride_); } + +SDLTextureRGB888::SDLTextureRGB888(const SDL_Rect &rect, unsigned int stride) + : SDLTexture(rect, SDL_PIXELFORMAT_BGR24, stride) +{ +} + +void SDLTextureRGB888::update(const std::vector> &data) +{ + SDL_UpdateTexture(ptr_, &rect_, data[0].data(), stride_); +} diff --git a/src/apps/cam/sdl_texture_yuv.h b/src/apps/cam/sdl_texture_yuv.h index 310e4e50..0df6b445 100644 --- a/src/apps/cam/sdl_texture_yuv.h +++ b/src/apps/cam/sdl_texture_yuv.h @@ -24,3 +24,10 @@ public: SDLTextureYUYV(const SDL_Rect &rect, unsigned int stride); void update(const std::vector> &data) override; }; + +class SDLTextureRGB888 : public SDLTexture +{ +public: + SDLTextureRGB888(const SDL_Rect &rect, unsigned int stride); + void update(const std::vector> &data) override; +};