From patchwork Tue Jan 26 18:48:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Fricke X-Patchwork-Id: 11023 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 C75DFC0F2B for ; Tue, 26 Jan 2021 18:48:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2EBCF68321; Tue, 26 Jan 2021 19:48:59 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=posteo.net header.i=@posteo.net header.b="pDFPXqZc"; dkim-atps=neutral Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8C40668318 for ; Tue, 26 Jan 2021 19:48:57 +0100 (CET) Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id E3B522400FB for ; Tue, 26 Jan 2021 19:48:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1611686936; bh=X+D+Duwb6oTXKM5UfQxTBriBDNsob5F0YcdhglFov0w=; h=From:To:Cc:Subject:Date:From; b=pDFPXqZcWqttl8NZLNITL2k+xDMmPIf85zHDnnSxvDGOv9pwZv8rrgH3zkwb6BES/ W81kNTG5mA7VLXpxS0o9wh5Acyag2eNylcQf9/QYO4+NS/XNOwFd59x/74B6aBVlOH Jm157gBhLQRc8KvFexKIRcXL3ylocwpWOMMQV4r4HO41CYFDVW12WqqPycnIzz/5ou yFagnsnE+ea6B6JTWscDpoudbKCWgjrEDaSIlW8NlNzC+ZK98Ns7izqzd5vD/3X9Kg s9KnNWH9yHlYQdPzXE4fmsOPdNM1Uf4mbAMztxKRgv2mruROYoef1gGPN92PZ7YOm8 bWzx7dlyVWnXA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4DQG3W3yPBz6tmJ; Tue, 26 Jan 2021 19:48:55 +0100 (CET) From: Sebastian Fricke To: libcamera-devel@lists.libcamera.org Date: Tue, 26 Jan 2021 19:48:49 +0100 Message-Id: <20210126184854.46156-1-sebastian.fricke@posteo.net> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 0/5] Improve BayerFormat class 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" Improve BayerFormat class This patch series adds unit-tests, the `fromV4L2PixelFormat` static member function and the ==/!= operators to the BayerFormat class. --- Changes since version 2: * Improve the error messages of the unit tests by reducing them to a single-line if possible. * Change the test that makes sure that an invalid BayerFormat doesn't yield a V4L2PixelFormat to use an empty BayerFormat instead of an imaginary one. * Add the transpose transformation to the transform method. * Add an extra test that makes sure that a transpose on a format causes red and blue pixels that are on the antidiagonal to switch their position. * Change the transpose tests to not compare BayerFormat string representations. * Combine the modifications in the Raspberry Pi pipeline with the first patch that adds the `fromV4L2PixelFormat` static member function. * Add documentation for the `!=` operator. * Split the removal of the deprecated constructor and mapping table from the addition of the `fromV4L2PixelFormat` function. * Fix indentation issues. Changes since version 1: * Convert the `fromV4L2PixelFormat` to a static member function, as it doesn't contain any self use. * Adjust the current user of the old constructor (raspberryPi pipeline) to use the new function. * Add the ==/!= operators to improve tests and to add helpful helper functions. * Change the logic of `fromV4L2PixelFormat` by replace the search of a matching bayer format to a v4l2 pixel format with a search for a matching v4l2 pixel format to a bayer format. * Remove the v4l2ToBayer mapping table as it lost it's last user * Remove 'TEST \d:' & 'TEST \d: FAIL:' pattern from comments and messages within the unit tests. * Convert variable names from snake_case to camelCase. * Add an additional to test to confirm that we cannot get a V4L2PixelFormat from a BayerFormat not found in the mapping table. * Add tests for the == & != operators * Change the test within the Transform unit tests from a comparision of string formats to a direct compare of the BayerFormat objects. * Unify the test error messages by enclosing the expected and actual string representations in '' * Fix checkstyle errors. * Add explaination for why the transpose functionality was ignored within the unit test. --- Sebastian Fricke (5): libcamera: Add the fromV4L2PixelFormat function libcamera: Remove unnecessary constructor libcamera: Overload ==/!= operators for BayerFormats libcamera: Add the transpose transformation test: Add unit tests for the BayerFormat class include/libcamera/internal/bayer_format.h | 8 +- src/libcamera/bayer_format.cpp | 89 ++++---- .../pipeline/raspberrypi/raspberrypi.cpp | 4 +- test/bayer_format.cpp | 210 ++++++++++++++++++ test/meson.build | 1 + 5 files changed, 260 insertions(+), 52 deletions(-) create mode 100644 test/bayer_format.cpp