From patchwork Fri Apr 24 10:46:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 3513 Return-Path: Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A8DCC603FC for ; Fri, 24 Apr 2020 12:47:12 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="gUW1dhSN"; dkim-atps=neutral Received: by mail-wm1-x341.google.com with SMTP id r26so10191640wmh.0 for ; Fri, 24 Apr 2020 03:47:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7AEGnA5S/d2+iT60qv7PR5d/7S8hOxh1bBRKMqWNlLs=; b=gUW1dhSNbCTQkNf3utkg6KnA2qcggRuMvpaetCZSdYTpRWYqiWc/OELsD3VnmYroUx KXAPe2A9JsafPS57Ct7+GCnI9iC/vBl5DJU0sA392NfxIpoxsGWk3JuK98Ee4/jvGUb0 BOFHzfFX286WVEkAfUj/kY/B8cmYy7sYEpvnbsFZSZnn0w0tvfx5T94f0kkPkOcgSspQ 31krKcr2IhR1t2MGu97ZHtWlym695w1uOgQVH/W5U/5cTuUgXB11KkbVRGsEbjV2XuE3 oR09pe+JDlnGTxRa7sUQ0I+1SV2GbMyXaZuSLc1gx3NeFYnOHmQBeJ8vKZaUConagJ5H XsXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7AEGnA5S/d2+iT60qv7PR5d/7S8hOxh1bBRKMqWNlLs=; b=F3b6tBGc3vy/md+lMaf1KZC4SNznosjDpLrYqNUbW/Pjcm24wJYdSDZd1CCn66SQ/V 8t/DsALYZGGYP6N7QaHHoOPTpoHZatyYksavjn+yUss6myjYy+lsc2MxcW2jrkpmkw21 7Nl3BD6Q8BNZpT8GWZViXPf/MPOVHfjX5tYlrPI9xzJA0mJgZwaEXYZ24tD1N5PRPsrp dLsp1UWLwr6kfsIavBpmK+mYOY9umZGJy2DtWzzCWz/lzBu0s8fm/ZNA7gAIGp3PIqCC Eh48n6f5XzERibOgOysQgOjLVHWeKhopbtQPq3k4JpNz/bhqzGce7jCpC/v55XtegKgt JdPQ== X-Gm-Message-State: AGi0Pubm/nXe7MjyHgQu1XFF94r9tNlNa3MTrOtnBgFshq79d17j19aO 2VSXZaR11W0lzg8uPexRtN6DplK1X8DHvg== X-Google-Smtp-Source: APiQypLpqUgtqiUtV1oyhEXNX7mVeg+bWxVuMNST9zt3QuLtN7HOdsEAv2X2d9zciHoTGSOxfuQXcw== X-Received: by 2002:a1c:68d7:: with SMTP id d206mr8876317wmc.29.1587725232128; Fri, 24 Apr 2020 03:47:12 -0700 (PDT) Received: from naushir-VirtualBox.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id j68sm7884997wrj.32.2020.04.24.03.47.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2020 03:47:11 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 24 Apr 2020 11:46:56 +0100 Message-Id: <20200424104700.26819-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200424104700.26819-1-naush@raspberrypi.com> References: <20200424104700.26819-1-naush@raspberrypi.com> Subject: [libcamera-devel] [PATCH v4 1/5] libcamera: control_ids: Add comment to specify control direction 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-List-Received-Date: Fri, 24 Apr 2020 10:47:12 -0000 Document that controls are bi-directional by default. If a control is only returned in metadata, this must be specified in the control's description. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- src/libcamera/control_ids.cpp.in | 3 +++ src/libcamera/control_ids.yaml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/libcamera/control_ids.cpp.in b/src/libcamera/control_ids.cpp.in index 99c511d0..cba6258d 100644 --- a/src/libcamera/control_ids.cpp.in +++ b/src/libcamera/control_ids.cpp.in @@ -33,6 +33,9 @@ ${controls_def} /** * \brief List of all supported libcamera controls + * + * Unless otherwise stated, all controls are bi-directional, i.e. they can be + * set through Request::controls() and returned out through Request::metadata(). */ extern const ControlIdMap controls { ${controls_map} diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index 4befec74..bcbab195 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -4,6 +4,8 @@ # %YAML 1.2 --- +# Unless otherwise stated, all controls are bi-directional, i.e. they can be +# set through Request::controls() and returned out through Request::metadata(). controls: - AeEnable: type: bool From patchwork Fri Apr 24 10:46:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 3514 Return-Path: Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7854062E4D for ; Fri, 24 Apr 2020 12:47:14 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="qos4tUx7"; dkim-atps=neutral Received: by mail-wm1-x344.google.com with SMTP id v4so9683130wme.1 for ; Fri, 24 Apr 2020 03:47:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gTRrnru+PEsPZVPxI0mivFWeXV0qYZx2apBaEDWKgbI=; b=qos4tUx7wSzuke2rPZSlwDe3iG2qdsEXTD2mRSvwFeMAK4RhYNBRYCdbs3SQTmRa5J Q1FUdL+joqiENOYT5dkL4L3KMlfFUm+hL9flRp2JF4lR4jj9FFlf3E8fPf6jxNmblqZs sKLztGViVndgYxrEtPslpOb+vZltFavf/ByU9h8WOuWjB0w12bCTjDsVTEN0QXNw0Nu2 uqhEC6gfxa+zPTbR+DMcPzS6cwqxjIW++k5KQw8g+Lg4YVUnmCzA0A/+wtA2CA6Fso/M bSw06JbgCkrpIoZzL4EDmxbpnqyjqxOZpSIqlBU37W2oy/0jz7zIcUsjIfQdmR7X99ya ZHvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gTRrnru+PEsPZVPxI0mivFWeXV0qYZx2apBaEDWKgbI=; b=aZsxxHDZzNTMSJS5cggM0u2XVoJm/rsJ4QFHsJqrNsQWqUPKs5oi8gD2g9xqQ6PO45 GxaFfDhh7CSUPbjX61YaKsEILYXY+Q2kujYh35TEGW0/qF15Te6ZXbeKm6hEGQvfV1K8 +az7Ab2FrlOlCrWw8+Y1FVvO0zAQXy1jzM7dorgCUIr6yYELqs48iCVs0yI0cbGQFNBR THgvq6YZCdrm/gMDS2FGFK/hqW+tGb5ufBdNU/9tNcphKsNU8sFcwQaYQm4g+8zCV8Bc AY4XRR371QmyQEVb1+PL9ZnBmVhxdQbWJ1fIr74VczIJfxFlJv3bOuOXAM6shCMPP2Wb /yjQ== X-Gm-Message-State: AGi0Pua1tYgUbLw8hcEDUDrwIdNZPLSzVs/CiR5BgttIM0zoFJlTCaL+ LyfolOWRknpi8WT81bTw/cjEm37F9rM1mw== X-Google-Smtp-Source: APiQypIiVH0IeCi/DR3TE+Y4QwL726AmNiT3cLXncfHsN+20cLKTIoneCd9pLqOyS3RbdMjuwx2X3Q== X-Received: by 2002:a1c:770f:: with SMTP id t15mr9250290wmi.178.1587725233726; Fri, 24 Apr 2020 03:47:13 -0700 (PDT) Received: from naushir-VirtualBox.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id j68sm7884997wrj.32.2020.04.24.03.47.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2020 03:47:13 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 24 Apr 2020 11:46:57 +0100 Message-Id: <20200424104700.26819-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200424104700.26819-1-naush@raspberrypi.com> References: <20200424104700.26819-1-naush@raspberrypi.com> Subject: [libcamera-devel] [PATCH v4 2/5] libcamera: controls: Updates to gain and exposure controls 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-List-Received-Date: Fri, 24 Apr 2020 10:47:14 -0000 Rename: ManualExposure -> ExposureTime ManualGain -> AnalogueGain Use micro-seconds units for ExposureTime. This is changed from milli- seconds. The latter would not allow very low exposure times. AnalogueGain switch to use a float to allow fractional gain adjustments. Update the uvcvideo pipeline handler to use the new exposure and gain units. For ExposureTime, UVC uses units of 100 micro-seconds, so map the values before setting V4L2_CID_EXPOSURE_ABSOLUTE. For AnalogueGain, UVC has no explicit gain units, so map the default gain value to 1.0 and linearly scale to the requested value. Signed-off-by: Naushir Patuck Signed-off-by: Laurent Pinchart --- src/libcamera/control_ids.yaml | 22 +++++++----- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 37 ++++++++++++++++---- 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index bcbab195..d8bdb382 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -12,7 +12,7 @@ controls: description: | Enable or disable the AE. - \sa ManualExposure + \sa ExposureTime AnalogueGain - AeLocked: type: bool @@ -30,8 +30,6 @@ controls: description: | Enable or disable the AWB. - \sa ManualGain - - Brightness: type: int32_t description: Specify a fixed brightness parameter @@ -44,12 +42,20 @@ controls: type: int32_t description: Specify a fixed saturation parameter - - ManualExposure: + - ExposureTime: type: int32_t - description: Specify a fixed exposure time in milli-seconds + description: | + Exposure time (shutter speed) for the frame applied in the sensor + device. This value is specified in micro-seconds. - - ManualGain: - type: int32_t - description: Specify a fixed gain parameter + \sa AnalogueGain AeEnable + + - AnalogueGain: + type: float + description: | + Analogue gain value applied in the sensor device. + The value of the control specifies the gain multiplier applied to all + colour channels. This value cannot be lower than 1.0. + \sa ExposureTime AeEnable ... diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp index ffbddf27..b518ad16 100644 --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -251,11 +252,24 @@ int PipelineHandlerUVC::processControls(UVCCameraData *data, Request *request) controls.set(V4L2_CID_CONTRAST, value); } else if (id == controls::Saturation) { controls.set(V4L2_CID_SATURATION, value); - } else if (id == controls::ManualExposure) { + } else if (id == controls::ExposureTime) { controls.set(V4L2_CID_EXPOSURE_AUTO, static_cast(1)); - controls.set(V4L2_CID_EXPOSURE_ABSOLUTE, value); - } else if (id == controls::ManualGain) { - controls.set(V4L2_CID_GAIN, value); + /* + * controls::ExposureTime is in units of 1 us, and UVC + * expects V4L2_CID_EXPOSURE_ABSOLUTE in units of 100 us. + */ + controls.set(V4L2_CID_EXPOSURE_ABSOLUTE, + value.get() / 100); + } else if (id == controls::AnalogueGain) { + /* + * controls::AnalogueGain is specified as an absolute + * multiplier for all RGB samples. Map this multiplier + * in a linear way such that 1.0 -> default gain + * of the V4L2_CID_GAIN control on the uvcvideo device. + */ + const ControlInfo &gainInfo = controls.infoMap()->at(V4L2_CID_GAIN); + int32_t gain = lroundf(value.get() * gainInfo.def().get()); + controls.set(V4L2_CID_GAIN, gain); } } @@ -350,7 +364,7 @@ int UVCCameraData::init(MediaEntity *entity) ControlInfoMap::Map ctrls; for (const auto &ctrl : controls) { - const ControlInfo &info = ctrl.second; + ControlInfo info = ctrl.second; const ControlId *id; switch (ctrl.first->id()) { @@ -364,10 +378,19 @@ int UVCCameraData::init(MediaEntity *entity) id = &controls::Saturation; break; case V4L2_CID_EXPOSURE_ABSOLUTE: - id = &controls::ManualExposure; + id = &controls::ExposureTime; break; case V4L2_CID_GAIN: - id = &controls::ManualGain; + id = &controls::AnalogueGain; + /* + * AnalogueGain is a float control, convert the type of + * the range. + */ + info = ControlInfo{ + { static_cast(info.min().get()) }, + { static_cast(info.max().get()) }, + { static_cast(info.def().get()) } + }; break; default: continue; From patchwork Fri Apr 24 10:46:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 3515 Return-Path: Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0726A62E4D for ; Fri, 24 Apr 2020 12:47:15 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="KawmfeBS"; dkim-atps=neutral Received: by mail-wm1-x344.google.com with SMTP id h2so9922570wmb.4 for ; Fri, 24 Apr 2020 03:47:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=T1pRuMpSBIYfzjOqeocQU2uGXm5/J6+ZUKEx+rcA7Go=; b=KawmfeBSrzCmMpjUS6jzgSEaswBH5yA/Z5zT1WdHzsYPTxxhx5iNPpGdAV+67LEueA htTnt3e2e31RZYPGzcqoZRFBL197VDnc4jTaW8D46lZnQ4nMj2hRGnsJu4wXFaxTdCkv cUkLjkcZ3avDYhKcjs4q6FZBkMtcNg2Yf/gorpTJOwoBa3zuqR/xGIc2cMOOFVnhAOEE vPmJ49oKwsR2CWlBNeTXOAdwRh1tClifgrTJpoQz9Fj4sImFjCkNcup/xGd3MNj2iD0E xcAZABvq+UbFnWBfPd0S0BY+3oFUFDd3yvIIX/EgR0dGbv2NERWWu8kNK5K7NeNj6hg4 iczw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=T1pRuMpSBIYfzjOqeocQU2uGXm5/J6+ZUKEx+rcA7Go=; b=pTbwZCipkXjrfTwB618IhQnYvZhD5rP2A1SBCm/Sq3SFRtKQplrpa/sJIFI4JDm5L/ fDCGGe5lc6J7putguMnXfzfuE7J7r2ECdzNTu9aQccNFtNLIi+I5EdcIIZ1Z0jBLAhHK aW1Wq/i8rrA4v2wDKZMCut9T1NVel/pV3waNRb5MoW7GKWpHGVmLaY2R21KgnS+vRqRn olzbcDmbsoAqQNNR+n38tCKZjsvPl66VDMVY92pzcXd3kr/eLPEFQsaE877KMmDnhP/8 K2ZRCf9ddexlLprGZnwlVX5GH1aKj0oADAzZzQd+P3ob7O1LkJDZObf3BxrUhp8j5DzV MZtg== X-Gm-Message-State: AGi0PuaVVdE1dylJ+BFqq4AXB9LqpOQpugNPCY9n7dhVPr7OIvNE9r0R xFVlvUwLR5v5FSC2Q9haFdcUy73UTAwMdA== X-Google-Smtp-Source: APiQypI84gD54UfPxLC//1KKQMXye0vOpQi5waFhVt56x1v/4BLALKHSjEjkPdF1Q3pbo3UUm5GLPQ== X-Received: by 2002:a1c:148:: with SMTP id 69mr9743669wmb.181.1587725234560; Fri, 24 Apr 2020 03:47:14 -0700 (PDT) Received: from naushir-VirtualBox.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id j68sm7884997wrj.32.2020.04.24.03.47.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2020 03:47:14 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 24 Apr 2020 11:46:58 +0100 Message-Id: <20200424104700.26819-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200424104700.26819-1-naush@raspberrypi.com> References: <20200424104700.26819-1-naush@raspberrypi.com> Subject: [libcamera-devel] [PATCH v4 3/5] libcamera: controls: Reorder and update description of existing controls 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-List-Received-Date: Fri, 24 Apr 2020 10:47:15 -0000 Group AE, AWB, etc. controls together for accessibility. Update descriptions for Contrast, Brightness, and Saturation controls. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- src/libcamera/control_ids.yaml | 41 ++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index d8bdb382..f7403081 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -25,23 +25,6 @@ controls: \sa AeEnable - - AwbEnable: - type: bool - description: | - Enable or disable the AWB. - - - Brightness: - type: int32_t - description: Specify a fixed brightness parameter - - - Contrast: - type: int32_t - description: Specify a fixed contrast parameter - - - Saturation: - type: int32_t - description: Specify a fixed saturation parameter - - ExposureTime: type: int32_t description: | @@ -58,4 +41,28 @@ controls: colour channels. This value cannot be lower than 1.0. \sa ExposureTime AeEnable + + - Brightness: + type: float + description: | + Specify a fixed brightness parameter. Positive values (up to 65535.0) + produce brighter images; negative values (up to -65536.0) produce darker + images and 0.0 leaves pixels unchanged. + + - Contrast: + type: float + description: | + Specify a fixed contrast parameter. Normal contrast is given by the + value 1.0; larger values produce images with more contrast. + + - AwbEnable: + type: bool + description: | + Enable or disable the AWB. + + - Saturation: + type: float + description: | + Specify a fixed saturation parameter. Normal saturation is given by + the value 1.0; larger values produce more saturated colours. ... From patchwork Fri Apr 24 10:46:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 3516 Return-Path: Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1327662E4D for ; Fri, 24 Apr 2020 12:47:16 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="LmaJOJc4"; dkim-atps=neutral Received: by mail-wm1-x342.google.com with SMTP id h2so9922625wmb.4 for ; Fri, 24 Apr 2020 03:47:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+zSZHtzXchYfw0fqgz7s1r72uZCsipbTAkT1AW69Vaw=; b=LmaJOJc4ao00m2oe2txYpdTiXa4bqiX+Otv6X4SLBLJ8j05mIyfGX19WGjLcuVIZQT nupHrvmwJ+PsnpVNiwqXRK66ZoYj4DYkOMCfrkE1klFr3nIlWjHZYgVK8uimf7P04l8o GDraNfD33YozEkM6PC6l0+C4m9whjgU6BS3x2NgL2iWD1uwLt4XHlaSef55gP0qG+rW4 b75KKdoiNuyHeotqBBUiC0Ef1atvg2Q3N8wZkBfBKoFov+mg/Gzolsd/C5PMghR1IqW0 9aOC0ffBia6QYi8FtcCJGZ0tgHS2Fcvj1tkBct8hI1ge38N8VeLc/mzais4ThroIZKvZ ZANw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+zSZHtzXchYfw0fqgz7s1r72uZCsipbTAkT1AW69Vaw=; b=Ai8cwyWXRtuBt7GZTaPwm909O+FpT2j0h9nNPgMisn92dJz5iuD0sZdYgPBPSFL2BG sg8u+pP7Imor/2EAnhfbmUJ98A8j+Lk+97Dfb3/dsi1Xgd0raU6jO/gMLNY8I1xTjCQv xyB9yTWNETYG85Qku2c54QT7m9uGew1VInYgeyMrnw+rNC9et3CvzczRQPL7JCiUhNfe FUR/kh5ng4B6Pcl0O1HCPDYgh7eTiq37rAvcGAlbYSmqVkHN+TDgFZVtn9mSlir7h7rv a1SbvPkdo5gtTjUtwFammC1EBwjQMHTIOpJaUBRmxRaWrallnQOTfWWNRACtsZzDWMlw gz+Q== X-Gm-Message-State: AGi0PuaGTc4gNRthY2fOfBBCdhFr8/lOSne5qpjmbgxUufj1PhyP/Kac ND2up7mCehDj5V7qkJLR1EkQJpXO/sPlNw== X-Google-Smtp-Source: APiQypLV7lLpQhjq7LPnGgGxYpAdpbryxOo1mCg6SXYGslQ7SbjPlGEUCvfQw5iX3wIkeABNW+aLDQ== X-Received: by 2002:a05:600c:214b:: with SMTP id v11mr9967224wml.151.1587725235368; Fri, 24 Apr 2020 03:47:15 -0700 (PDT) Received: from naushir-VirtualBox.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id j68sm7884997wrj.32.2020.04.24.03.47.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2020 03:47:14 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 24 Apr 2020 11:46:59 +0100 Message-Id: <20200424104700.26819-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200424104700.26819-1-naush@raspberrypi.com> References: <20200424104700.26819-1-naush@raspberrypi.com> Subject: [libcamera-devel] [PATCH v4 4/5] libcamera: controls: Add AE related controls 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-List-Received-Date: Fri, 24 Apr 2020 10:47:16 -0000 AeMeteringMode, AeConstraintMode, and AeExposureMode are new enum type controls used to specify operating modes in the AE algorithm. All modes may not be supported by all platforms. ExposureValue is a new control used to set the log2 exposure adjustment for the AE algorithm. Lux is a new control that returns the current lux estimate. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- src/libcamera/control_ids.yaml | 109 +++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index f7403081..f66b851b 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -25,6 +25,109 @@ controls: \sa AeEnable + # AeMeteringMode needs further attention: + # - Auto-generate max enum value. + # - Better handling of custom types. + - AeMeteringMode: + type: int32_t + description: | + Specify a metering mode for the AE algorithm to use. The metering + modes determine which parts of the image are used to determine the + scene brightness. Metering modes may be platform specific and not + all metering modes may be supported. + enum: + - name: MeteringCentreWeighted + value: 0 + description: Centre-weighted metering mode. + - name: MeteringSpot + value: 1 + description: Spot metering mode. + - name: MeteringMatrix + value: 2 + description: Matrix metering mode. + - name: MeteringCustom + value: 3 + description: Custom metering mode. + - name: MeteringModeMax + value: 3 + description: Maximum allowed value (place any new values above here). + + # AeConstraintMode needs further attention: + # - Auto-generate max enum value. + # - Better handling of custom types. + - AeConstraintMode: + type: int32_t + description: | + Specify a constraint mode for the AE algorithm to use. These determine + how the measured scene brightness is adjusted to reach the desired + target exposure. Constraint modes may be platform specific, and not + all constraint modes may be supported. + enum: + - name: ConstraintNormal + value: 0 + description: Default constraint mode. + This mode aims to balance the exposure of different parts of the + image so as to reach a reasonable average level. However, highlights + in the image may appear over-exposed and lowlights may appear + under-exposed. + - name: ConstraintHighlight + value: 1 + description: Highlight constraint mode. + This mode adjusts the exposure levels in order to try and avoid + over-exposing the brightest parts (highlights) of an image. + Other non-highlight parts of the image may appear under-exposed. + - name: ConstraintShadows + value: 2 + description: Shadows constraint mode. + This mode adjusts the exposure levels in order to try and avoid + under-exposing the dark parts (shadows) of an image. Other normally + exposed parts of the image may appear over-exposed. + - name: ConstraintCustom + value: 3 + description: Custom constraint mode. + - name: ConstraintModeMax + value: 3 + description: Maximum allowed value (place any new values above here). + + # AeExposureMode needs further attention: + # - Auto-generate max enum value. + # - Better handling of custom types. + - AeExposureMode: + type: int32_t + description: | + Specify an exposure mode for the AE algorithm to use. These specify + how the desired total exposure is divided between the shutter time + and the sensor's analogue gain. The exposure modes are platform + specific, and not all exposure modes may be supported. + enum: + - name: ExposureNormal + value: 0 + description: Default exposure mode. + - name: ExposureShort + value: 1 + description: Exposure mode allowing only short exposure times. + - name: ExposureLong + value: 2 + description: Exposure mode allowing long exposure times. + - name: ExposureCustom + value: 3 + description: Custom exposure mode. + - name: ExposureModeMax + value: 3 + description: Maximum allowed value (place any new values above here). + + - ExposureValue: + type: float + description: | + Specify an Exposure Value (EV) parameter. The EV parameter will only be + applied if the AE algorithm is currently enabled. + + By convention EV adjusts the exposure as log2. For example + EV = [-2, -1, 0.5, 0, 0.5, 1, 2] results in an exposure adjustment + of [1/4x, 1/2x, 1/sqrt(2)x, 1x, sqrt(2)x, 2x, 4x]. + + \sa AeEnable + - ExposureTime: type: int32_t description: | @@ -55,6 +158,12 @@ controls: Specify a fixed contrast parameter. Normal contrast is given by the value 1.0; larger values produce images with more contrast. + - Lux: + type: float + description: | + Report an estimate of the current illuminance level in lux. The Lux + control can only be returned in metadata. + - AwbEnable: type: bool description: | From patchwork Fri Apr 24 10:47:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 3517 Return-Path: Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AFABA62E67 for ; Fri, 24 Apr 2020 12:47:16 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="o3LDMs+r"; dkim-atps=neutral Received: by mail-wm1-x343.google.com with SMTP id k12so1353996wmj.3 for ; Fri, 24 Apr 2020 03:47:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Rv0SdWrJ8b0yq+PQqecM3X8wUhY/bKbD8mhMLxv9GV0=; b=o3LDMs+rQwaHGBZ4Us38sytMkf7s8EHH5RhtsEMohWXJ4wHy+1gRMLQ3MNLkp6rBuS Tod1DLT0o70CxKdqWsVgWMsm5QZ53N5/kYMr3WTFqRY1+6NXg1voQyumkRsdMYinyiqR UJ3DKUxUly1/3makWPOLWQqRTIMZEUhhmhKfb2Dt7HB2ajOMT8GjmEEf6rUB5KfnOjV8 Wa8hBWJpo/PPutbqlMaYMxPBEWUwsBuspys0n3RKAwr+cZPv6fYCAIwZ3Gl07blNByiZ dhSAStjr4/eJDmbl5aLlTzgxiVA7/Bq2eUJU7CNCIc7bhDNB1D7gXbWeyh9Lql/NAoOt P9Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Rv0SdWrJ8b0yq+PQqecM3X8wUhY/bKbD8mhMLxv9GV0=; b=WZwW1rKxmEO+lZzKy3Od9GI51xhjYCrUHjjD0hJsoFxja0xjB5p+03bChRAEGPIC1n LT4GcpX2biLmyZczvUdFOobxDyvoxFxJ+OyDqicIcgPUefvskQHh7xaNJ7F/Ev2NtQgu 86r6vVxRvGBntv3EKjIRwcdltB8UNROUnx7HFPmSFZNkCEEccfZyGrsUINhZ7rMklklc 20lujocP3uZbie8a9jFHGDJjjuyDl76g5xpTQsk9NR2k8+kc94ZgM6PV3iCTv+fsnDzM FTsGTFL1h4TAP8d1at6HCnKU3sCwR0DWCSJNdE8YppFFxM0zvyJUa4nMlPqKc0V5qoPz IHWw== X-Gm-Message-State: AGi0PubOn5+3ISgdkTlZR4vDkgzLTyOxYVt3ERvN16Nvn0HFcays124U WqXr1wLccj1sxwvQCiznu7GYwC3ESK5JxQ== X-Google-Smtp-Source: APiQypLT5AXrWwS9czPLLdjE3NcT+BHkKCee4/HmxMdz0NZ8J5mI446g2nYl0rnLNAKUaLgpKHVV6g== X-Received: by 2002:a7b:c14b:: with SMTP id z11mr9169431wmi.44.1587725236082; Fri, 24 Apr 2020 03:47:16 -0700 (PDT) Received: from naushir-VirtualBox.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id j68sm7884997wrj.32.2020.04.24.03.47.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2020 03:47:15 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 24 Apr 2020 11:47:00 +0100 Message-Id: <20200424104700.26819-6-naush@raspberrypi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200424104700.26819-1-naush@raspberrypi.com> References: <20200424104700.26819-1-naush@raspberrypi.com> Subject: [libcamera-devel] [PATCH v4 5/5] libcamera: controls: Add AWB related controls 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-List-Received-Date: Fri, 24 Apr 2020 10:47:17 -0000 AwbMode is a new enum type to specify operating mode of the AWB algorithm. All modes may not be supported by all platforms. ColourGains is a new float array type used to specify manual red and blue (in that order) colour channel gains when AWB is disabled. ColourTemperature is a new control to return the current estimate of the colour temperature. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- src/libcamera/control_ids.yaml | 55 ++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index f66b851b..d922b039 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -169,6 +169,61 @@ controls: description: | Enable or disable the AWB. + \sa ColourGains + + # AwbMode needs further attention: + # - Auto-generate max enum value. + # - Better handling of custom types. + - AwbMode: + type: int32_t + description: | + Specify the range of illuminants to use for the AWB algorithm. The modes + supported are platform specific, and not all modes may be supported. + enum: + - name: AwbAuto + value: 0 + description: Search over the whole colour temperature range. + - name: AwbIncandescent + value: 1 + description: Incandescent AWB lamp mode. + - name: AwbTungsten + value: 2 + description: Tungsten AWB lamp mode. + - name: AwbFluorescent + value: 3 + description: Fluorescent AWB lamp mode. + - name: AwbIndoor + value: 4 + description: Indoor AWB lighting mode. + - name: AwbDaylight + value: 5 + description: Daylight AWB lighting mode. + - name: AwbCloudy + value: 6 + description: Cloudy AWB lighting mode. + - name: AwbCustom + value: 7 + description: Custom AWB mode. + - name: AwbModeMax + value: 7 + description: Maximum allowed value (place any new values above here). + + - ColourGains: + type: float + description: | + Pair of gain values for the Red and Blue colour channels, in that + order. ColourGains can only be applied in a Request when the AWB is + disabled. + + \sa AwbEnable + size: [2] + + - ColourTemperature: + type: float + description: Report the current estimate of the colour temperature, in + kelvin, for this frame. The ColourTemperature control can only be + returned in metadata. + - Saturation: type: float description: |