From patchwork Thu Dec 14 21:44:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Machek X-Patchwork-Id: 19329 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 9005DC31E9 for ; Thu, 14 Dec 2023 21:44:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 01B6C62B33; Thu, 14 Dec 2023 22:44:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1702590246; bh=FSTKHY0MpRYh7uxhKCX1jkAIPhqUlWILUtdbayQzAqc=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=EYdbNHWEc2FHz905KVkSIps7R8V295gTcnNMbIQ12eDIBqH1yES4/TzOBel2jcOnk i1X7G/q4WEjFCeNitfMbU5AbdZU0OfxLmlj3rVqX0SI4R5HxyXx7O8f+RZNYlYKgCO Z/m8zYCONyxTR+yQtjPGzex4fJOq2jl7YqMhlq2wjUGWn7cbjrkNZyS9EjYJEgD5Eu 4VXZ+O02Z0Kye3hgfhCv5f06OJ0GtckDuEJm7t0JUGenXAar/EbqjWW5vnXTOe4wzR 74isie3pzvzBdQ7wLALr5qBOFIpYUsL5jKLIbicABoHAiRbdb3bdUwVDxif9XutCjf F9A+3M0wb2noA== Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AD79262B2A for ; Thu, 14 Dec 2023 22:44:04 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ucw.cz header.i=@ucw.cz header.b="L65vHTnq"; dkim-atps=neutral Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 6BC671C006F; Thu, 14 Dec 2023 22:44:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1702590244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nuhJDBE+W9kIUHejbUaJVGkzakdeuq2jjjmDYtW8FT4=; b=L65vHTnqLC/91YHLPKkgqxjujqj1rIhTeSPoYSWpJrsOZrrSFa9+nzsSMxmhBPjY7HxN5Y /vdRnE9WPhmdsJjLbAEtdqLL5ethLaQM9J9Q+VHW2xr44IDNA0Rhyls0w012oG0aeQTpCS u/43TKJQHe+2/wAFnzwna01odi6MQP0= Date: Thu, 14 Dec 2023 22:44:03 +0100 To: hdegoede@redhat.com, libcamera-devel@lists.libcamera.org Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Subject: [libcamera-devel] swisp performance notes was Re: [RFC] Add 8-bit bayer support. 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: , X-Patchwork-Original-From: Pavel Machek via libcamera-devel From: Pavel Machek Reply-To: Pavel Machek Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hi! So... For some reason latest version uses full sensor resolution. That gave me 0.1 fps. If I copy image to cached memory (like below), I get ~1 fps with -O0, and ~4 fps with optimalizations. (On pinephone). [9:26:04.598819548] [22455] INFO Camera camera.cpp:1183 configuring streams: (0) 2584x1940-RGB888 cam0: Capture until user interrupts by SIGINT copy...5038848 process... copy...5038848 33967.480079 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 15038880 process... copy...5038848 33967.652354 (5.80 fps) cam0-stream0 seq: 000001 bytesused: 15038880 process... copy...5038848 33968.685997 (0.97 fps) cam0-stream0 seq: 000007 bytesused: 15038880 You may want to check if caching works for you. (Adjust that 7000.. number.) Best regards, Pavel commit 190d351eb3158c7d5f1eddd81b0a2aeedffaef9c Author: Pavel Machek Date: Thu Dec 14 21:58:26 2023 +0100 Copy image to cached memory. This gives me more than 10x performance improvement. diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp index 52910a03..0b4bf7ff 100644 --- a/src/libcamera/software_isp/debayer_cpu.cpp +++ b/src/libcamera/software_isp/debayer_cpu.cpp @@ -483,10 +483,27 @@ void DebayerCpu::process(FrameBuffer *input, FrameBuffer *output, DebayerParams return; } + const uint8_t *uncached_src = in.planes()[0].data(); + static uint8_t src[7000000]; + unsigned long size = in.planes()[0].size(); + if (size%8) + printf("very bad size!\n"); + + printf("copy...%ld\n", size); + (void) uncached_src; + if (1) { + unsigned int i; + for (i=0; i