From patchwork Tue Dec 21 05:28:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 15202 X-Patchwork-Delegate: paul.elder@ideasonboard.com 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 45038BF415 for ; Tue, 21 Dec 2021 05:29:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C281560901; Tue, 21 Dec 2021 06:29:25 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ng/wtbdA"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 50264608EB for ; Tue, 21 Dec 2021 06:29:23 +0100 (CET) Received: from pyrite.mediacom.info (unknown [IPv6:2604:2d80:ad90:fb00:96fd:8874:873:6c16]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 80C86FD2; Tue, 21 Dec 2021 06:29:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1640064563; bh=Zbiq4ZOAfkHLJLT50wvxRQYwCxAopTgdwtH7lgMD+tc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ng/wtbdAz4TMEoo/tixJCs4Dt3eYXNhunNdwRYbNF6XHf8qVn5/e1nL7zJ8PUviVR 0zR9dHOz8iIXB5byXZEDjG4i/i4VJ1K2pZm6R6NAJNruGDcrrHB5KC5MCeTnmOU7cD etIiAYnwe6xNpCr/ORRANTuErdKwV1o7Y6ZE39dw= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 20 Dec 2021 23:28:53 -0600 Message-Id: <20211221052854.2690659-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211221052854.2690659-1-paul.elder@ideasonboard.com> References: <20211221052854.2690659-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] controls: Add controls for tonemapping 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" Add controls related to tonemapping: - TonemapMode: set and report the source of the tonemap curve - TonemapGamma: the gamma value for tonemap curve gamma mode - TonemapPresetCurve: the preset tonemap curve for tonemap curve preset mode - TonemapCurve: the tonemap curve for custom (contrast) curve mode, also used to report the TonemapCurve that was used, regardless of the mode - TonemapCurveSize: the number of data points of TonemapCurve These are based on android's tonemapping controls. Signed-off-by: Paul Elder --- src/libcamera/control_ids.yaml | 100 +++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index 3236da1d..411200a8 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -697,6 +697,106 @@ controls: For a monochrome camera, all four color channels must have the same values. + - TonemapMode: + type: int32_t + description: | + High-level global contrast/gamma/tonemapping control. This control, + TonemapCurve, and TonemapCurveSize are the minimum required controls + for tonemapping support. + enum: + - name: TonemapModeContrastCurve + value: 0 + description: | + Use the tonemapping curve specified in TonemapCurve. + All color enhancement and tonemapping must be disabled, except + for applying the tonemapping curve specified by TonemapCurve. + - name: TonemapModeFast + value: 1 + description: | + Advanced gamma mapping and color enhancement may be applied, + without reducing frame rate compared to raw sensor output. The + camera will use its own tonemap curve, and report it in TonemapCurve. + - name: TonemapModeHighQuality + value: 2 + description: | + High-quality gamma mapping and color enhancement will be + applied, at the cost of possibly reduced frame rate compared to + raw sensor output. The camera will use its own tonemap curve, and + report it in TonemapCurve. + - name: TonemapModeGammaValue + value: 3 + description: | + Use the gamma value specified in TonemapGamma to perform + tonemapping. All color enhancement and tonemapping shall be + disabled, except for applying the tonemapping curve specified + by TonemapGamma. + + If this mode is supported, then the TonemapGamma control must be + supported as well. + - name: TonemapModePresetCurve + value: 4 + description: | + Use the present tonemapping curve specified in + TonemapPresetCurve to perform tonemapping. All color + enhancement and tonemapping must be disabled, except for + applying the tonemapping curve specified by TonemapPresetCurve. + + If this mode is supported, then the TonemapPresetCurve control must + be supported as well. + + - TonemapGamma: + type: float + description: | + Tonemapping curve to use when TonemapMode is TonemapModeGammaValue. + The tonemap curve will be defined by the following formula, OUT = + pow(IN, 1.0 / gamma) where IN and OUT is the input pixel value + scaled to range [0.0, 1.0], pow is the power function and gamma is + the gamma value specified by this key. The same curve will be + applied to all color channels. The camera device may clip the input + gamma value to its supported range. The actual applied value will + be returned in result metadata. The valid range of gamma values + varies on different devices, but values within [1.0, 5.0] are + guaranteed not to be clipped. + + - TonemapPresetCurve: + type: int32_t + description: | + Tonemapping curve to use when TonemapMode is TonemapModePresetCurve. + enum: + - name: TonemapPresetCurveSRGB + value: 0 + description: Tonemapping curve is defined by sRGB + - name: TonemapPresetCurveREC709 + value: 1 + description: Tonemapping curve is defined by ITU-R BT.709 + + - TonemapCurve: + type: float + description: | + Three arrays of [ [in, out], [in, out], ... ] format to describe a + tonemapping curve to be applied when TonemapMode is set to + TonemapModeContrastCurve. The first array is the tonemapping curve for + red, second for green, and third for blue. When returned in metadata, + this control will hold the tonemap curve used by the camera. Since the + actual pixel ranges of both input and output may change depending on + the camera, the values are specified by normalized floating point + numbers, in the range [0.0, 1.0]. + + The number of pairs N, representing the number of data points on the + tonemapping curve, shall be specified in TonemapCurveSize. + + This control, TonemapCurveSize, and TonemapMode are the minimum required + controls for tonemapping support. + size: [3xNx2] + + - TonemapCurveSize: + type: int32_t + description: | + The number of data points on the tonemapping curve specified or + reported in TonemapCurve. This control, TonemapCurve, and TonemapMode + are the minimum required controls for tonemapping support. + + # ---------------------------------------------------------------------------- # Draft controls section