[{"id":37024,"web_url":"https://patchwork.libcamera.org/comment/37024/","msgid":"<851plno5tg.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-11-24T14:36:59","subject":"Re: [PATCH 1/3] libcamera: swstats_cpu: Stop doing unnecessary work\n\tin processFrame()","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Hi Hans,\n\nthank you for the patch.\n\nHans de Goede <johannes.goede@oss.qualcomm.com> writes:\n\n> Since commit c28bb6a6a48e (\"libcamera: software_isp: Run sw-statistics\n> once every 4th frame) CPU based software-statistics are supposed to\n> only run every 4th frame.\n>\n> And processFrame() already honors this in the sense that endFrame()\n\ns/endFrame/finishFrame/\n\n> call will mark the generated statistics as not valid just like it does\n> when called from debayer_cpu.cpp, which does the statistics line by line\n> rather then calling processFrame().\n>\n> But before marking the statistics as invalid processFrame() still does\n> the actual work of dma-syncing and mapping the input-buffer and then\n> generating the statistics, only to mark them invalid in the end.\n>\n> Remove all the unnecesary work for every 3 of 4 frames by skipping\n> everything and just marking the statistics as not valid right away.\n>\n> Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n\n> ---\n> This should be squashed into \"libcamera: swstats_cpu: Add processFrame()\n> method\" for the next version of the \"[PATCH 00/22] GPUISP precursor series\"\n> ---\n>  src/libcamera/software_isp/swstats_cpu.cpp | 5 +++++\n>  1 file changed, 5 insertions(+)\n>\n> diff --git a/src/libcamera/software_isp/swstats_cpu.cpp b/src/libcamera/software_isp/swstats_cpu.cpp\n> index f5906197..c931edb4 100644\n> --- a/src/libcamera/software_isp/swstats_cpu.cpp\n> +++ b/src/libcamera/software_isp/swstats_cpu.cpp\n> @@ -521,6 +521,11 @@ void SwStatsCpu::processBayerFrame2(MappedFrameBuffer &in)\n>   */\n>  void SwStatsCpu::processFrame(uint32_t frame, uint32_t bufferId, FrameBuffer *input)\n>  {\n> +\tif (frame % kStatPerNumFrames) {\n> +\t\tfinishFrame(frame, bufferId);\n> +\t\treturn;\n> +\t}\n> +\n>  \tbench_.startFrame();\n>  \tstartFrame(frame);","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 E0975C326B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Nov 2025 14:37:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A082760A8B;\n\tMon, 24 Nov 2025 15:37:08 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A81016096B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Nov 2025 15:37:06 +0100 (CET)","from mail-wm1-f72.google.com (mail-wm1-f72.google.com\n\t[209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-482-3G-fjc3DNP-HdHbYTPo6ew-1; Mon, 24 Nov 2025 09:37:02 -0500","by mail-wm1-f72.google.com with SMTP id\n\t5b1f17b1804b1-4779393221aso25367245e9.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Nov 2025 06:37:02 -0800 (PST)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-42cb7fb9022sm28774146f8f.36.2025.11.24.06.36.59\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 24 Nov 2025 06:37:00 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"GphYoU1E\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1763995025;\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\tin-reply-to:in-reply-to:references:references;\n\tbh=HSCqpTxsC/GzEseNJny/xVINibzrAKjwu3cxipLgcrY=;\n\tb=GphYoU1EedUt73/LMZzU4vHmOy6dD+1WEH4Yu83Ccqk+f71jNFeWYOP+6q9L+yYu4+Q+m+\n\tL5PbLLV3RonrIRCLAc1JwP55mt827C8z9WhBiQLW3fxf6C3IputowwvzREBL/9Z5zyvUQM\n\t/DN6BKiEsVlm2d9Xqs7/7Iqgi8umZCU=","X-MC-Unique":"3G-fjc3DNP-HdHbYTPo6ew-1","X-Mimecast-MFC-AGG-ID":"3G-fjc3DNP-HdHbYTPo6ew_1763995021","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1763995021; x=1764599821;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject\n\t:date:message-id:reply-to;\n\tbh=HSCqpTxsC/GzEseNJny/xVINibzrAKjwu3cxipLgcrY=;\n\tb=ki9jHvCMxgk8vTVOj8TvFETYeR7Hm9hF8eTBsbLuK/u2MP0caFOumchA1Qq63ADBhG\n\tIggCN4sjkt6AACrLL5BzapYI3NP8r35KGF8pmSBSK4g6v3OT/tiyfEOQjcR4snIU9x5B\n\teWQ0k2uFvIOveScTZQAl+s7TijHPtc1+MfPLnaGAsoMiHwFHWME6CkK54mxo+XiNT1Cs\n\tKVn2opCn42rKNYyp2TimjSi6/D366+b6ZTon6t7Sq7YATZ4XzpqRJvueZ/KMe5aVzk38\n\twhVCh8ghW+GSVOujHnM9ue985Gqu4QGcUzzrpxz0XTL91NKBmwnFIdFE6RJQ+rq4bFzA\n\t/agA==","X-Gm-Message-State":"AOJu0YzbmmIfOYIaDfhszVTsLSP/Apzy8yrKtc+aF5yVA4M4eHoQLHuo\n\tocaw4dhnf7blFiwJHgZVC3a8rZSYyURl4fIjqcv0eQwG/2LoRn7KVnKYDrwMqeZ7nfe/A3UhdtP\n\tX+B8AhyMBUzMlm+O+GgUJLfUBQXvL2npopE2n0KWSlgfIUXt/jcwmdo9DEuXRirCcTH/SNeMZjO\n\tA=","X-Gm-Gg":"ASbGncshLqW6taezA7OaU/UiD3vMTHX6mLYhs1142U7JtO/ndGRvWbfCpSk2RKPGDdx\n\t+J9WRUWxFHpf48cqMyS4z3ZEQj97IA/If2R1fAD7MdYkwMtz1TSYgw7+fkaRe3QnTB6QFLCrcaE\n\tAVvQLoskMmammn4UOw2djXOkGiZPEkriXJUjuTeoBavNEIvIXr6u5cSHZ7mwMkiFuRvpBhSg4AU\n\tWwdNvJloXPBR4rdaszeGkI/Em1EWjh5wfsdMAU3Pv4AWRKCUlW7FPtm9PU7TAlj4edVeU0aOf/z\n\tCFzv5jiWGqSf1aAjglcA/56a5q7qh9zPEEkXDF8USvvp1RomaNif2GJFK/bPJHguCd1FwlwoHiR\n\tDGukv/wX7+k7Xk1eLMRH7BTjYsi9lECvsR4rnljZEXvqnCxDjLDHLi1oWEUO3ISg=","X-Received":["by 2002:a05:600c:1381:b0:477:994b:dbb8 with SMTP id\n\t5b1f17b1804b1-477c016e7d5mr121286885e9.11.1763995021397; \n\tMon, 24 Nov 2025 06:37:01 -0800 (PST)","by 2002:a05:600c:1381:b0:477:994b:dbb8 with SMTP id\n\t5b1f17b1804b1-477c016e7d5mr121286595e9.11.1763995020976; \n\tMon, 24 Nov 2025 06:37:00 -0800 (PST)"],"X-Google-Smtp-Source":"AGHT+IGvCsKJW68RvvzmGCKt9hYt+xWNCQNw6eCf7vwdQ2hWLZLxgZpYtDfMCqXm1l/zDNLLsSxlQg==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Hans de Goede <johannes.goede@oss.qualcomm.com>","Cc":"libcamera-devel@lists.libcamera.org,  Bryan O'Donoghue\n\t<bryan.odonoghue@linaro.org>","Subject":"Re: [PATCH 1/3] libcamera: swstats_cpu: Stop doing unnecessary work\n\tin processFrame()","In-Reply-To":"<20251122205507.37387-2-johannes.goede@oss.qualcomm.com> (Hans\n\tde Goede's message of \"Sat, 22 Nov 2025 21:55:05 +0100\")","References":"<20251122205507.37387-1-johannes.goede@oss.qualcomm.com>\n\t<20251122205507.37387-2-johannes.goede@oss.qualcomm.com>","Date":"Mon, 24 Nov 2025 15:36:59 +0100","Message-ID":"<851plno5tg.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"3q0i70IeyfYFHlOWH37RbQxTaLj79qDEUjp243UGyp4_1763995021","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","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>"}}]