From patchwork Wed Jan 25 13:20:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 18195 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 564A9BEFBE for ; Wed, 25 Jan 2023 13:20:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BF1DA603C0; Wed, 25 Jan 2023 14:20:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1674652822; bh=2gsqVNNljuMOh8K7uQizaNWqqyO2xS6ndW2NdjGHv4s=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=GiIhurr+JPct6R+CK9T/McjfZtVUDxrqVbK9fks1yrM0miTXemgz1yVs7FTwFtZLu EuAxZGWxmxSIKq60lRbp0vgFa8ZgiW5UKNlbLx4YlxaeRSuI0mt2zy9NqlTyNcGHR9 vsz54ZilhiAEIohrt37j/0D4AZIxi+QOsHgwY5DslbkWzwnMtHha63iw8AJMKdmDWl 2PloUjl1U4VBqhRlemVw9i18QtaO9nnSbl8jXm6JbJO0tSxSwVrO6biDPXGn5hKkeF ji5sOICy8fkPoxuP87TwajyYDgjlgaMpmyFHA17evbwq3+Cqn0EipjQ8gOhmb6FL9v Et/yhyh0K9wKQ== Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 87943603C0 for ; Wed, 25 Jan 2023 14:20:20 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="MdFzHEGf"; dkim-atps=neutral Received: by mail-wm1-x332.google.com with SMTP id l8so13735721wms.3 for ; Wed, 25 Jan 2023 05:20:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=sXmHimgTO9IyKRuXEywwrTEJoUvZeEdVNvqcXMWHjn8=; b=MdFzHEGfj5FOpWG1w0DixWiNFius0MjVwUxLM7BvyI6knJKnUlBm2grxdfgxTCNWTI bqN8MYRD6NfxCQK6OtXxcE2myOyHf/ZdVfnwHsj4CQlShoUjtmoFWpsGEYJAfqf/EHLI HgZ359DazrF7WjQVoKS9HRzvuZpxuAuOb3iApdu/iD92JTsj9iHPpiHafxUQhBm1GFRL jBSioc4e5lxefntY8910b0RqKd++ZpUrk4vRbMmrN0Xm9q27GRK34Cm5Q2OyUKlpxP/w 8n2pRo3ej/Fn6rq1U+/w2Cc4/u0G/epBozGAFgaSFGTAdPXk9rhDzXCdNrvcCjvytUZL POnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sXmHimgTO9IyKRuXEywwrTEJoUvZeEdVNvqcXMWHjn8=; b=WVoD/aN1NHkag9SvFxrUWnfoczcfBXm+7PUMcZhUDbjsUPJYP1MB4OxnXlRol5N24I t1eQhWPDSqj0ns7CxpETRbKPW1M6n7CaWVZ2KDHG0Ar7Y85E5P5rwYBJ57GhwS+uFJIG yf67lsHDMUEIxVB1zih9yjZ/MC9eQ5oUpvCge0E56qS1TBeKlv6/j+ySrfyMR4eGFiQ6 Qm62ZAxerJGNlQXuQFsBDpv7/AD2C/TUmPl/EfqM0Zx4czW9AAjzDhE+IIXVIneoxnwP h9LxkeOVQo2y5IZBVFyWWMad4gpszXZVGJ2KPf7ylxnqNRhAmrWrGxM2Jw+vvv1kn6rd QBug== X-Gm-Message-State: AFqh2krCzszKuiWgfyRN8z9eeirmzcwFq8HBXouKCa7Db1uj/2093dL2 ZxdUOdmFZ700IQZXLl3TrtAoNDx2c8dkOmT4 X-Google-Smtp-Source: AMrXdXsF9T4WOC29yiLodZUiutiqZwf5voLcxig5QRxUxs8zHSsUnCSPW7PnLx4qurd21uG4Kqmwdw== X-Received: by 2002:a05:600c:3b02:b0:3da:1bb0:4d71 with SMTP id m2-20020a05600c3b0200b003da1bb04d71mr39610126wms.11.1674652819954; Wed, 25 Jan 2023 05:20:19 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id u11-20020a05600c19cb00b003d9fb04f658sm2001790wmq.4.2023.01.25.05.20.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 05:20:19 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Wed, 25 Jan 2023 13:20:18 +0000 Message-Id: <20230125132018.5725-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: controls: Add controls for AEC/AGC flicker avoidance 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-Patchwork-Original-From: David Plowman via libcamera-devel From: David Plowman Reply-To: David Plowman Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Flicker is the term used to describe brightness banding or oscillation of images caused typically by artificial lighting driven by a 50 or 60Hz mains supply. We add two controls intended to be used by AEC/AGC algorithms: AeFlickerMode to determine whether flicker avoidance is active or not. AeFlickerPeriod to specify a custom flicker period when the period is other than 50 or 60Hz. Signed-off-by: David Plowman Reviewed-by: Naushir Patuck --- src/libcamera/control_ids.yaml | 52 ++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index adea5f90..5e5428ea 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -14,6 +14,58 @@ controls: \sa ExposureTime AnalogueGain + - AeFlickerMode: + type: int32_t + description: | + Set the flicker mode, which determines whether, and how, the AGC/AEC + algorithm attempts to hide flicker effects caused by the duty cycle of + artificial lighting. + + Although implementation dependent, many algorithms for "flicker + avoidance" work by restricting the exposure time to integer multiples + of this cycle period, wherever possible. + + Implementations may not support all of the flicker modes listed below. + + enum: + - name: FlickerOff + value: 0 + description: No flicker avoidance is performed. + - name: Flicker50Hz + value: 1 + description: 50Hz flicker avoidance. + Suppress flicker effects caused by lighting runing with a + 100Hz period (such as produced by 50Hz mains electricity). + - name: Flicker60Hz + value: 2 + description: 60Hz flicker avoidance. + Suppress flicker effects caused by lighting running with a + 120Hz period (such as produced by 60Hz mains electricity). + - name: FlickerCustom + value: 3 + description: Custom flicker avoidance. + Suppress flicker effects caused by lighting running with a + period specified by AeFlickerPeriod. + + \sa AeFlickerPeriod + - name: FlickerAuto + value: 4 + description: Automatic flicker period detection and avoidance. + The system will automatically determine the most likely value + of the flicker period, and avoid flicker of this frequency. + + - AeFlickerPeriod: + type: int32_t + description: Custom flicker period in microseconds. + This value is taken as the current flicker period to avoid. It + is used when the AeFlickerMode is set to FlickerCustom. + + For example, to avoid 50Hz mains flicker, you could set the period + to 10000, corresponding to 10ms (twice the mains frequency), and + AeFlickerMode to FlickerCustom. + + \sa AeFlickerMode + - AeLocked: type: bool description: |