From patchwork Thu Aug 6 16:36:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 9263 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 C8DAABD86F for ; Thu, 6 Aug 2020 16:36:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5107560554; Thu, 6 Aug 2020 18:36:50 +0200 (CEST) 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="kfyfL8e8"; dkim-atps=neutral Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E28DB60392 for ; Thu, 6 Aug 2020 18:36:48 +0200 (CEST) Received: by mail-wm1-x334.google.com with SMTP id k20so10284072wmi.5 for ; Thu, 06 Aug 2020 09:36:48 -0700 (PDT) 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=CR+8heI5r1zNsCykKV0Ttlx1bYDxcbVcYu91v9xkH+0=; b=kfyfL8e8ISy7/RCp1y2o5mWo1D5zKH8DofV/cAiw826K+TDr5bJuH40TFadwExISb8 5s7nc2sXpxwDMJf/sYLumduF7Z/+tkYoGUs9306AxejBslmJMQjzOyQr6G42t/u2M1Bu 0m0WoDqoYryF10apZ+c2k1kZe/kFEv+RNItSpO8CZut+KAg1KvmztFUOnRDNczELhL6k PZO1bMVwR27zQPFWVCzaPsLAi6rx3x34l9Ul6SKHFmCLClnEBHPXsuVufUd7A5cpZoS9 AAYecAS5lLCQFnS7inbLO2bkP7PQjArQC6j/Ivn/eSRS8ldxHvXPzOp6iQuR3bPve1i7 pGWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=CR+8heI5r1zNsCykKV0Ttlx1bYDxcbVcYu91v9xkH+0=; b=lbR7W5O2sxHKvsT7Z34Fnn22skVEn/LHtXBP3R7WC+cOKfVOf8fMmuIOqTUP5ID/vf MM6tkjRmhkjBrVe36+tWOG3oHJxtHHd9I9812orJ6wdKsMI/QDDP96U/Mcoqj9YLpST4 5UEW7W6/yRc+A2I8oYwm2QO+cVVOtMRi1JbWHB1AhpQY+cJwS58gnKkeqNaLo6nlltde 7j6mMbUMAtY06vfcDddB59ffghtZM1aUYqVrAzDD8M8xrcz/IF1OTDDONHJTsMNr12xE Np25MfEGlyZfwnhJPrMbK+pa4KOdh8o0G4+lHZtPRv/IuAydEURsDv8q1M3xp9LpPRjo Zo+Q== X-Gm-Message-State: AOAM530rb40laqlpVdUnUHGgBcLtNvy+7vTxGkED7b5QRz1+cFypldAQ iBS6gSumcvKp6pn7tySmECammOnYFW9T8w== X-Google-Smtp-Source: ABdhPJxRzujE6+ENplwYbxEfplljtmWqWEWBJGttR4s5g1lRHvhwkh3fYMg0JwKvRgoxZhJLHtfaZA== X-Received: by 2002:a7b:cf29:: with SMTP id m9mr8621006wmg.88.1596731808161; Thu, 06 Aug 2020 09:36:48 -0700 (PDT) Received: from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72]) by smtp.gmail.com with ESMTPSA id e5sm7405076wrc.37.2020.08.06.09.36.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 09:36:47 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Thu, 6 Aug 2020 17:36:34 +0100 Message-Id: <20200806163639.12971-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 0/5] Transform implementation 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 Here's a second version of the 2d transform implementation (still for discussion only). It follows the same principles as the previous version, but the ALSC issues that I ran into are no longer part of this set (indeed they have already been merged). There are now 5 patches. I'll add the relevant documentation once we can feel confident there won't be too much more churn. That leaves: 1. The first merely adds the Transform enum. I to-ed and fro-ed a bit here, and decided, after doing it both ways, that wrapping a class round the enum didn't add a whole lot, and just left me with more questions and more boilerplate. Anyway, see what you think... 2. The second patch adds the Transform enum to the CameraConfiguration. I've also amended all the pipeline handlers (including the Raspberry Pi one) simply to coerce it to the Identity if it wasn't, marking the configuration as "adjusted". 3. This patch updates the Raspberry Pi pipeline handler to allow all non-transposing transforms, and to set the flip bits in the sensor. 4. Here I just plumb the Transform through to the Raspberry Pi IPA where it gets put into the CameraMode structure. This bothered me first time round, but on reflection I think it's pragmatic to treat it like that from the point of view of the IPAs. 5. This updates the ALSC algorithm to transform the calibrated tables correctly. Note that we regenerate the tables from scratch if the transform changes. Best regards David David Plowman (5): libcamera: Add Transform enum to represet 2d plane transforms. libcamera: Add user Transform to CameraConfiguration libcamera: raspberrypi: Set camera flips correctly from user transform libcamera: raspberrypi: Plumb user transform through to IPA libcamera: ipa: raspberrypi: ALSC: Handle user transform include/libcamera/camera.h | 3 + include/libcamera/meson.build | 1 + include/libcamera/transform.h | 58 +++++++++++++ src/ipa/raspberrypi/controller/camera_mode.h | 4 + src/ipa/raspberrypi/controller/rpi/alsc.cpp | 13 ++- src/ipa/raspberrypi/raspberrypi.cpp | 48 ++++++----- src/libcamera/camera.cpp | 2 +- src/libcamera/meson.build | 1 + src/libcamera/pipeline/ipu3/ipu3.cpp | 5 ++ .../pipeline/raspberrypi/raspberrypi.cpp | 26 +++++- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 5 ++ src/libcamera/pipeline/simple/simple.cpp | 5 ++ src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 5 ++ src/libcamera/pipeline/vimc/vimc.cpp | 5 ++ src/libcamera/transform.cpp | 83 +++++++++++++++++++ 15 files changed, 238 insertions(+), 26 deletions(-) create mode 100644 include/libcamera/transform.h create mode 100644 src/libcamera/transform.cpp