From patchwork Thu Nov 18 15:19:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 14625 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 315ADBF415 for ; Thu, 18 Nov 2021 15:20:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EAD716038C; Thu, 18 Nov 2021 16:20:27 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="LrZAlxjN"; dkim-atps=neutral Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6E91760231 for ; Thu, 18 Nov 2021 16:20:25 +0100 (CET) Received: by mail-wr1-x42e.google.com with SMTP id i5so12303216wrb.2 for ; Thu, 18 Nov 2021 07:20:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=R4/p7uP0QJqxjLfDeo8xd5JBqwpPtnwHa8VtEFPdRzc=; b=LrZAlxjNWuBmKkCBUWIobhT9qhKqmCBO3NeyDDfzFHbUF23gyIw5UPwLASyNGjL1vU /7gpygMJgdoBtOufunwq8UP87NRsuSU79vul2TG+9Q604tT/vaOWuqO35b9q76wEcdsv RdOYuyvC7q6oYqTPO2Zcp/Tm6edL3VJaq0aF0CwR8JT7Hjfwo6mlUsIPkNYgi1fWPURn ixMyPke6gj5XOJZ1AE2K0tonp0sSTF4FVC/YljW0+dwkN09Q2D38mbIP+KT5uPe6Jkgm jMYKp/LhUV8/QNMBVOvYCtFaa48KkNYh+4D1YBAJWSiZD2POC99xr3HeGBVBX89rWfNC H5Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=R4/p7uP0QJqxjLfDeo8xd5JBqwpPtnwHa8VtEFPdRzc=; b=zWF+w+SCMcn2Ikj5+xwWZp9lBz6C2X1T+xXgU+NAtpHwEWMC4TaGtp9h1rt2IDH2bi gcLhlvxBfqT3SWSbCMw1w75bIxBHdSjB/BeaQ0r59wklTS6mwnGpDMweHbP9UTZ1uVtO sSuSWOysB4C6yhNSxyF9C3Gj9kFbBqxdapJ4Jl7wl2KSzW/EsWFln8geYI6fkQcGxFk9 DCyP+aStZLIJxXf24vK7PpFQzG3BwT9Upjbe20uckbKDZpx6R9e/7Kn9oAioJYRINkmQ iwEx+QOIu92PhRmzygfVoGLulM/1GFyX5P4gokRGAc6qw/v/+4QGDyMrIxzkQtvaa+1t oLIQ== X-Gm-Message-State: AOAM532jMyiTmNUBf1kvTasjK8NOwqb8eHZBi+a5nZ3eAxFP9OXYct3X AyNp8Tz4AZuc9XHeT294PbCYJw== X-Google-Smtp-Source: ABdhPJwZSsF90BNZ6iwtwBZpFe4D6Cw40CpPHzLQ6AP+9WwfpFZIyKmfpMBCd+PVB0vjqSeb7/G5Cg== X-Received: by 2002:a05:6000:2a2:: with SMTP id l2mr31378747wry.110.1637248825090; Thu, 18 Nov 2021 07:20:25 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:1ce1:9965:4328:89c4]) by smtp.gmail.com with ESMTPSA id p12sm147367wro.33.2021.11.18.07.20.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 07:20:24 -0800 (PST) From: David Plowman To: laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com, hverkuil-cisco@xs4all.nl, tfiga@google.com, jacopo@jmondi.org, naush@raspberrypi.com, libcamera-devel@lists.libcamera.org Date: Thu, 18 Nov 2021 15:19:26 +0000 Message-Id: <20211118151933.15627-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 0/7] Colour spaces 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hi everyone Thanks very much to everyone who took part in the call the other day, I think it's a big help in trying to get important topics unblocked! Following on from that, here's a v6 version of this patch set. There are a few things to point out: * std::optional has reappeared, so you can now avoid saying what colour space you want. std::optional percolates all the way down to our V4L2 interface where an unset colour space will result in passing "all default" to the actual driver. * The set of colour spaces I've defined for the ColorSpace class is pretty minimal, though it includes, I expect, the vast majority of real use cases. But we should add others that folks expect to use. * If a device uses a colour space that isn't included in the ColorSpace class list, then an error message will be output though the program will continue. This indicates that you really ought to take a look and consider adding the missing ColorSpace. * Actually, given that we use std::optional, if a device's colour space doesn't have a matching ColorSpace, then it will return an "unset" value. (Whenever you get "unset" back as the colour space, then that's definitely a warning sign.) * There's a corner case about metadata pads - unsurprisingly we can't find a matching ColorSpace so you get a warning printed out. Is there a "proper" way to detect that it's a metadata pad in that bit of code? * We did talk about having the StreamConfiguration contain a list of the acceptable colour spaces. I haven't added that yet, do we want to? We could do so as an extra patch. I'm sorry if it feels a bit like we're starting again here, but hopefully we're now moving forwards rather than round in circles, with minimal risk of completely changing our minds! Thanks again David David Plowman (7): libcamera: Add ColorSpace class libcamera: Add ColorSpace fields to StreamConfiguration libcamera: Convert between ColorSpace class and V4L2 formats libcamera: Support passing ColorSpaces to V4L2 video devices libcamera: Support passing ColorSpaces to V4L2 subdevices libcamera: Add validateColorSpaces to CameraConfiguration class libcamera: pipeline: raspberrypi: Support color spaces include/libcamera/camera.h | 2 + include/libcamera/color_space.h | 79 ++++++ include/libcamera/internal/v4l2_device.h | 7 + include/libcamera/internal/v4l2_subdevice.h | 2 + include/libcamera/internal/v4l2_videodevice.h | 2 + include/libcamera/meson.build | 1 + include/libcamera/stream.h | 3 + src/libcamera/camera.cpp | 51 ++++ src/libcamera/camera_sensor.cpp | 1 + src/libcamera/color_space.cpp | 243 ++++++++++++++++++ src/libcamera/meson.build | 1 + .../pipeline/raspberrypi/raspberrypi.cpp | 42 +++ src/libcamera/stream.cpp | 14 + src/libcamera/v4l2_device.cpp | 190 ++++++++++++++ src/libcamera/v4l2_subdevice.cpp | 35 ++- src/libcamera/v4l2_videodevice.cpp | 53 +++- 16 files changed, 721 insertions(+), 5 deletions(-) create mode 100644 include/libcamera/color_space.h create mode 100644 src/libcamera/color_space.cpp