From patchwork Thu Jun 16 15:05:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 16244 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 D97BFBD808 for ; Thu, 16 Jun 2022 15:05:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E84806563A; Thu, 16 Jun 2022 17:05:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655391951; bh=m+XyrJG+euflFIWqM8ffd6Z6za3DtbqJeXv8dR+2OdI=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=n62OEHY7p7JaTpCFctqkorPZJsJ2OCsq5mfKjzmUISEqi84BDH050csXqnX1NoE9D gdG2uQJRooRHv+dHwBPOPLi6l2cPCqfD0EA8Sd137DXmb+UilvI/UNM8vyj859flJJ /eyhTLcYTAmssriXXK52IomJOSi/tQQpvqBYob5lp8/Kb5EuXbRrbnVxz9+cuc36nm GEmjq9ULCuUDSeHpTBElM49susVTS78r5g7fcO2XerGNbNJiBrgvAeBwPOfKupwJun X/vQfCGNWiHUKT7hmR3JkJZLQMlt6ZUX2L224lGkUWxqRCp+i9AnbJX7qpP+7JYB2f V6jUm8+sgwbEA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5F104600F0 for ; Thu, 16 Jun 2022 17:05:49 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="XCa0Ugja"; dkim-atps=neutral Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8C273415; Thu, 16 Jun 2022 17:05:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1655391949; bh=m+XyrJG+euflFIWqM8ffd6Z6za3DtbqJeXv8dR+2OdI=; h=From:To:Cc:Subject:Date:From; b=XCa0UgjaqZHkxqHrDRQQo9E+kDGFDfdGc5eBhwxVNtrBsH7eN5IrL4Q0dXAFG8ME5 12npPPscijhEBVx6p9djlGjxxRxLWYGitXaAdjw2o6L87MD2ole51oBxFcvpL1gruu yjHUk98f3SLnEvHz6lV4nZGSKDZsaqLDJaho0xi0= To: libcamera-devel@lists.libcamera.org Date: Thu, 16 Jun 2022 18:05:31 +0300 Message-Id: <20220616150535.21742-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v3 0/4] Replace boost JSON parser with libyaml in Raspberry Pi IPA 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: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hello, As mentioned in the subject, this patch series replaces the boost JSON parser with the YamlParser implementation based on libyaml for the Raspberry Pi IPA module. Compared to v2, the base work that introduces the iterator API has been sent separately in "[PATCH 0/7] libcamera: yaml_parser: Add iterator API". This series then addresses the specific needs of the Raspberry Pi IPA module. The Raspberry Pi IPA tuning data contains a list of algorithms stored in a mapping. Both the JSON and the YAML specifications explicitly state that mappings are not ordered, but the IPA relies on the JSON data order being preserved by the parser. This is an implementation-specific behaviour that happens to be match the boost JSON parser implementation, but not the YamlParser class. While in a perfect world we would update the tuning data format to avoid this problem, we don't want to break every tuning file out there, and thus need to ensure backward compatibility. This is why patches 1/4 and 2/4 update the parser and iterator implementation to preserve the data order, and patches 3/4 and 4/4 then move the Raspberry Pi IPA from boost to YamlParser. If this approach is deemed reasonable, then the next non-RFC version of the series should also include a new format for the Raspberry Pi IPA tuning data that would be compliant with the JSON specification, an update to the camera tuning tool to generate tuning files in that format, and possibly a Python script to convert existing files to the new format. Laurent Pinchart (4): test: yaml-parser: Test dictionary items ordering libcamera: yaml_parser: Preserve order of items in dictionary ipa: raspberrypi: Replace tabs with spaces in tuning data files ipa: raspberrypi: Use YamlParser to replace dependency on boost README.rst | 6 -- include/libcamera/internal/yaml_parser.h | 37 +++++--- src/ipa/raspberrypi/controller/algorithm.cpp | 2 +- src/ipa/raspberrypi/controller/algorithm.hpp | 6 +- src/ipa/raspberrypi/controller/controller.cpp | 27 ++++-- src/ipa/raspberrypi/controller/pwl.cpp | 12 ++- src/ipa/raspberrypi/controller/pwl.hpp | 5 +- src/ipa/raspberrypi/controller/rpi/agc.cpp | 94 +++++++++---------- src/ipa/raspberrypi/controller/rpi/agc.hpp | 10 +- src/ipa/raspberrypi/controller/rpi/alsc.cpp | 94 +++++++++---------- src/ipa/raspberrypi/controller/rpi/alsc.hpp | 2 +- src/ipa/raspberrypi/controller/rpi/awb.cpp | 89 +++++++++--------- src/ipa/raspberrypi/controller/rpi/awb.hpp | 8 +- .../controller/rpi/black_level.cpp | 12 +-- .../controller/rpi/black_level.hpp | 2 +- src/ipa/raspberrypi/controller/rpi/ccm.cpp | 28 +++--- src/ipa/raspberrypi/controller/rpi/ccm.hpp | 4 +- .../raspberrypi/controller/rpi/contrast.cpp | 18 ++-- .../raspberrypi/controller/rpi/contrast.hpp | 2 +- src/ipa/raspberrypi/controller/rpi/dpc.cpp | 4 +- src/ipa/raspberrypi/controller/rpi/dpc.hpp | 2 +- src/ipa/raspberrypi/controller/rpi/geq.cpp | 10 +- src/ipa/raspberrypi/controller/rpi/geq.hpp | 2 +- src/ipa/raspberrypi/controller/rpi/lux.cpp | 12 +-- src/ipa/raspberrypi/controller/rpi/lux.hpp | 2 +- src/ipa/raspberrypi/controller/rpi/noise.cpp | 6 +- src/ipa/raspberrypi/controller/rpi/noise.hpp | 2 +- src/ipa/raspberrypi/controller/rpi/sdn.cpp | 6 +- src/ipa/raspberrypi/controller/rpi/sdn.hpp | 2 +- .../raspberrypi/controller/rpi/sharpen.cpp | 8 +- .../raspberrypi/controller/rpi/sharpen.hpp | 2 +- src/ipa/raspberrypi/data/imx219.json | 8 +- src/ipa/raspberrypi/data/imx219_noir.json | 10 +- src/ipa/raspberrypi/data/imx290.json | 18 ++-- src/ipa/raspberrypi/data/imx477.json | 8 +- src/ipa/raspberrypi/data/imx477_noir.json | 10 +- src/ipa/raspberrypi/data/ov5647.json | 10 +- src/ipa/raspberrypi/data/ov5647_noir.json | 12 +-- src/ipa/raspberrypi/data/se327m12.json | 6 +- src/ipa/raspberrypi/meson.build | 1 - src/ipa/raspberrypi/raspberrypi.cpp | 1 + src/libcamera/yaml_parser.cpp | 35 ++++--- test/yaml-parser.cpp | 17 ++-- 43 files changed, 334 insertions(+), 318 deletions(-) base-commit: c5ab0f3b64280733a10b2da39e522fe87d0d51f0