{"id":21249,"url":"https://patchwork.libcamera.org/api/1.1/covers/21249/?format=json","web_url":"https://patchwork.libcamera.org/cover/21249/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20240913075750.35115-1-stefan.klug@ideasonboard.com>","date":"2024-09-13T07:57:18","name":"[v2,0/9] Implement polynomial lsc support","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/1.1/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/cover/21249/mbox/","series":[{"id":4587,"url":"https://patchwork.libcamera.org/api/1.1/series/4587/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4587","date":"2024-09-13T07:57:18","name":"Implement polynomial lsc support","version":2,"mbox":"https://patchwork.libcamera.org/series/4587/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/21249/comments/","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C0660C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 13 Sep 2024 07:57:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5CC6B634FC;\n\tFri, 13 Sep 2024 09:57:56 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C7200634F4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 13 Sep 2024 09:57:54 +0200 (CEST)","from ideasonboard.com (213-229-8-243.static.upcbusiness.at\n\t[213.229.8.243])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BDD275A5;\n\tFri, 13 Sep 2024 09:56:35 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"g/kOcZ2I\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1726214195;\n\tbh=UlyJBXV3G3Pgv4CtnL8DtSkCREV85Wi9l/5Mr2TG50s=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=g/kOcZ2IWgInEcYeC97pBcCsE6z5DPCB5oIVlorgp/e22m5cHGUwuZCid31iScUSG\n\tk9Mbghyj3sPN8rRuMBl/yZ6pxwW/IN9y7WE+nnYTcyxVNXM94xhili/nA0UK31R54z\n\tmScr101AA7PJi0o+gbzS3U2smInSlPno3ykpt2VU=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH v2 0/9] Implement polynomial lsc support","Date":"Fri, 13 Sep 2024 09:57:18 +0200","Message-ID":"<20240913075750.35115-1-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Hi all,\n\nPolynomial functions allow a precise representation of the lensshading.\nThe formula used here is from the DNG specification [2] page 110.\nInitial implementations in libtuning show that the overall error is\nquite low, but it is not yet clear if the ability to model the lens\nshading is sufficient for all cases.\n\nThe huge benefit of polynomials is that they can be easily resampled for\narbitrary crop rectangles. In case of the rkisp1 the hardware is\nconfigured using a 17x17 grid of gains.  Resampling these for a\narbitrary crop rectangle on the sensor leads to a degradation in\nquality. This can either be mitigated using a higher resolution grid as\nbasis or by describing the lens shading using polynomials. This series\nimplements the latter.\n\nPatches 1-4 replace the matrix interpolator with a generic interpolator\nclass. This is only refactoring without functional changes.\n\nPatch 5 Uses the new interpolator for the current lsc algorithm.\n\nPatch 6-9 Implement a loader for polynomial lens shading coefficients.\nSampling for the current sensor crop rectangle is done at load time.\n\n[1] https://patchwork.libcamera.org/project/libcamera/list/?series=4514\n[1] https://helpx.adobe.com/content/dam/help/en/photoshop/pdf/DNG_Spec_1_7_1_0.pdf\n\nChanges in v2:\n- Renamed polynomial class to LscPolynomial to better expresss the\n  intent.\n- Fixed some stylistic issues form review\n- Added test for interpolator\n- Improved interpolator efficiency\n- Add docs for LscPolynomial\n\nStefan Klug (9):\n  ipa: libipa: Add generic Interpolator class\n  test: ipa: libipa: Add tets for Interpolator\n  ipa: rkisp1: Use generic Interpolator class\n  ipa: rkisp1: Remove MatrixInterpolator\n  ipa: rkisp1: Use interpolator in lsc\n  ipa: rkisp1: Move loader functions into helper class\n  ipa: libipa: Add lsc polynomial class\n  ipa: rkisp1: Add sensor info to context\n  ipa: rkisp1: Add polynomial LSC loader\n\n src/ipa/libipa/interpolator.cpp        | 156 ++++++++++\n src/ipa/libipa/interpolator.h          | 131 ++++++++\n src/ipa/libipa/lsc_polynomial.cpp      |  81 +++++\n src/ipa/libipa/lsc_polynomial.h        | 104 +++++++\n src/ipa/libipa/matrix_interpolator.cpp | 103 -------\n src/ipa/libipa/matrix_interpolator.h   | 120 --------\n src/ipa/libipa/meson.build             |   6 +-\n src/ipa/rkisp1/algorithms/ccm.cpp      |  18 +-\n src/ipa/rkisp1/algorithms/ccm.h        |   6 +-\n src/ipa/rkisp1/algorithms/lsc.cpp      | 409 +++++++++++++++----------\n src/ipa/rkisp1/algorithms/lsc.h        |  13 +-\n src/ipa/rkisp1/ipa_context.h           |   2 +\n src/ipa/rkisp1/rkisp1.cpp              |   4 +-\n test/ipa/libipa/interpolator.cpp       |  55 ++++\n test/ipa/libipa/meson.build            |  15 +\n test/ipa/meson.build                   |   1 +\n 16 files changed, 815 insertions(+), 409 deletions(-)\n create mode 100644 src/ipa/libipa/interpolator.cpp\n create mode 100644 src/ipa/libipa/interpolator.h\n create mode 100644 src/ipa/libipa/lsc_polynomial.cpp\n create mode 100644 src/ipa/libipa/lsc_polynomial.h\n delete mode 100644 src/ipa/libipa/matrix_interpolator.cpp\n delete mode 100644 src/ipa/libipa/matrix_interpolator.h\n create mode 100644 test/ipa/libipa/interpolator.cpp\n create mode 100644 test/ipa/libipa/meson.build"}