From patchwork Wed Oct 9 20:01:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 21571 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 85A66C32DE for ; Wed, 9 Oct 2024 20:01:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8B1DF63538; Wed, 9 Oct 2024 22:01:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="YyimiAIp"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 33008618C5 for ; Wed, 9 Oct 2024 22:01:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728504075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HSfuuPk+v3JhOrl08+A970gSoAPohpPGYgXFJ5VtFJw=; b=YyimiAIpdeijD8VhOX/YS9OZZ1iWoLJkplyvzWzyMX6eUWKQ2byssSHlpp3fXkxfH4cgRb d0XgjsLWgbNimkqnR4n8TqUvZ603wPnAmoJ5j217lVsudE2X1i+mY1NRH+ub+nnJ8tp1d+ x/BVPUNKJaFGsEES0JQgRo3vfDH79Ms= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-616-03ofAUpPNU6GE9Nwn9P_9A-1; Wed, 09 Oct 2024 16:01:13 -0400 X-MC-Unique: 03ofAUpPNU6GE9Nwn9P_9A-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0F2601955F45 for ; Wed, 9 Oct 2024 20:01:13 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.36]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9F3C019560A3; Wed, 9 Oct 2024 20:01:11 +0000 (UTC) From: Hans de Goede To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Maxime Ripard , Hans de Goede Subject: [RFC 0/4] libcamera: swstats_cpu: Add processFrame() method Date: Wed, 9 Oct 2024 22:01:06 +0200 Message-ID: <20241009200110.275544-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hi All, Here is a patch series adding a processFrame() method to gather statistics on an entire frame in one go, rather then using the line by line approach which is used by the somewhat tightly coupled DebayerCpu class. ATM there are no users for processFrame() yet, so the code is compile tested only which is why it is marked as RFC. I see at least 3 possible use-cases for this: 1. Gathering sw statistics for 3A on raw bayer buffers before passing them along for a to-be-added software CPU ISP raw mode. 2. Gathering sw statistics for 3A on raw bayer buffers before doing further processing on the GPU for the software GPU ISP (possibly as an intermediate step until the stats are gathered on the GPU too and/or as a way to compare CPU vs GPU stats for verification purposes). 3. I'm working on a pipeline handler for the atomISP2, where there is a working hw ISP but no usable statistics. The plan is to gather sw statistics on the output buffers (so on e.g. YUV images) and then re-use the 3A code from the software ISP (I realize gathering statistics on the pipeline output buffers is not ideal, but the atomISP driver has no way to access the raw bayer data). Usage would look something like this: once: if (stats_->configure(inputCfg) != 0) return -EINVAL; stats_->setWindow(Rectangle(window_.size())); per frame: stats_->startFrame(); stats_->processFrame(inputFrameBuffer); stats_->finishFrame(frameNo, bufferID); Regards, Hans Hans de Goede (4): libcamera: swstats_cpu: Update statsProcessFn() / processLine0() documentation libcamera: swstats_cpu: Drop patternSize_ documentation libcamera: software_isp: Move benchmark code to its own class libcamera: swstats_cpu: Add processFrame() method src/libcamera/software_isp/benchmark.cpp | 78 +++++++++++++++ src/libcamera/software_isp/benchmark.h | 36 +++++++ src/libcamera/software_isp/debayer_cpu.cpp | 32 +----- src/libcamera/software_isp/debayer_cpu.h | 7 +- src/libcamera/software_isp/meson.build | 1 + src/libcamera/software_isp/swstats_cpu.cpp | 108 +++++++++++++++++---- src/libcamera/software_isp/swstats_cpu.h | 10 ++ 7 files changed, 216 insertions(+), 56 deletions(-) create mode 100644 src/libcamera/software_isp/benchmark.cpp create mode 100644 src/libcamera/software_isp/benchmark.h