From patchwork Wed Aug 3 11:26:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 16945 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 933B2C3272 for ; Wed, 3 Aug 2022 11:26:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0ABCF603E6; Wed, 3 Aug 2022 13:26:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1659526013; bh=uU+IUBGESwQUoHw9ID6FYqV+qleaYFoduTjFhxwbwuQ=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=ymL8LJzppgs1UINDLt1LeYLdbvQCPaGMAFNpx8jp/tT8DxfSev24HThKF2M0Y1NLl x/ZO6zK8VEVgQpGWijwvc4yfMLNT7Ev/3Hyb07nV3yjfoWdFjZdCKtUDnGyox/q9mu w13+mG9kQTFBCMhdJns3Utmz5v2yaXZFtYqwAjkCLjns8DS2AIGn6DeoMEzLfu4D9j LGp9YMT0JWh9hV47LztIwiA8+FOQmfHmb2oLVFBEfRI5COwWkAZc/32fDCFmPRcu2e LDPGU/CaomQYuL9tLB/5+i+iRRpiyeNDKnLJvVqVIgRrbCcnQSF2P3M/WRvky6Zeq3 MRI5UPTkeSlpA== Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 90F07603E6 for ; Wed, 3 Aug 2022 13:26:51 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 470AD1BF203; Wed, 3 Aug 2022 11:26:48 +0000 (UTC) To: libcamera-devel@lists.libcamera.org Date: Wed, 3 Aug 2022 13:26:32 +0200 Message-Id: <20220803112640.30402-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 0/8] libcamera: Map multiple V4L2 formats to a single libcamera::format 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: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Cc: jozef@mlich.cz, Pavel Machek Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This series addresses the requirement of mapping multiple V4L2 pixel formats to a single libcamera format. Specifically, it allows to map V4L2_PIX_FMT_JPEG and V4L2_PIX_FMT_MJPEG to libcamera::formats::MJPEG. When testing on Pinephone I was able to capture JPEG (but not to inspect images) and YUYV. This time the sensor didn't fail me, and I was able to run a preview stream on the pinephone using the SDL backend. v5->v6: - Break-out Laurent's patch that introduces std::hash v4->v5: - Use std::hash specialization - Address Laurent's comment on 5/6 - Add a tiny patch for the developer guide v3->v4: - Move 2/6 at the beginning and simplify it - Biggest change is in V4L2VideoDevice where formats are now collected in an unordered_set<> requiring V4L2PixelFormat to be instrumented with an Hash function object to allow it to be stored in an unordered STL container - Minor changes in comments/wording and Laurent's tags v2->v3: - Resorted patches as suggested by Laurent - Remove 'multiplanar' argument in the call chain - Cache the V4L2VideoDevice formats at open() time v1->v2: - Add a missing conversion using the video device in Simple converter - Map formats::MJPEG to V4L2_PIX_FMT_JPEG in v4l2 formats enumeration Jacopo Mondi (7): libcamera: formats: Reimplement V4L2 PixelFormatInfo::info() libcamera: formats: Merge V4L2 single and multi formats guides: pipeline handler: Remove rogue spaces libcamera: v4l2_videodevice: Reintroduce toV4L2PixelFormat() libcamera: v4l2_pixelformat: Return the list of V4L2 formats libcamera: v4l2_videodevice: Match formats supported by the device libcamera: formats: Map V4L2_PIX_FMT_JPEG to formats::MJPEG Laurent Pinchart (1): libcamera: v4l2_pixelformat: Implement std::hash specialization Documentation/guides/pipeline-handler.rst | 9 +- include/libcamera/internal/formats.h | 5 +- include/libcamera/internal/v4l2_pixelformat.h | 18 +- include/libcamera/internal/v4l2_videodevice.h | 6 + src/libcamera/formats.cpp | 318 ++++-------------- src/libcamera/pipeline/ipu3/cio2.cpp | 2 +- src/libcamera/pipeline/ipu3/imgu.cpp | 2 +- .../pipeline/raspberrypi/raspberrypi.cpp | 34 +- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 6 +- src/libcamera/pipeline/simple/converter.cpp | 10 +- src/libcamera/pipeline/simple/simple.cpp | 4 +- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 6 +- src/libcamera/pipeline/vimc/vimc.cpp | 8 +- src/libcamera/v4l2_pixelformat.cpp | 24 +- src/libcamera/v4l2_videodevice.cpp | 61 +++- src/v4l2/v4l2_camera_proxy.cpp | 6 +- test/libtest/buffer_source.cpp | 2 +- 17 files changed, 211 insertions(+), 310 deletions(-) Tested-by: Paul Elder --- 2.37.1