{"id":18483,"url":"https://patchwork.libcamera.org/api/1.1/patches/18483/?format=json","web_url":"https://patchwork.libcamera.org/patch/18483/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20230328085521.7409-2-david.plowman@raspberrypi.com>","date":"2023-03-28T08:55:20","name":"[libcamera-devel,v3,1/2] libcamera: controls: Add controls for AEC/AGC flicker avoidance","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"b446d24f723348b46113baa9442c4bb2ba6bbdcb","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/1.1/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18483/mbox/","series":[{"id":3822,"url":"https://patchwork.libcamera.org/api/1.1/series/3822/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3822","date":"2023-03-28T08:55:19","name":"Add flicker avoidance controls","version":3,"mbox":"https://patchwork.libcamera.org/series/3822/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18483/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18483/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 76B45BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Mar 2023 08:55:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 226BE6274E;\n\tTue, 28 Mar 2023 10:55:31 +0200 (CEST)","from mail-io1-xd33.google.com (mail-io1-xd33.google.com\n\t[IPv6:2607:f8b0:4864:20::d33])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 19457626E2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Mar 2023 10:55:27 +0200 (CEST)","by mail-io1-xd33.google.com with SMTP id o12so5070643iow.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Mar 2023 01:55:27 -0700 (PDT)","from pi4-davidp.pitowers.org\n\t([2a00:1098:3142:14:2bce:64d6:1a5c:49a2])\n\tby smtp.gmail.com with ESMTPSA id\n\tg1-20020a028501000000b0040380d7c768sm9887414jai.106.2023.03.28.01.55.24\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 28 Mar 2023 01:55:25 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1679993731;\n\tbh=euIoSd/qb9gVyuY6+xi1UwFmAN+QrbRRNSE9tkA/JRc=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=MopqDpixQB5+ehst+faWJOZS/vNY3P+puI9sDkO/+nW7fRzLtMSypAVpbtSCVb6zl\n\t50iji1/hebxZl0Fzasdq0XhJxOJI4teAHijHtG9AiAZQM42luk1ffK1wYoMY5AxkTS\n\tiiRauLcthXqOMsHgd3w6pDrIf9ANVZow6IlsJbt7+3hhZ7zpExboI9FH+zBY3JX36Y\n\tSRyiwPagO/eLMJJs9jTX4IKcnPqsEFIs/DoAa3eGzBvWF3Afwj3+KjjNEd5cJxOIWI\n\tY9oA5B2Z4yqRGEqg8irmW9qjGMyhbjGM2olKtl4DRkoKmR3vF2swgQy5K7eBKJrwdZ\n\tXCVV5/wckuyHQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1679993726;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=6z1WOhXY6J1PXKp0uYL/HuVRwLxh8DoooxywOcHa0iY=;\n\tb=HrYUK83uzWSXLNWecpTgnndUm/1sdY4cPD/LgAsA2jiJhiarqQ3ACQuZkTFg6bgRS6\n\thmWdeHTTRGHbO52QUP1hiFmxhEZJz37roAc0bmG1sfLNxBhi/C+WfTeThJGw5xtXpVLN\n\t6O3A7UReZi3SVMCeBEzPVbNlxZwOeWHY6L/iVlnekMVoXEXgt/eRtCSK6irXRVD8BIP6\n\tKG45mM/opfkjEALiplahL434VHL02SML+AmBVzzYXXb1a9Ceo5CjQAy8ejkFwZag0cmE\n\tHsN370lJ09eWSG+O+CfBK1dmQOgemRcR6ugnrb+C4XI0i0l7/0OlxddedHm7h+o/FBLS\n\tDzVw=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"HrYUK83u\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1679993726;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=6z1WOhXY6J1PXKp0uYL/HuVRwLxh8DoooxywOcHa0iY=;\n\tb=f5WdeBXqsUoQc8uSZtR7HEAbBFqUnNRlobPA2FPaa6OJrH9tR3shSCMjSLRC2D9gkr\n\t6w14vQZInmTzLvzGOVSxdfUtT8NMqauTpKOXJzS3dmKLFdsJpp1Bm1iMdm9mb9P7030r\n\t+uAa3dc17sRixKmyiQzc4Nw9GMeCt6bzmYSUb0D0JKFkj1MeY/j+Z7SlaSkdSHrMXJAc\n\tjQk8Ik8fJVIUdLQ+WGmmovw9QXpvb7WWQiTxUGPgNyhwrim87kc8SSe7uDCcT47fTDe6\n\tmY0F0oyX9otUrDxrI7A60wWUUYzfr5sPmZP2Y+gYXDarIscso6XIB3yvniy0a2+lhEJn\n\tXB7g==","X-Gm-Message-State":"AAQBX9c6WX58Pm/8iFPgAubXfr9dnhF7Qbh73CjyWleWsvLhrRYjCOAz\n\tS95rraTCf6B7Z115b9mLNYvEG+sOLv1KSzG7XLVz8w==","X-Google-Smtp-Source":"AKy350YjizxQWngljcwvJ+qrDLT93GLQHACV88ckgDMTd7lm+3eiTQhv7LVRBSwbhzLAz7xWf5JXsw==","X-Received":"by 2002:a6b:c90d:0:b0:75c:90f1:4622 with SMTP id\n\tz13-20020a6bc90d000000b0075c90f14622mr1372113iof.0.1679993725711; \n\tTue, 28 Mar 2023 01:55:25 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 28 Mar 2023 09:55:20 +0100","Message-Id":"<20230328085521.7409-2-david.plowman@raspberrypi.com>","X-Mailer":"git-send-email 2.30.2","In-Reply-To":"<20230328085521.7409-1-david.plowman@raspberrypi.com>","References":"<20230328085521.7409-1-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 1/2] libcamera: controls: Add controls\n\tfor AEC/AGC flicker avoidance","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"David Plowman <david.plowman@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Flicker is the term used to describe brightness banding or oscillation\nof images caused typically by artificial lighting driven by a 50 or\n60Hz mains supply. We add three controls intended to be used by\nAEC/AGC algorithms:\n\nAeFlickerMode to enable flicker avoidance.\n\nAeFlickerCustom to set custom flicker periods.\n\nAeFlickerDetected to report any flicker that is currently detected.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/libcamera/control_ids.yaml | 84 +++++++++++++++++++++++++++-------\n 1 file changed, 67 insertions(+), 17 deletions(-)","diff":"diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml\nindex adea5f90..b472050c 100644\n--- a/src/libcamera/control_ids.yaml\n+++ b/src/libcamera/control_ids.yaml\n@@ -156,6 +156,73 @@ controls:\n         control of which features should be automatically adjusted shouldn't\n         better be handled through a separate AE mode control.\n \n+  - AeFlickerMode:\n+      type: int32_t\n+      description: |\n+        Set the flicker mode, which determines whether, and how, the AGC/AEC\n+        algorithm attempts to hide flicker effects caused by the duty cycle of\n+        artificial lighting.\n+\n+        Although implementation dependent, many algorithms for \"flicker\n+        avoidance\" work by restricting this exposure time to integer multiples\n+        of the cycle period, wherever possible.\n+\n+        Implementations may not support all of the flicker modes listed below.\n+\n+      enum:\n+        - name: FlickerOff\n+          value: 0\n+          description: No flicker avoidance is performed.\n+        - name: FlickerFreq50Hz\n+          value: 1\n+          description: 50Hz flicker avoidance.\n+            Suppress flicker effects caused by lighting running with a 100Hz\n+            period (such as that produced by 50Hz mains electricity).\n+        - name: FlickerFreq60Hz\n+          value: 2\n+          description: 60Hz flicker avoidance.\n+            Suppress flicker effects caused by lighting running with a 120Hz\n+            period (such as that produced by 60Hz mains electricity).\n+        - name: FlickerCustom\n+          value: 3\n+          description: Custom flicker avoidance.\n+            Suppress flicker effects caused by lighting running with a period\n+            specified by the AeFlickerCustom control.\n+            \\sa AeFlickerCustom\n+        - name: FlickerAuto\n+          value: 4\n+          description: Automatic flicker period detection and avoidance.\n+            The system will automatically determine the most likely value of\n+            flicker period, and avoid flicker of this frequency.\n+\n+  - AeFlickerCustom:\n+      type: int32_t\n+      description: Custom flicker period in microseconds.\n+        This value sets the current flicker period to avoid. It is used when\n+        AeFlickerMode is set to FlickerCustom.\n+\n+        If this control is not available, then the setting of custom flicker\n+        periods is not supported.\n+\n+        \\sa AeFlickerMode\n+\n+  - AeFlickerDetected:\n+      type: int32_t\n+      description: Flicker period detected in microseconds.\n+        The value reported here indicates the currently detected flicker\n+        period, or zero if no flicker at all is detected.\n+\n+        So in the case of 50Hz mains flicker, the value would be 10000\n+        (corresponding to 100Hz), or 8333 (120Hz) for 60Hz mains flicker. But\n+        note that it is not required that any form of scene flicker is detected\n+        at all, so depending on the implementation, this metadata may just\n+        report zero or be entirely absent.\n+\n+        AeFlickerDetected may also report other values for non-standard flicker\n+        periods.\n+\n+        \\sa AeFlickerMode\n+\n   - Brightness:\n       type: float\n       description: |\n@@ -843,23 +910,6 @@ controls:\n           value: 1\n           description: The lens shading map mode is available.\n \n-  - SceneFlicker:\n-      type: int32_t\n-      draft: true\n-      description: |\n-       Control to report the detected scene light frequency. Currently\n-       identical to ANDROID_STATISTICS_SCENE_FLICKER.\n-      enum:\n-        - name: SceneFickerOff\n-          value: 0\n-          description: No flickering detected.\n-        - name: SceneFicker50Hz\n-          value: 1\n-          description: 50Hz flickering detected.\n-        - name: SceneFicker60Hz\n-          value: 2\n-          description: 60Hz flickering detected.\n-\n   - PipelineDepth:\n       type: int32_t\n       draft: true\n","prefixes":["libcamera-devel","v3","1/2"]}