From patchwork Thu Jan 26 13:45:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 18198 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 5C4F2C3242 for ; Thu, 26 Jan 2023 13:46:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D8A56625E6; Thu, 26 Jan 2023 14:46:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1674740767; bh=RKcH0YAhfSyo/V95nouLl+95faYvYp3ElcdEXCr9GuQ=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=GewIuTy6o1yB1fmJC1dKqwmSmZhJFKeHqhD0dhQiu6daWdL/X96C0lKK6iLFAOl0f AbCWut9zH58YrzT1aLqiI6VS11M+MO2dWr0g53DjXsMnnksTBWsf0y9Y0UcxahGs19 zvsXrQDNbbV8yRrugHEzw26yqB1NuDqbJiYgNhNTzGzOkHCBVUte/s9MRWbxv7OpSc JWB4eiAji30YEpg78xDDfZfGw2hGsDpoQ/T/Yjlc3NG152rIhLZTRgApp7Jsu1SoRS qywgJFHsYbtukAX6z3H3W9IO3JcBMnUkAxX6Aq13Gi0bGPGZ+Yi7DLcufU3ckLWzUq gkyR/iLIOjhUg== Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DEF5661EFB for ; Thu, 26 Jan 2023 14:46:04 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="qL3bdzmI"; dkim-atps=neutral Received: by mail-wm1-x32d.google.com with SMTP id o17-20020a05600c511100b003db021ef437so1138149wms.4 for ; Thu, 26 Jan 2023 05:46:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aJca/RVkc3lNXZ6N3PB60KX1Xz4s8woT2pulzG8SZxU=; b=qL3bdzmIJTh+41Jayuv82B4WN9rrvejh0on4moT3EQT4rEsCj6QTpq04/BtcKJ5xd1 zi3LHTNLZ5fqhlRsuc/8Qmn8fRHeuhKfnU/G4SkEMV9Dy2nUuGLOCfVlnAo5yTHmfZM5 Xiuqll+YsM8+mstEe0PIbGZVhOE/caRKZw2uCqI0cnfdyF+CrkO40FE8hDI+SXexwza8 1aVY9n5bsKMXL/JYzrxO/BzG2WqtE4TkUAna93atouzNkcu9KSeK7XLl8YtAHiVjiETm bfst9NRd45n52+CncqWPRFnGQpV/HdBoWEXg3zv7WYd/+HPDbRQmRwT4rELelZoCzk81 nOmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aJca/RVkc3lNXZ6N3PB60KX1Xz4s8woT2pulzG8SZxU=; b=zr3ckAEmVKn3d9YE5IdLk7izziqDkDZKdx2GHkIR8tTq1ZQIcxZMZvlRrsyx5WCtXM xyZXTa6QsYLLEaKghVSPdRa/THgTIff/IsrsxDbDFgX+LjCYY/g3R6YdjqQyGM5IM6b1 ISuqQtE52FI195ePGGVmEACTUw9DN+mXW7LNHhWXFbuVLSMBS1ytfshImrqChKOZTVYc laLBbyuQfH3J+8Md1IeWgHHEgS9VZekrpJiGqb1cirTFE8mC/jIUYON4+cZ5TQW3SiKG hjkhq1MbGdSO7n4hhmjT2KbpZqCI4wKmxmJzucrB0FOVLWYQetzhBdeBmojYWnwR0Toh wskA== X-Gm-Message-State: AFqh2krL8QpdhCeqk8r/D+qS3eLFNIv8TeWoB7mHWxs9rpdZit+DHBDN L6Ux6QSXguTCnkysX5R+6/2kNpSrWty4ed9F X-Google-Smtp-Source: AMrXdXulyimo8rAb5ESaxhfzEvsqInA4WoPrj75MepZgPGzj+bnhP/Y3K3GYRY2GSbH532u9wmDeIg== X-Received: by 2002:a05:600c:a11:b0:3db:f1f:bc31 with SMTP id z17-20020a05600c0a1100b003db0f1fbc31mr32800989wmp.16.1674740764294; Thu, 26 Jan 2023 05:46:04 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id m2-20020a056000180200b002bfb5618ee7sm1370567wrh.91.2023.01.26.05.46.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 05:46:03 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Thu, 26 Jan 2023 13:45:58 +0000 Message-Id: <20230126134559.3323-2-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230126134559.3323-1-david.plowman@raspberrypi.com> References: <20230126134559.3323-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/2] 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 --- src/libcamera/control_ids.yaml | 69 +++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 17 deletions(-) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index adea5f90..8093ab75 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: FlickerFreq50Hz + 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: FlickerFreq60Hz + 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: | @@ -843,23 +895,6 @@ controls: value: 1 description: The lens shading map mode is available. - - SceneFlicker: - type: int32_t - draft: true - description: | - Control to report the detected scene light frequency. Currently - identical to ANDROID_STATISTICS_SCENE_FLICKER. - enum: - - name: SceneFickerOff - value: 0 - description: No flickering detected. - - name: SceneFicker50Hz - value: 1 - description: 50Hz flickering detected. - - name: SceneFicker60Hz - value: 2 - description: 60Hz flickering detected. - - PipelineDepth: type: int32_t draft: true