Show a patch.

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

{
    "id": 14544,
    "url": "https://patchwork.libcamera.org/api/patches/14544/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14544/",
    "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": "<20211111081055.61127-1-hpa@redhat.com>",
    "date": "2021-11-11T08:10:55",
    "name": "[libcamera-devel] ipa: ipu3: agc: Fix -nan exception",
    "commit_ref": null,
    "pull_url": null,
    "state": "rejected",
    "archived": false,
    "hash": "0c8c35686e3181e54e2704e1d27182be4708837b",
    "submitter": {
        "id": 105,
        "url": "https://patchwork.libcamera.org/api/people/105/?format=api",
        "name": "Kate Hsuan",
        "email": "hpa@redhat.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/14544/mbox/",
    "series": [
        {
            "id": 2710,
            "url": "https://patchwork.libcamera.org/api/series/2710/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2710",
            "date": "2021-11-11T08:10:55",
            "name": "[libcamera-devel] ipa: ipu3: agc: Fix -nan exception",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2710/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14544/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14544/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 96D2BBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 11 Nov 2021 08:11:20 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E2D476032C;\n\tThu, 11 Nov 2021 09:11:19 +0100 (CET)",
            "from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 102246032C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 11 Nov 2021 09:11:17 +0100 (CET)",
            "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n\t[209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id\n\tus-mta-387-LGFEccYUPyurqtHiWNF9VA-1; Thu, 11 Nov 2021 03:11:15 -0500",
            "from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mimecast-mx01.redhat.com (Postfix) with ESMTPS id CBD928042F0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 11 Nov 2021 08:11:14 +0000 (UTC)",
            "from fedora.redhat.com (unknown [10.39.193.225])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id CECE160854;\n\tThu, 11 Nov 2021 08:11:11 +0000 (UTC)"
        ],
        "Authentication-Results": [
            "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"fKcrwKEa\"; dkim-atps=neutral",
            "relay.mimecast.com;\n\tauth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hpa@redhat.com"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1636618276;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding;\n\tbh=zBcqDE5XOd6HhoUknkgwmMNbgDnWvMFa930ki34KSzU=;\n\tb=fKcrwKEaalgALGvMmPCy78kMCWYVKwIVFTroGjj+mQpuqxTBVjinhpx8vOWUlhIPvgPw7y\n\tp5WKXfbFFyu9ekdp3K1mETB+AATtFtqWlMUAqCVgwQ0MfbeSac+BIXdOs5ajCDFuZ/X8IY\n\t345J7KQWunzJUKLJQsISraIvTDWMRvA=",
        "X-MC-Unique": "LGFEccYUPyurqtHiWNF9VA-1",
        "From": "Kate Hsuan <hpa@redhat.com>",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Thu, 11 Nov 2021 16:10:55 +0800",
        "Message-Id": "<20211111081055.61127-1-hpa@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.13",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"",
        "Subject": "[libcamera-devel] [PATCH] ipa: ipu3: agc: Fix -nan exception",
        "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": "The user may equip a cam cover to make sure security.If they want to\ndisable the cam, the cam cover could be physically closed to ensure\nthe image will not be delivered. In this situation, the image will be\nall black and it triggers the -nan exception for some values.\nEventually, the exposure will be locked. As a result, we only can get\na black image.\n\nevGain is calculated by kEvGainTarget * knumHistogramBins / iqMean_.\nFor a black image, a -nan of iqMean_ will lead evGain miss calculated.\nConsequently, the exposure value can not be correctly estimated and be\nlocked at -nan as well. In this situation, evGain is set to 1.0 and try\nto estimate again through the next frame. Also, an additional check\nmakes sure the exposure value is between minTotalExposure and\nmaxTotalExposure.\n\nSigned-off-by: Kate Hsuan <hpa@redhat.com>\n---\n src/ipa/ipu3/algorithms/agc.cpp | 7 +++++--\n 1 file changed, 5 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\nindex b5d736c1..d965febe 100644\n--- a/src/ipa/ipu3/algorithms/agc.cpp\n+++ b/src/ipa/ipu3/algorithms/agc.cpp\n@@ -191,6 +191,8 @@ void Agc::computeExposure(uint32_t &exposure, double &analogueGain)\n \n \t/* Estimate the gain needed to have the proportion wanted */\n \tdouble evGain = kEvGainTarget * knumHistogramBins / iqMean_;\n+\tif(std::isnan(evGain))\n+\t\tevGain = 1.0;\n \n \t/* extracted from Rpi::Agc::computeTargetExposure */\n \t/* Calculate the shutter time in seconds */\n@@ -210,7 +212,9 @@ void Agc::computeExposure(uint32_t &exposure, double &analogueGain)\n \n \t/* Clamp the exposure value to the min and max authorized */\n \tutils::Duration maxTotalExposure = maxShutterSpeed * maxAnalogueGain_;\n-\tcurrentExposure_ = std::min(currentExposure_, maxTotalExposure);\n+\tutils::Duration minTotalExposure = minShutterSpeed * minAnalogueGain_;\n+\n+\tcurrentExposure_ = std::clamp<utils::Duration>(currentExposure_, minTotalExposure, maxTotalExposure);\n \tLOG(IPU3Agc, Debug) << \"Target total exposure \" << currentExposure_\n \t\t\t    << \", maximum is \" << maxTotalExposure;\n \n@@ -232,7 +236,6 @@ void Agc::computeExposure(uint32_t &exposure, double &analogueGain)\n \tLOG(IPU3Agc, Debug) << \"Divided up shutter and gain are \"\n \t\t\t    << shutterTime << \" and \"\n \t\t\t    << stepGain;\n-\n \texposure = shutterTime / lineDuration_;\n \tanalogueGain = stepGain;\n \n",
    "prefixes": [
        "libcamera-devel"
    ]
}