{"id":23266,"url":"https://patchwork.libcamera.org/api/1.1/patches/23266/?format=json","web_url":"https://patchwork.libcamera.org/patch/23266/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250425104703.805170-5-barnabas.pocze@ideasonboard.com>","date":"2025-04-25T10:47:03","name":"[v2,4/4] apps: cam: sdl_sink: Support more single-plane formats","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"ecef3e2628a7f5c5b52e4aebd16f398f9d922155","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/1.1/people/216/?format=json","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/23266/mbox/","series":[{"id":5146,"url":"https://patchwork.libcamera.org/api/1.1/series/5146/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5146","date":"2025-04-25T10:46:59","name":"apps: cam: sdl_sink: Support more RGB and YUV formats","version":2,"mbox":"https://patchwork.libcamera.org/series/5146/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/23266/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23266/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 23383C331F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 25 Apr 2025 10:47:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B02F468AD3;\n\tFri, 25 Apr 2025 12:47:15 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D0C568ACE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Apr 2025 12:47:08 +0200 (CEST)","from pb-laptop.local (185.221.143.16.nat.pool.zt.hu\n\t[185.221.143.16])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 77ED5124E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Apr 2025 12:47:05 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"DYoTwrIO\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1745578025;\n\tbh=+zO/B1gEf8pl4/U+0u2UElF0OJjS0wJydIY08B5o+ek=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=DYoTwrIO9Xe2p1hQoxrkJZAWbHsmr4cHY4+T7uvI8chL0B/5lADoTxpOyOW/8CdlT\n\tFmM2YCtnCAoCr035JJhTnKR22kR8IsqZYEVDN0CBlnoFkv9BuWqgZpsaeUypNAUozp\n\tkR3gRnAGL0Za8awcoJlqzoqlgScJjFCD4w7xTop0=","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH v2 4/4] apps: cam: sdl_sink: Support more single-plane\n\tformats","Date":"Fri, 25 Apr 2025 12:47:03 +0200","Message-ID":"<20250425104703.805170-5-barnabas.pocze@ideasonboard.com>","X-Mailer":"git-send-email 2.49.0","In-Reply-To":"<20250425104703.805170-1-barnabas.pocze@ideasonboard.com>","References":"<20250425104703.805170-1-barnabas.pocze@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"With the newly introduced `SDLTexture1Plane` it is easy to handle\nany single-plane format that has an SDL equivalent. So use it for\nmore YUV and RGB formats.\n\nThe mapping of RGB formats is not entirely straightforward because\n`SDL_PIXELFORMAT_ZZZ...888...` defines a format where the order of\nthe components is endian dependent, while libcamera's `ZZZ...888...`\nformats are derived from the matching DRM formats, and the RGB formats\nin question are defined to be little-endian there. So the\nendian-independent `SDL_PIXELFORMAT_{ZZZ24,ZZZZ32}` are used.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n src/apps/cam/sdl_sink.cpp | 36 ++++++++++++++++++++++++++++++++++++\n 1 file changed, 36 insertions(+)","diff":"diff --git a/src/apps/cam/sdl_sink.cpp b/src/apps/cam/sdl_sink.cpp\nindex b295675dc..2edbb523d 100644\n--- a/src/apps/cam/sdl_sink.cpp\n+++ b/src/apps/cam/sdl_sink.cpp\n@@ -77,6 +77,42 @@ int SDLSink::configure(const libcamera::CameraConfiguration &config)\n \tcase libcamera::formats::YUYV:\n \t\ttexture_ = std::make_unique<SDLTexture1Plane>(rect_, SDL_PIXELFORMAT_YUY2, cfg.stride);\n \t\tbreak;\n+\tcase libcamera::formats::UYVY:\n+\t\ttexture_ = std::make_unique<SDLTexture1Plane>(rect_, SDL_PIXELFORMAT_UYVY, cfg.stride);\n+\t\tbreak;\n+\tcase libcamera::formats::YVYU:\n+\t\ttexture_ = std::make_unique<SDLTexture1Plane>(rect_, SDL_PIXELFORMAT_YVYU, cfg.stride);\n+\t\tbreak;\n+\tcase libcamera::formats::ARGB8888:\n+\t\ttexture_ = std::make_unique<SDLTexture1Plane>(rect_, SDL_PIXELFORMAT_BGRA32, cfg.stride);\n+\t\tbreak;\n+\tcase libcamera::formats::XRGB8888:\n+\t\ttexture_ = std::make_unique<SDLTexture1Plane>(rect_, SDL_PIXELFORMAT_BGRX32, cfg.stride);\n+\t\tbreak;\n+\tcase libcamera::formats::RGBA8888:\n+\t\ttexture_ = std::make_unique<SDLTexture1Plane>(rect_, SDL_PIXELFORMAT_ABGR32, cfg.stride);\n+\t\tbreak;\n+\tcase libcamera::formats::RGBX8888:\n+\t\ttexture_ = std::make_unique<SDLTexture1Plane>(rect_, SDL_PIXELFORMAT_XBGR32, cfg.stride);\n+\t\tbreak;\n+\tcase libcamera::formats::ABGR8888:\n+\t\ttexture_ = std::make_unique<SDLTexture1Plane>(rect_, SDL_PIXELFORMAT_RGBA32, cfg.stride);\n+\t\tbreak;\n+\tcase libcamera::formats::XBGR8888:\n+\t\ttexture_ = std::make_unique<SDLTexture1Plane>(rect_, SDL_PIXELFORMAT_RGBX32, cfg.stride);\n+\t\tbreak;\n+\tcase libcamera::formats::BGRA8888:\n+\t\ttexture_ = std::make_unique<SDLTexture1Plane>(rect_, SDL_PIXELFORMAT_ARGB32, cfg.stride);\n+\t\tbreak;\n+\tcase libcamera::formats::BGRX8888:\n+\t\ttexture_ = std::make_unique<SDLTexture1Plane>(rect_, SDL_PIXELFORMAT_XRGB32, cfg.stride);\n+\t\tbreak;\n+\tcase libcamera::formats::RGB888:\n+\t\ttexture_ = std::make_unique<SDLTexture1Plane>(rect_, SDL_PIXELFORMAT_BGR24, cfg.stride);\n+\t\tbreak;\n+\tcase libcamera::formats::BGR888:\n+\t\ttexture_ = std::make_unique<SDLTexture1Plane>(rect_, SDL_PIXELFORMAT_RGB24, cfg.stride);\n+\t\tbreak;\n \tdefault:\n \t\tstd::cerr << \"Unsupported pixel format \"\n \t\t\t  << cfg.pixelFormat.toString() << std::endl;\n","prefixes":["v2","4/4"]}