{"id":21295,"url":"https://patchwork.libcamera.org/api/1.1/covers/21295/?format=json","web_url":"https://patchwork.libcamera.org/cover/21295/","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":"<20240920133941.90629-1-stefan.klug@ideasonboard.com>","date":"2024-09-20T13:39:15","name":"[v3,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/21295/mbox/","series":[{"id":4609,"url":"https://patchwork.libcamera.org/api/1.1/series/4609/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4609","date":"2024-09-20T13:39:15","name":"Implement polynomial lsc support","version":3,"mbox":"https://patchwork.libcamera.org/series/4609/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/21295/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 A48A8C3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 20 Sep 2024 13:39:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 666A2634FC;\n\tFri, 20 Sep 2024 15:39:48 +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 C09B4618E0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Sep 2024 15:39:46 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:8ade:938d:48b1:cede])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A0F284CE;\n\tFri, 20 Sep 2024 15:38:22 +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=\"Trc5zEBN\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1726839502;\n\tbh=JxExKhPDm5OJBe4Uxebh7hxFn9nUhdx+gvwRjt+Lvic=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=Trc5zEBNYqYX/fZzXpvBiQhgzu63Fh+8okD+2DK8+M+a7O5fgCGwiXUvoplBDvZ5Y\n\tgFETHnNJxyj+IrddAxEMR/IvKsvI/GPXo0VxfrzKr9jp3vAY9+/UYc4R+oscurw4/Z\n\tuAuyk+Yl7o9JgQMk/vsM1TXWP2iTqDmKUmPNX4c8=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH v3 0/9] Implement polynomial lsc support","Date":"Fri, 20 Sep 2024 15:39:15 +0200","Message-ID":"<20240920133941.90629-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 v3:\n- Some smaller fixes from review\n- Cleaned the loader decision logic.\n- The series now depends on the yaml parser fix \n  https://patchwork.libcamera.org/project/libcamera/list/?series=4608\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        | 157 +++++++++\n src/ipa/libipa/interpolator.h          | 131 ++++++++\n src/ipa/libipa/lsc_polynomial.cpp      |  81 +++++\n src/ipa/libipa/lsc_polynomial.h        | 105 +++++++\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      | 419 +++++++++++++++----------\n src/ipa/rkisp1/algorithms/lsc.h        |  13 +-\n src/ipa/rkisp1/ipa_context.cpp         |   3 +\n src/ipa/rkisp1/ipa_context.h           |   2 +\n src/ipa/rkisp1/rkisp1.cpp              |   4 +-\n test/ipa/libipa/interpolator.cpp       |  54 ++++\n test/ipa/libipa/meson.build            |  15 +\n test/ipa/meson.build                   |   1 +\n 17 files changed, 829 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"}