Patch Detail
Show a patch.
GET /api/patches/21710/?format=api
{ "id": 21710, "url": "https://patchwork.libcamera.org/api/patches/21710/?format=api", "web_url": "https://patchwork.libcamera.org/patch/21710/", "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": "<20241020152821.240726-5-mike.rudenko@gmail.com>", "date": "2024-10-20T15:28:21", "name": "[v2,4/4] ipa: rkisp1: use active state in setControls", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "636615c81bf40111dc522638a8723a0ab739bea1", "submitter": { "id": 146, "url": "https://patchwork.libcamera.org/api/people/146/?format=api", "name": "Mikhail Rudenko", "email": "mike.rudenko@gmail.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/21710/mbox/", "series": [ { "id": 4728, "url": "https://patchwork.libcamera.org/api/series/4728/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4728", "date": "2024-10-20T15:28:17", "name": "Reduce rkisp1 flicker on first start", "version": 2, "mbox": "https://patchwork.libcamera.org/series/4728/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/21710/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/21710/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 97E4FC3304\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 20 Oct 2024 15:28:54 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B23DF65396;\n\tSun, 20 Oct 2024 17:28:53 +0200 (CEST)", "from mail-lf1-x129.google.com (mail-lf1-x129.google.com\n\t[IPv6:2a00:1450:4864:20::129])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 126DA6538F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 20 Oct 2024 17:28:41 +0200 (CEST)", "by mail-lf1-x129.google.com with SMTP id\n\t2adb3069b0e04-53a007743e7so4302947e87.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 20 Oct 2024 08:28:41 -0700 (PDT)", "from localhost.localdomain\n\t(static.40.223.216.95.clients.your-server.de. [95.216.223.40])\n\tby smtp.gmail.com with ESMTPSA id\n\t2adb3069b0e04-53a223efad4sm249040e87.67.2024.10.20.08.28.38\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 20 Oct 2024 08:28:39 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"Qfwk73r8\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20230601; t=1729438120; x=1730042920;\n\tdarn=lists.libcamera.org; \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=4bm5r3CB3RWzDN5kuKb8SsqCek9pBMr5+Wpi3nt0Qxo=;\n\tb=Qfwk73r84L5sZL76nTUCHZVJhclVPjOMbBP9uUoKMDU6nVJYr5i9o6rVose7ZShAot\n\tnevVPZ/o87UFnR6ENlC81zk0btO6YGwWaKhO1IunB4WqQnvpXX/3giWPycw3zSwRT9MJ\n\t/IUPHotAeWQopRwEuk5qymICZ2FfWIAxYkufN6AgbGQ/Kq3B52e/8Op530cuFU93I+RV\n\tfgKwldbpoHYXf+2IeAVhCaLrbYnV42zazRqlZoE1m0LHs3um9l3IkKlBRgwpWb9pB0Ll\n\t+GKfLFDkVwP5Qm540nbtwvaDpLBla5Qp8O8gqOp1F+CxrX2Hp5QqUGraCB/apMBaer1a\n\tzGLA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1729438120; x=1730042920;\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=4bm5r3CB3RWzDN5kuKb8SsqCek9pBMr5+Wpi3nt0Qxo=;\n\tb=BsuLU41eBDKXscaaCutJPWl7b9ctSKao+LE9Dab3Izz1yoxEjYuNrNDnG3lZqP5pHb\n\tYdmrm/sUPDXcS8LGjotiS5m1kR31o3eaLouC/+I5JY68y1Rgyf+nE7j99To8KZyxdnxZ\n\tHZ3xI6xqFT3waen/dxIzvX+Osglgje52vWe8BUbE3BH0v/pVnYFc7MxFTxFveJPWbn1r\n\tZqyw6roMfdLf4jZxQSks3R0MhsWF2TGROvxAqh4xprlUev7FjMuyaDM+/AlW6PPM3bhE\n\txfYNNCwTTMFIMR/oM/F35y7shkXTPDH7wNsQ6Aowdzce4v+euFY5f0A6egeWMjmYKzXc\n\tFz2Q==", "X-Gm-Message-State": "AOJu0YwF1Dq/t910ZvofV84GAVTmwPihksqkfFfOxf3w04iiAG3unT5F\n\tzHJGsGotXTUM55Dtdl8uf+yOmC4BNIR3kxdIacfRIAxgpOW4Qvcp19ph4A==", "X-Google-Smtp-Source": "AGHT+IEPzDLJMBOGzCG9Gh1E7eTFZPF1IHuHkMRl0nizwqSjznyvj4d0Mq24potc+G55Vtw5DxOokQ==", "X-Received": "by 2002:a05:6512:124c:b0:539:e873:6d7 with SMTP id\n\t2adb3069b0e04-53a154410e0mr4051767e87.1.1729438119775; \n\tSun, 20 Oct 2024 08:28:39 -0700 (PDT)", "From": "Mikhail Rudenko <mike.rudenko@gmail.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tMikhail Rudenko <mike.rudenko@gmail.com>", "Subject": "[PATCH v2 4/4] ipa: rkisp1: use active state in setControls", "Date": "Sun, 20 Oct 2024 18:28:21 +0300", "Message-ID": "<20241020152821.240726-5-mike.rudenko@gmail.com>", "X-Mailer": "git-send-email 2.46.0", "In-Reply-To": "<20241020152821.240726-1-mike.rudenko@gmail.com>", "References": "<20241020152821.240726-1-mike.rudenko@gmail.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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 results of AGC algorithm currently travel a long way before being\nactually applied. Let's consider the common case when 4 requests are\nused and frames 0-3 are queued before start(). AGC is first run when\nframe 0 stats are ready, and exposure/gain are saved in\nactiveState. Then, when frame 4 is queued, they are stored in\ncorresponding frameContext. Four frames later, frame 4 is captured,\nand after processing the stats buffer, exposure/gain are extracted\nfrom frameContext and queued to delayedControls in setControls(). On\nframe 5, delayedControls apply them. Assuming a control delay of 2, the\nsettings will become effective for frame 7. So, it takes 7 frames for\nthe AGC algorithm to get feedback. This results in suboptimal\nconvergence rate.\n\nIf we instead use just computed exposure/gain from the activeState in\nsetControls, the delay is reduced from 7 frames to 3 frames. Tests\non OV4689 sensor show faster convergence and no unwanted side effects.\n---\n src/ipa/rkisp1/rkisp1.cpp | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\n--\n2.46.0", "diff": "diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 680a7eee..8793d59f 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -458,9 +458,11 @@ void IPARkISP1::setControls(unsigned int frame)\n \t * internal sensor delays and other timing parameters into account.\n \t */\n\n-\tIPAFrameContext &frameContext = context_.frameContexts.get(frame);\n-\tuint32_t exposure = frameContext.agc.exposure;\n-\tuint32_t gain = context_.camHelper->gainCode(frameContext.agc.gain);\n+\tconst auto &agc = context_.activeState.agc;\n+\tuint32_t exposure = agc.autoEnabled ?\n+\t\t\t agc.automatic.exposure : agc.manual.exposure;\n+\tuint32_t gain = context_.camHelper->gainCode(agc.autoEnabled ?\n+\t\t\t\t\t\t agc.automatic.gain : agc.manual.gain);\n\n \tControlList ctrls(sensorControls_);\n \tctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure));\n", "prefixes": [ "v2", "4/4" ] }