From patchwork Fri Apr 3 14:53:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 3371 Return-Path: Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 30B9D600FA for ; Fri, 3 Apr 2020 16:53:29 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="XPybDtKL"; dkim-atps=neutral Received: by mail-wr1-x42c.google.com with SMTP id c7so8851756wrx.5 for ; Fri, 03 Apr 2020 07:53:29 -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=qm2VzOK8kBM1KF0dCYHY80QGq25ZUHsY21ENsg6U3bs=; b=XPybDtKL5XmuwS+p0paiak0gnNm3zcIMIg6xf+p483momuoqNalQx2p1kjwi9UcKao Qb8gWr1UKT9bA+oNm/yta0brPf0uWIiVBkdGdrzI5CsyaNANAzJCBRow2tZJ44tn/S4F 7F+dYN0VM0L9pxmDO/EfdmQN17dEHQ2Lfo1n5KtRl7idMgsp/fbEbYBZ3RNU49dZX1eQ t02xu3gLsdfHdO7iS7dbrPvNJYN+hJImp5xeE5IyLdQJXHjtkjboKjUWYwSmjjPyE54/ 6Zuq8C6w6dnWWcEGWpY5xT/cl99D7Kv39bAJjchrk54wcwkaUiX9l8jaUHLBUcGbDmp5 Afog== 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=qm2VzOK8kBM1KF0dCYHY80QGq25ZUHsY21ENsg6U3bs=; b=QlRL79bf306Y4gM/cBNUp0H4g1h6v90ojro9cQvn9atYjMSit8eP4ltvWqizX8d6Af DSBw7dbISc6DuaHhyxp1jRDVn9DXuWMNNkfcF6whvj+azEkOYnSbPbw3PuiuQKKFnLJe FP4RCIyaR8B+d5w1xvyZcD2otHfmt4t2gcfVfNW6hifrc9QUX6sYiNb9+GXZ9K4kF5mj cndNRyLRNHuv8dCW8SEnko5bBFSN/Dp/zDB+32Cy4vte+vYkSlbUs5Kukvf14iFR6RAm GFlWWN91odK2o7AZqRqPSgumT7SWH1UIraPBI3h0yPv/KJO64TGPXYP86lep6Jc0kIKW XOgw== X-Gm-Message-State: AGi0Pua/Y0VQX8qcHiGoq8gfzq1EwAkaa1rX9LGKKAQBYRjkKI70V/3v rgiYoEgXSe3XvCtPmiVaeoUPctdOSQbPwA== X-Google-Smtp-Source: APiQypL8s/a1lgZIZGlrLxLmCOiuu3bfpGnMM9vnRnSNOABoDeReZLkdfvHd0ZAS2jIb2dgE+rRPSA== X-Received: by 2002:adf:e50c:: with SMTP id j12mr9655954wrm.154.1585925608750; Fri, 03 Apr 2020 07:53:28 -0700 (PDT) Received: from naushir-VirtualBox.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id u5sm13559469wrp.81.2020.04.03.07.53.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 07:53:28 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Apr 2020 15:53:01 +0100 Message-Id: <20200403145305.10288-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200403145305.10288-1-naush@raspberrypi.com> References: <20200403145305.10288-1-naush@raspberrypi.com> Subject: [libcamera-devel] [PATCH v3 1/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, 03 Apr 2020 14:53:29 -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. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- src/libcamera/control_ids.yaml | 20 ++++++++++++++------ src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 8 ++++---- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index 4befec74..839eea76 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -10,7 +10,7 @@ controls: description: | Enable or disable the AE. - \sa ManualExposure + \sa ExposureTime AnalogueGain - AeLocked: type: bool @@ -42,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..d7df95e4 100644 --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp @@ -251,10 +251,10 @@ 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) { + } else if (id == controls::AnalogueGain) { controls.set(V4L2_CID_GAIN, value); } } @@ -364,10 +364,10 @@ 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; break; default: continue; From patchwork Fri Apr 3 14:53:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 3372 Return-Path: Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0000760104 for ; Fri, 3 Apr 2020 16:53:29 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="jPF57lsi"; dkim-atps=neutral Received: by mail-wr1-x443.google.com with SMTP id t7so8829487wrw.12 for ; Fri, 03 Apr 2020 07:53:29 -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=fVXwuWn8rco3gELfJEAjuRoUPX3Va//Kq1kEXfngX2M=; b=jPF57lsiAeKM8eQWgtbq1kUqkC/xeIyYHlXenfOxpp+QAxBTFxghqXKEKN0haoYrdt 8yTrCN/p+0Gn4HfywgBdpT9q8zNxl+5ohpN1Jb7iMOd+htK0ZCLhytWfD64QBvCHYCaZ 5zDkDBZSmstv2oXQK7mGmJRDR9aVjIiDV0GVISya6cSSbleOjQh96fTcUigObc2U7Axv nipFnw3IxA/6FKRCdsl6R4vWlpGhzK58Py4bfI9rMy9yQU9mUMbfr4dqR+9tvEbSxQlt RgZUs9Q+dLW98RUGgRFpGDcJGxiwIl6zRvMeUs6IVpKienlfUKTJfTq+zj0emwf5w3vA 5b3Q== 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=fVXwuWn8rco3gELfJEAjuRoUPX3Va//Kq1kEXfngX2M=; b=fDtuXpDwKnpTnyG9foI06yfdUECZXLWzeJ+KWqc1e5OHHEuv9zRvuSQeoT8S8yyRG3 prqBnafLFeatw4OxHWU1lVscqtz8iNg8t2L+ojgmVz1XZajnMbjKIYXTOaVPm+WXDMLb t5NsALjlokWAQ4loCG8omQE/jJ92F6maJ9/3Fyic+IxrHHgmlOcW3Map0/BnuomGkJbh zqONu8TLYoPTYEFeWXd0iglLsDWjbXoAv0GrdEw2gCpj/shxJ/luYngS8rvU4XOk8sp7 LABFLh+o7gFRL4yRndII594G3jBf+bc/HLeg4ZdG+lZt1kIKj6WBkjxuvous9exF2aQ7 YKhQ== X-Gm-Message-State: AGi0PubWwKI31DqZITi+eWNXRA/E437fJRQwlQD0QXzjclAki3U7jzUt G+ULmc7HMfN6BrnOCJp45oLnBTEFwsNlPg== X-Google-Smtp-Source: APiQypLkh9yXfP/V76KqOl02uds6pJJY9YdsvZ4ZcfO619lMqEn05LWpgye5ZrBN2wGEI9xd90FP7w== X-Received: by 2002:a5d:4ac8:: with SMTP id y8mr8946516wrs.233.1585925609530; Fri, 03 Apr 2020 07:53:29 -0700 (PDT) Received: from naushir-VirtualBox.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id u5sm13559469wrp.81.2020.04.03.07.53.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 07:53:28 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Apr 2020 15:53:02 +0100 Message-Id: <20200403145305.10288-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200403145305.10288-1-naush@raspberrypi.com> References: <20200403145305.10288-1-naush@raspberrypi.com> Subject: [libcamera-devel] [PATCH v3 2/5] libcamera: uvcvideo: Update exposure/gain ctrls set with new units 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, 03 Apr 2020 14:53:30 -0000 The ExposureTime control now uses units of 1 micro-second, and UVC uses units of 100 micro-seconds. Correctly map the values before setting V4L2_CID_EXPOSURE_ABSOLUTE on the V4L2 device. The AnalogueGain control now uses floats to allow fractional gain values. Since UVC has no explicit gain units, map the default gain value to 1.0 and linearly map to the requested value. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp index d7df95e4..9d589f69 100644 --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp @@ -253,9 +253,22 @@ int PipelineHandlerUVC::processControls(UVCCameraData *data, Request *request) controls.set(V4L2_CID_SATURATION, value); } else if (id == controls::ExposureTime) { controls.set(V4L2_CID_EXPOSURE_AUTO, static_cast(1)); - controls.set(V4L2_CID_EXPOSURE_ABSOLUTE, 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.set(V4L2_CID_GAIN, value); + /* + * 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 = value.get() * gainInfo.def().get(); + controls.set(V4L2_CID_GAIN, gain); } } From patchwork Fri Apr 3 14:53:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 3373 Return-Path: Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BA0CA629C1 for ; Fri, 3 Apr 2020 16:53:30 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="ss2zo60c"; dkim-atps=neutral Received: by mail-wr1-x442.google.com with SMTP id 31so8869209wrs.3 for ; Fri, 03 Apr 2020 07:53:30 -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=RtEZvi9ceNL8KobZqDTHZ/xMxtvepHlaSzXqdiU5oQc=; b=ss2zo60cA9tEyDBhBkf9PgFXfOrBVkHZYQbMn0uhTze5GegX9gEmm341y6EX7s/2qV iaPVOsKEaSqcT0M41KZrvZw17XNoHpgUVZubsN5zLFj4CaqQq6eeDTZKGIpOLuUBFzg0 cV6V4K4mo1/sdfYGjY2z9lnMCLM9aIxvf2xkwtjLUUCfjEQVJXsOKhuKBAECfymJtUm0 sipz143pQOZn8cvEnF549AOIp64vrtnm2wVLcHzQPbot6HAIx7rQ3BZI7JDFcly1xdt1 Y11FuxtyjVC0iwckK1RE/ZpidH5307h2rycozF7B3dIMemdsEHmbTYD3TuXL/5I+/lB1 KQ4A== 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=RtEZvi9ceNL8KobZqDTHZ/xMxtvepHlaSzXqdiU5oQc=; b=Se+n3lUM0FzBVpkkcY/iJH0IxpLxmKBfrvugyKfFPHmUqFfb0Jb/jk7p6iWROwybLN rQaFz71ko+rIlfi9uTw39IwE+DCiM9Ev4hzWTOAg23RdTvB5ElBCkkRg+HLQRheLAcVV uaQCfDTzCpMdYrTEKEWSkBn/3AFViv/XuEzCun+/6pnzskIahJj5asnlIFUHsv5CsJuj QkAPndah3Lt2xt3ue8vI7+XV6aCTflxIDe7Q6+NpwN+b8tRL3KUCgkINN7pPL2S3g0nt 9VL4Pmd/E/1c4/8lbY8IZ7LSswiTKOpw9dsm8iankCf13NpKXvEqtS3pzCQvhAPj19s8 0j5A== X-Gm-Message-State: AGi0PuZ8E9flk2w0JiQZb8Q9qlGV8GbGKMIOwFWxrJU5F7STj1zM8UcA NxecUbdusoz86zjho5DDPYaoz9T/Z0WDQQ== X-Google-Smtp-Source: APiQypIez94NfxKvZMHHNFhYLbZCcAZEHN0xeDz8L3sB5J6YfxBzj4p74i0Da7zQsYgAKJw4DQaM4w== X-Received: by 2002:a5d:68c4:: with SMTP id p4mr9645833wrw.308.1585925610342; Fri, 03 Apr 2020 07:53:30 -0700 (PDT) Received: from naushir-VirtualBox.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id u5sm13559469wrp.81.2020.04.03.07.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 07:53:29 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Apr 2020 15:53:03 +0100 Message-Id: <20200403145305.10288-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200403145305.10288-1-naush@raspberrypi.com> References: <20200403145305.10288-1-naush@raspberrypi.com> Subject: [libcamera-devel] [PATCH v3 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, 03 Apr 2020 14:53:31 -0000 Group AE, AWB, etc. controls together for accessibility. Update descriptions for Contrast, Brightness, and Saturation controls. Signed-off-by: Naushir Patuck --- src/libcamera/control_ids.yaml | 45 ++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index 839eea76..64e81520 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -23,25 +23,6 @@ controls: \sa AeEnable - - AwbEnable: - type: bool - description: | - Enable or disable the AWB. - - \sa ManualGain - - - 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 +39,30 @@ controls: colour channels. This value cannot be lower than 1.0. \sa ExposureTime AeEnable + + - Brightness: + type: int32_t + description: | + Specify a fixed brightness parameter. Positive values (up to 65535) + produce brighter images; negative values (up to -65536) produce darker + images and 0 leaves pixels unchanged. + + - Contrast: + type: int32_t + 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. + + \sa ManualGain + + - Saturation: + type: int32_t + 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 3 14:53:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 3374 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 C788562DAF for ; Fri, 3 Apr 2020 16:53:31 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="nC6cwVEY"; dkim-atps=neutral Received: by mail-wm1-x341.google.com with SMTP id e9so8033574wme.4 for ; Fri, 03 Apr 2020 07:53:31 -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=IzcmklKpVXrbMixcRIF+VW0BbWQaOeVX1BldC4PwxjE=; b=nC6cwVEYBxDkc8J2/vxmBkh/69ASCvGkd8AE1Jjg4A3AdH9NQNUW7gge1zfQGKLAkA o8Kz7LcwqnX6yWAkWo3pqidM0tMSwL1J0oWTNF6hDLgDQ10xTwo1Uz3VOJb/siatBMCT PwP/As3ho9YPWb00BatJiTRgi0gLqKEe4UqBBXTVwywp9xzGLeX+3PBbPoZ46zjGCxGW dnTyisN+lFMyaOvRF1ZAA/bE+/augfqpSTc4z3ZhWLvho3WfJmtCEXRD+rwbKi9CaUS8 mVWYHsqURzB5sd7WoDabRA4LbMmWmOKhFfs/LObHs8ppQ0kWBxqeahFWr6c7P2nrCyKd AheQ== 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=IzcmklKpVXrbMixcRIF+VW0BbWQaOeVX1BldC4PwxjE=; b=Cv1NnZJSM5Syvm/4pQmAp29SmwXE5fKdUqed2WrGtOG4ZuCbgU6Pb/BorsGQroSXma f8ipUBY7OSG9HRYfkrYQUONxmyZVIt/Oe2+TNnvRATHgqC+LWTsT+/GxBz1x6hM3hePU ailWjy6bseCWem0oMns1CRsIFKnqTQMOJ9yZ2Q/3qt8agx53VuNCpB2I6+U2ofD/iuF3 KKHtc23B7fqctPpl9bgsaXPIcV2fZa+cth0ZHLEcIgIyqan8IjhMD5zod/m+J3jBqnQr f4kL6NwiehJpSAHCh/wtbA2ixUjOGPsFX2LpAqeSlfpeKB0nL19pE6DlaXLuj/J0/SNT Aabg== X-Gm-Message-State: AGi0Pua9Cm4Udx/bvIWO9xcaPO1X0+rU/gytnS0WyLSbY+9x/ujOKEGw 8dL1tmqrXg+lqQmoeGuhq1nk6+JkNlpxyA== X-Google-Smtp-Source: APiQypLXjGQFP2j7w8YPmABGawmGtpokFdgDbI7Ucd3SHJ8C9px+cwH22t+JNzp5v+WC0MjcxiQVsA== X-Received: by 2002:a1c:a754:: with SMTP id q81mr9120530wme.124.1585925611135; Fri, 03 Apr 2020 07:53:31 -0700 (PDT) Received: from naushir-VirtualBox.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id u5sm13559469wrp.81.2020.04.03.07.53.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 07:53:30 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Apr 2020 15:53:04 +0100 Message-Id: <20200403145305.10288-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200403145305.10288-1-naush@raspberrypi.com> References: <20200403145305.10288-1-naush@raspberrypi.com> Subject: [libcamera-devel] [PATCH v3 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, 03 Apr 2020 14:53:32 -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 | 104 +++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index 64e81520..50f9e07b 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 a Request and returned out through Metadata. controls: - AeEnable: type: bool @@ -23,6 +25,103 @@ 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: ConstraintCustom + value: 2 + description: Custom constraint mode. + - name: ConstraintModeMax + value: 2 + 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 metering 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: | @@ -53,6 +152,11 @@ controls: Specify a fixed contrast parameter. Normal contrast is given by the value 1.0; larger values produce images with more contrast. + # Lux can only be returned in Metadata + - Lux: + type: float + description: Report an estimate of the current lux level. + - AwbEnable: type: bool description: | From patchwork Fri Apr 3 14:53:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 3375 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 4168062D64 for ; Fri, 3 Apr 2020 16:53:32 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="Rj49iBe2"; dkim-atps=neutral Received: by mail-wm1-x341.google.com with SMTP id t8so7435251wmi.2 for ; Fri, 03 Apr 2020 07:53:32 -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=2Y/cvyHB3yCOEjWu2+FR5pgwdPYPAyACZPa/xctDsQU=; b=Rj49iBe2144+FJOr7XJegccJeM+Zc4USJNISlndbUzSjjrRl04uXoyHA/OqqAOnV/Y Ab1Ub55kUwC8BjXeo8YbGZdQ+fCrNlDaYM+FKC4xfkY5AN+Ci4wXMvgSTeud8jIylp6c P0sLRmvvEc9hXE1lGs++a9X9lGhf1HCpTW+gFtSaCwNvvWNPbe+UeQMOHkEk1XJ19Pkr 543QNlLeArDivHdo+Px/7iq4G+IF7wNS7/nZNhZbsl4xX6PzTx+46oHUyGKujWQ4Rebt FtVfl9ul2CJphRfPRqIY9RodWItNY3z6zOTQeX2/ZdVZUz4ZpG8garFfbNlzT+uoyI20 PXHQ== 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=2Y/cvyHB3yCOEjWu2+FR5pgwdPYPAyACZPa/xctDsQU=; b=oHjHID/6bm6+4IcsEknMrgSmhTDEaMualcrLbpGWRfhq+F2lJuRuMNisJOZ4m6bhuQ YbOAdPsPHDxs7dsKSywZ5GtJ2wndN5cHb72T5OVnxAsm3xuKnSQpRzt84vGMEq+SWUnS z6OJOSWcqPSh28ssm2uWHuabwkkUmovLTut//6hxUoJ0uZQdm3grDPfr7xYZPJFn3E+y pOQ0rHQj6nETI4oewc5Rf7aq+DM6Za3rB+Ms+YHMlYUXVJKDA435P6iIgd+fNH4sKbTP RxEHwjEx99jVJ98jf0V7RSsmcrX275yxokpWi8XNhljsFZCKSkTZbna6Wc2Zax+R6W0y 9IYw== X-Gm-Message-State: AGi0PuZD27fVMvjVwsLYacqeC2DXv1GG+2aNPG2JTR4QbtaMLJcb33xo FSGf3LOBOTYoepeX1BXLnmKUkDLuV5tVSQ== X-Google-Smtp-Source: APiQypIwrxtQgCdldHJkrRh9tTgzvGOXZNGf+ytqPPA4OojXsxV7cTnaXvozgiU//GqZNn2mUvmThA== X-Received: by 2002:a7b:c144:: with SMTP id z4mr9645495wmi.128.1585925611818; Fri, 03 Apr 2020 07:53:31 -0700 (PDT) Received: from naushir-VirtualBox.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id u5sm13559469wrp.81.2020.04.03.07.53.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 07:53:31 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Apr 2020 15:53:05 +0100 Message-Id: <20200403145305.10288-6-naush@raspberrypi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200403145305.10288-1-naush@raspberrypi.com> References: <20200403145305.10288-1-naush@raspberrypi.com> Subject: [libcamera-devel] [PATCH v3 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, 03 Apr 2020 14:53:32 -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, 54 insertions(+), 1 deletion(-) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index 50f9e07b..d2e1820a 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -162,7 +162,60 @@ controls: description: | Enable or disable the AWB. - \sa ManualGain + \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 illumants 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 CT 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 can only be returned in Metadata + - ColourTemperature: + type: float + description: Report the current estimate of the colour temperature for + this frame. - Saturation: type: int32_t