Show a patch.

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

{
    "id": 1907,
    "url": "https://patchwork.libcamera.org/api/patches/1907/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1907/",
    "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": "<20190831210220.29819-5-niklas.soderlund@ragnatech.se>",
    "date": "2019-08-31T21:02:18",
    "name": "[libcamera-devel,4/6] libcamera: ipa: rkisp1: Fill in meta data about auto exposure",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d0258f0480309eaace8d80d3ea2950a490ba47b4",
    "submitter": {
        "id": 5,
        "url": "https://patchwork.libcamera.org/api/people/5/?format=api",
        "name": "Niklas Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "delegate": {
        "id": 16,
        "url": "https://patchwork.libcamera.org/api/users/16/?format=api",
        "username": "neg",
        "first_name": "Niklas",
        "last_name": "Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "mbox": "https://patchwork.libcamera.org/patch/1907/mbox/",
    "series": [
        {
            "id": 476,
            "url": "https://patchwork.libcamera.org/api/series/476/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=476",
            "date": "2019-08-31T21:02:14",
            "name": "libcamera: ipa: Add IPA meta data",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/476/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1907/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1907/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<niklas.soderlund@ragnatech.se>",
        "Received": [
            "from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net\n\t[195.74.38.229])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6A88760BB2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 31 Aug 2019 23:03:02 +0200 (CEST)",
            "from bismarck.berto.se (unknown [84.172.84.18])\n\tby bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA\n\tid b67a5b4d-cc32-11e9-903a-005056917f90;\n\tSat, 31 Aug 2019 23:02:59 +0200 (CEST)"
        ],
        "X-Halon-ID": "b67a5b4d-cc32-11e9-903a-005056917f90",
        "Authorized-sender": "niklas@soderlund.pp.se",
        "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat, 31 Aug 2019 23:02:18 +0200",
        "Message-Id": "<20190831210220.29819-5-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.22.1",
        "In-Reply-To": "<20190831210220.29819-1-niklas.soderlund@ragnatech.se>",
        "References": "<20190831210220.29819-1-niklas.soderlund@ragnatech.se>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 4/6] libcamera: ipa: rkisp1: Fill in meta\n\tdata about auto exposure",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "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>",
        "X-List-Received-Date": "Sat, 31 Aug 2019 21:03:03 -0000"
    },
    "content": "Fill in the meta data parsed from the statistics buffer and use the\nmetaDataReady signal to notify the pipeline handler that the data is\nready.\n\nThe method to judge if auto exposure is converged or not is just as\nsimple as the algorithm controlling the exposure time. If we are +/- 5%\nfrom our target value we are converged.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/ipa/ipa_rkisp1.cpp | 26 +++++++++++++++++++-------\n 1 file changed, 19 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/src/ipa/ipa_rkisp1.cpp b/src/ipa/ipa_rkisp1.cpp\nindex 063b075d8358c30d..cc926867d6fde478 100644\n--- a/src/ipa/ipa_rkisp1.cpp\n+++ b/src/ipa/ipa_rkisp1.cpp\n@@ -6,6 +6,7 @@\n  */\n \n #include <algorithm>\n+#include <math.h>\n #include <string.h>\n \n #include <linux/rkisp1-config.h>\n@@ -112,8 +113,9 @@ void IPARkISP1::updateStatistics(const void *cookie, Buffer &statistics)\n \tconst rkisp1_stat_buffer *stats =\n \t\tstatic_cast<rkisp1_stat_buffer *>(statistics.mem()->planes()[0].mem());\n \tconst cifisp_stat *params = &stats->params;\n+\tIPAMetaData metaData = {};\n \n-\tif ((stats->meas_type & CIFISP_STAT_AUTOEXP) && (statFrame_ % 2 == 0)) {\n+\tif (stats->meas_type & CIFISP_STAT_AUTOEXP) {\n \t\tconst cifisp_ae_stat *ae = &params->ae;\n \n \t\tconst unsigned int target = 60;\n@@ -129,18 +131,28 @@ void IPARkISP1::updateStatistics(const void *cookie, Buffer &statistics)\n \t\tvalue /= num;\n \n \t\tdouble factor = (double)target / value;\n-\t\tdouble tmp;\n \n-\t\ttmp = factor * exposure_ * gain_ / minGain_;\n-\t\texposure_ = utils::clamp<uint64_t>((uint64_t)tmp, minExposure_, maxExposure_);\n+\t\tif (statFrame_ % 3 == 0) {\n+\t\t\tdouble tmp;\n \n-\t\ttmp = tmp / exposure_ * minGain_;\n-\t\tgain_ = utils::clamp<uint64_t>((uint64_t)tmp, minGain_, maxGain_);\n+\t\t\ttmp = factor * exposure_ * gain_ / minGain_;\n+\t\t\texposure_ = utils::clamp<uint64_t>((uint64_t)tmp, minExposure_, maxExposure_);\n \n-\t\tsetControls();\n+\t\t\ttmp = tmp / exposure_ * minGain_;\n+\t\t\tgain_ = utils::clamp<uint64_t>((uint64_t)tmp, minGain_, maxGain_);\n+\n+\t\t\tsetControls();\n+\t\t}\n+\n+\t\tmetaData.aeState = fabs(factor - 1.0f) < 0.05f ?\n+\t\t\tAeState::Converged : AeState::Searching;\n+\t} else {\n+\t\tmetaData.aeState = AeState::Inactive;\n \t}\n \n \tstatFrame_++;\n+\n+\tmetaDataReady.emit(cookie, metaData);\n }\n \n /*\n",
    "prefixes": [
        "libcamera-devel",
        "4/6"
    ]
}