From patchwork Fri Aug 28 14:41:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 9415 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 13B9DBF019 for ; Fri, 28 Aug 2020 14:41:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 41AC16291C; Fri, 28 Aug 2020 16:41:18 +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="KgYP6zQK"; dkim-atps=neutral Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 874D16037B for ; Fri, 28 Aug 2020 16:41:16 +0200 (CEST) Received: by mail-wr1-x442.google.com with SMTP id c15so1515566wrs.11 for ; Fri, 28 Aug 2020 07:41:16 -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=WP9Pv/1l5mgNWqBSqrwpflCBzl/5vyglt1zKaWtoxQE=; b=KgYP6zQKcJQ7NMpSKXh/yoP1gl7IcRcxIF6c60hoZOwjZ4zu/y7K4mPBzhAIPJx7ks RWxDm8z6aqSsEO39eJr3vPSfXdw7lSz7O5C2A0k2Nhs+Idb3jiuZp3VVvlufVQj9dsWL rOj0yMYb50U5wRBD57Fu6JGN9H9+lggJ6bXkhPwb619ADuoRxLE+84VSYBDPDglfLq/z VA7eSFoD8UKNqkJ2FiuDbHwLethNp4fs1OTf3iH3OSDEDyiN0/BcujaErfNTpaibpXVC Q7owWrTESMZM+R7F7ZnsQnqDU7svHhDaoK/Xy1zUkzy2ZQs9tU20MSVYKeW3CFv2D4Xh ZI9g== 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=WP9Pv/1l5mgNWqBSqrwpflCBzl/5vyglt1zKaWtoxQE=; b=NZ4i/xumoI35724KHFbb/QKcm6Wh+HdgbWR/KvsHSkkT6zEKlB6GD0wpsy1hwxtgMB EZX6faECcr3mSR2HBfpvkyI46X8ycOnBIpVgZihH72aL0p65aI8X4PWXGzPEsF09lmeS U4+T2nYjmu2ZkwraRoN9EaCMkISHcZd24tSIkPh+Rs+/3dNBtGSFfZ0QdgF/0/z7KInt Py/jSUwlr7gJfmnSkwaeocZJCqZRI+qCjaCkK7fnDtM42zAQJnwjgOUdEaxtF+Efg+dN KOZQfNnh0bzobpxs+ctLGT2g+9tuEoPWt3+TIPC3yqyGUBDvTrQ9+hQMjXtGCTaxWAwJ 4jWw== X-Gm-Message-State: AOAM533KA4vKlB/DlyUFBGZ/iiGs7mKa4uq9YGuk3z3XsNAjru2B37/y fgmCMBC4YcjAFWyk9HO1uZWrTySHg+BYqQ== X-Google-Smtp-Source: ABdhPJyZqwiMw+o8LPgqU5lUa1yvBiCWXmuiRsZy9T5qi8wL1zii5UgrX8lBXFvtKVS+e7eIPpdqZA== X-Received: by 2002:adf:ba52:: with SMTP id t18mr1837141wrg.26.1598625675725; Fri, 28 Aug 2020 07:41:15 -0700 (PDT) Received: from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72]) by smtp.gmail.com with ESMTPSA id s12sm2493724wmj.26.2020.08.28.07.41.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 07:41:15 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Fri, 28 Aug 2020 15:41:03 +0100 Message-Id: <20200828144110.17303-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 0/7] 2D transforms 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 the latest version of 2D transforms. It's practically identical to the previous version, except for the (mostly documentation) improvements that were suggested, and the following points noted below. Firstly, there are 2 new commits at the start of this set. The first of these reverts the commit 1e8c91b65695449c5246d17ba7dc439c8058b781 that Kieran kindly pushed for us yesterday. Unfortunately that patch, whilst fine when Naush originally authored it, made it impossible to implement user-supplied transforms. Had it not been lurking in a rather forgotten state for so long I might have woken up to its problems sooner, so apologies for that. Anyway, I'm not quite sure if you have any conventions for exactly how to revert a patch. The second of these new patches moves the change made by the now reverted patch into the validate() method. This is early enough to fix the original bug (which was that raw streams were advertising an incorrect Bayer format), but co-exists happily with the transform code. (Would these two be better squished together?) Beyond that the only issues to bring up are in what is now the fifth commit of this series (third in the previous version). These relate to that email I sent a few days back. Specifically: * I assume the intention is, when no user-supplied transform is given, that we give out images that are corrected for any camera rotation. That is, the image, when viewed without any supplementary manipulations, should look like the world did when the picture was taken. Is this correct? * So if a camera advertises itself as having a 90 degree rotation, do I need to perform a 90 degree clockwise rotation to the image to correct it, or counter-clockwise? I read the documentation on the rotation property but must confess I was left a little hazy! (The consequence would be that the rotation angle may need negating.) * I've added a comment to say why I only flip the transpose bit when the combined transform is one we don't support. It makes life easier for the application because it either gets the transform it requested, or it only has to do a simple transpose. All the other possible transforms an application might worry about having to do just can't happen. Does that make sense? I think that's everything! Thanks and best regards David David Plowman (7): libcamera: pipeline: raspberrypi: Revert "Set sensor default orientation before configure()" libcamera: pipeline: raspberrypi: Set sensor orientation during validate 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 | 73 ++++ 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 | 16 +- src/libcamera/meson.build | 1 + src/libcamera/pipeline/ipu3/ipu3.cpp | 5 + .../pipeline/raspberrypi/raspberrypi.cpp | 60 +++- 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 | 312 ++++++++++++++++++ 15 files changed, 522 insertions(+), 34 deletions(-) create mode 100644 include/libcamera/transform.h create mode 100644 src/libcamera/transform.cpp