Show a patch.

GET /api/patches/12770/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 12770,
    "url": "https://patchwork.libcamera.org/api/patches/12770/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12770/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20210702103800.41291-6-paul.elder@ideasonboard.com>",
    "date": "2021-07-02T10:37:49",
    "name": "[libcamera-devel,RFC,v3,05/16] controls: Replace AeLocked with AeState, and add AeLock",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "6bd37deb732f699c348ec0320e7c738a1e3a4156",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/users/17/?format=api",
        "username": "epaul",
        "first_name": "Paul",
        "last_name": "Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/12770/mbox/",
    "series": [
        {
            "id": 2199,
            "url": "https://patchwork.libcamera.org/api/series/2199/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2199",
            "date": "2021-07-02T10:37:44",
            "name": "Preliminary FULL plumbing",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/2199/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12770/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12770/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 D7B85C3222\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  2 Jul 2021 10:38:24 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 90D32684E7;\n\tFri,  2 Jul 2021 12:38:24 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CAF68684F2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  2 Jul 2021 12:38:22 +0200 (CEST)",
            "from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 58710891;\n\tFri,  2 Jul 2021 12:38:20 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"llwICyYa\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1625222302;\n\tbh=ijlqyjiC8eGczISYnu50gavvQApOfrstEsLecP7RyV8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=llwICyYarxbfI/TQEBxlMWMRrb8uTXvObXl0BsHEI7TwP+S5KD4V6iMETPmZh/THT\n\t76EtpNJD+sJx0L9GYDr+m2mEQL7drQ9VbXOvilBJpDeTsWwJ/J0rGgCdDQvRBMouQd\n\tYXNpCyY6VUH9OJwXi0D/Ts4ZRyoAhXmMtFKQ15NI=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  2 Jul 2021 19:37:49 +0900",
        "Message-Id": "<20210702103800.41291-6-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20210702103800.41291-1-paul.elder@ideasonboard.com>",
        "References": "<20210702103800.41291-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [RFC PATCH v3 05/16] controls: Replace AeLocked\n\twith AeState, and add AeLock",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "AeLocked alone isn't sufficient for reporting the AE state, so replace\nit with AeState. Add an AeLock control for instructing the camera to\nlock the AE values.\n\nUpdate the current users of AeLocked accordingly.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nNo change in v3\n---\n src/ipa/raspberrypi/raspberrypi.cpp |  5 +-\n src/ipa/rkisp1/rkisp1.cpp           | 13 ++--\n src/libcamera/control_ids.yaml      | 96 ++++++++++++++++++-----------\n 3 files changed, 71 insertions(+), 43 deletions(-)",
    "diff": "diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 4d09a84f..4981aa29 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -469,7 +469,10 @@ void IPARPi::reportMetadata()\n \n \tAgcStatus *agcStatus = rpiMetadata_.GetLocked<AgcStatus>(\"agc.status\");\n \tif (agcStatus) {\n-\t\tlibcameraMetadata_.set(controls::AeLocked, agcStatus->locked);\n+\t\tlibcameraMetadata_.set(controls::AeState,\n+\t\t\t\t       agcStatus->locked ?\n+\t\t\t\t       controls::AeStateLocked :\n+\t\t\t\t       controls::AeStateSearching);\n \t\tlibcameraMetadata_.set(controls::DigitalGain, agcStatus->digital_gain);\n \t}\n \ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex cdfb4d13..4eca26e2 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -51,7 +51,7 @@ private:\n \t\t\t      const rkisp1_stat_buffer *stats);\n \n \tvoid setControls(unsigned int frame);\n-\tvoid metadataReady(unsigned int frame, unsigned int aeState);\n+\tvoid metadataReady(unsigned int frame, int aeState);\n \n \tstd::map<unsigned int, FrameBuffer> buffers_;\n \tstd::map<unsigned int, void *> buffersMemory_;\n@@ -227,7 +227,7 @@ void IPARkISP1::updateStatistics(unsigned int frame,\n \t\t\t\t const rkisp1_stat_buffer *stats)\n {\n \tconst rkisp1_cif_isp_stat *params = &stats->params;\n-\tunsigned int aeState = 0;\n+\tint aeState = controls::AeStateInactive;\n \n \tif (stats->meas_type & RKISP1_CIF_ISP_STAT_AUTOEXP) {\n \t\tconst rkisp1_cif_isp_ae_stat *ae = &params->ae;\n@@ -262,7 +262,9 @@ void IPARkISP1::updateStatistics(unsigned int frame,\n \t\t\tsetControls(frame + 1);\n \t\t}\n \n-\t\taeState = fabs(factor - 1.0f) < 0.05f ? 2 : 1;\n+\t\taeState = fabs(factor - 1.0f) < 0.05f ?\n+\t\t\t  controls::AeStateConverged :\n+\t\t\t  controls::AeStateSearching;\n \t}\n \n \tmetadataReady(frame, aeState);\n@@ -281,12 +283,11 @@ void IPARkISP1::setControls(unsigned int frame)\n \tqueueFrameAction.emit(frame, op);\n }\n \n-void IPARkISP1::metadataReady(unsigned int frame, unsigned int aeState)\n+void IPARkISP1::metadataReady(unsigned int frame, int aeState)\n {\n \tControlList ctrls(controls::controls);\n \n-\tif (aeState)\n-\t\tctrls.set(controls::AeLocked, aeState == 2);\n+\tctrls.set(controls::AeState, aeState);\n \n \tRkISP1Action op;\n \top.op = ActionMetadata;\ndiff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml\nindex 9d4638ae..5717bc1f 100644\n--- a/src/libcamera/control_ids.yaml\n+++ b/src/libcamera/control_ids.yaml\n@@ -14,16 +14,70 @@ controls:\n \n         \\sa ExposureTime AnalogueGain\n \n-  - AeLocked:\n+  - AeLock:\n       type: bool\n       description: |\n-        Report the lock status of a running AE algorithm.\n+        Control to lock the AE values.\n+        When set to true, the AE algorithm is locked to its latest parameters,\n+        and will not change exposure settings until set to false.\n+        \\sa AeState\n \n-        If the AE algorithm is locked the value shall be set to true, if it's\n-        converging it shall be set to false. If the AE algorithm is not\n-        running the control shall not be present in the metadata control list.\n+  - AeState:\n+      type: int32_t\n+      description: |\n+        Control to report the current AE algorithm state. Enabling or disabling\n+        AE (AeEnable) always resets the AeState to AeStateInactive. The camera\n+        device can do several state transitions between two results, if it is\n+        allowed by the state transition table. For example, AeStateInactive may\n+        never actually be seen in a result.\n \n-        \\sa AeEnable\n+        The state in the result is the state for this image (in sync with this\n+        image). If AE state becomes AeStateConverged, then the image data\n+        associated with the result should be good to use.\n+\n+        The state transitions mentioned below assume that AeEnable is on.\n+\n+        \\sa AeLock\n+      enum:\n+        - name: AeStateInactive\n+          value: 0\n+          description: |\n+            The AE algorithm is inactive.\n+            If the camera initiates an AE scan, the state shall go to Searching.\n+            If AeLock is on, the state shall go to Locked.\n+        - name: AeStateSearching\n+          value: 1\n+          description: |\n+            The AE algorithm has not converged yet.\n+            If the camera finishes an AE scan, the state shall go to Converged.\n+            If the camera finishes an AE scan, but flash is required, the state\n+            shall go to FlashRequired.\n+            If AeLock is on, the state shall go to Locked.\n+        - name: AeStateConverged\n+          value: 2\n+          description: |\n+            The AE algorithm has converged.\n+            If the camera initiates an AE scan, the state shall go to Searching.\n+            If AeLock is on, the state shall go to Locked.\n+        - name: AeStateLocked\n+          value: 3\n+          description: |\n+            The AE algorithm is locked.\n+            If AeLock is off, the state can go to Searching, Converged, or\n+            FlashRequired.\n+        - name: AeStateFlashRequired\n+          value: 4\n+          description: |\n+            The AE algorithm would need a flash for good results\n+            If the camera initiates an AE scan, the state shall go to Searching.\n+            If AeLock is on, the state shall go to Locked.\n+        - name: AeStatePrecapture\n+          value: 5\n+          description: |\n+            The AE algorithm has started a pre-capture metering session.\n+            After the sequence is finished, the state shall go to Converged if\n+            AeLock is off, and Locked if it is on.\n+            \\sa AePrecaptureTrigger\n \n   # AeMeteringMode needs further attention:\n   # - Auto-generate max enum value.\n@@ -477,36 +531,6 @@ controls:\n             High quality aberration correction which might reduce the frame\n             rate.\n \n-  - AeState:\n-      type: int32_t\n-      draft: true\n-      description: |\n-       Control to report the current AE algorithm state. Currently identical to\n-       ANDROID_CONTROL_AE_STATE.\n-\n-        Current state of the AE algorithm.\n-      enum:\n-        - name: AeStateInactive\n-          value: 0\n-          description: The AE algorithm is inactive.\n-        - name: AeStateSearching\n-          value: 1\n-          description: The AE algorithm has not converged yet.\n-        - name: AeStateConverged\n-          value: 2\n-          description: The AE algorithm has converged.\n-        - name: AeStateLocked\n-          value: 3\n-          description: The AE algorithm is locked.\n-        - name: AeStateFlashRequired\n-          value: 4\n-          description: The AE algorithm would need a flash for good results\n-        - name: AeStatePrecapture\n-          value: 5\n-          description: |\n-            The AE algorithm has started a pre-capture metering session.\n-            \\sa AePrecaptureTrigger\n-\n   - AfState:\n       type: int32_t\n       draft: true\n",
    "prefixes": [
        "libcamera-devel",
        "RFC",
        "v3",
        "05/16"
    ]
}