From patchwork Thu May 30 21:09:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Zamazal X-Patchwork-Id: 20152 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 A0272BD87C for ; Thu, 30 May 2024 21:10:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A3022634B6; Thu, 30 May 2024 23:10:15 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="Cw342hwU"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 10B2161A43 for ; Thu, 30 May 2024 23:10:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717103412; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X1DqXNQ+SXxch16Wp8HH6LqqtdST21f5NhY6jY+w+RI=; b=Cw342hwU7hlpGOix8Zfo/eaAFuIYEhVNzq1iktOPo7vO3MB+hdeGK8oBt2mplN+TeqU32B zg2auq6HYXLmMVTEsVuBs7DQUc2GuO++N17rqoU1AIgFWdsmTSzrZjzwdTTE4Twaucb9Th 33demC6XQLHV6jV9cRKq/Bdf4CKhsjw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-227-dy86kcGCPx6TB9dIWUzpTA-1; Thu, 30 May 2024 17:10:09 -0400 X-MC-Unique: dy86kcGCPx6TB9dIWUzpTA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C400E81227E; Thu, 30 May 2024 21:10:08 +0000 (UTC) Received: from nuthatch.redhat.com (unknown [10.45.224.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7924640C6EB7; Thu, 30 May 2024 21:10:07 +0000 (UTC) From: Milan Zamazal To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Kieran Bingham , Andrei Konovalov , Laurent Pinchart Subject: [PATCH v5 0/5] Software ISP levels cleanup Date: Thu, 30 May 2024 23:09:52 +0200 Message-ID: <20240530210957.2211897-1-mzamazal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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" This is a cleanup of black level and color gain handling in software ISP. It fixes omission of black level subtraction in white balance computation and moves color lookup tables computations out of debayering. The latter also serves as a preparation for bringing software ISP algorithms closer to common libcamera algorithm handling, in future patches. Changes in v5: - Improvements to comments in IPASoftSimple::processStats. - Avoiding the use of a lambda function there (code simplification). - Dropped DebayerParams::kGamma. - Including cmath rather than math.h. - Dropped the conversion of color lookup tables in favor of only dropping TODO #4. - Fixed type of the array in SoftwareIsp::debayerParams_ initialization (it mistakenly corresponded to the type changed in the dropped patch). Changes in v4: - Removed no longer used private members of DebayerCpu. - Added initialization of SoftwareIsp::debayerParams_ (should fix the initial color artifacts observed by Kieran). Changes in v3: - Casting an uint8_t value to unsigned int when logging it. Changes in v2: - stdint.h include moved from black_level.cpp to black_level.h. - Removed meaningless multiplication in black level subtraction. - Removed local variable scoping block. - Added a comment about subtracting black level for auto white balance. - A code snippet related to black level subtraction moved to the right patch. - Dropped the patch moving TODO #13 to a source code comment. - Added a patch to use float rather than uint8_t gains in color lookup tables passed to debayering. Milan Zamazal (5): libcamera: software_isp: Use a specific integer type for black level libcamera: software_isp: Honor black level in AWB libcamera: software_isp: Move color mappings out of debayering libcamera: software_isp: Remove DebayerParams::kGain10 libcamera: software_isp: Remove TODO about internal representation .../internal/software_isp/debayer_params.h | 19 +++-- src/ipa/simple/black_level.cpp | 2 +- src/ipa/simple/black_level.h | 5 +- src/ipa/simple/soft_simple.cpp | 75 ++++++++++++++----- src/libcamera/software_isp/TODO | 13 ---- src/libcamera/software_isp/debayer.cpp | 28 +++---- src/libcamera/software_isp/debayer_cpu.cpp | 43 ++--------- src/libcamera/software_isp/debayer_cpu.h | 11 +-- src/libcamera/software_isp/software_isp.cpp | 16 +++- 9 files changed, 105 insertions(+), 107 deletions(-)