[{"id":38218,"web_url":"https://patchwork.libcamera.org/comment/38218/","msgid":"<85zf579h3o.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2026-02-17T21:48:27","subject":"Re: [PATCH 4/5] software_isp: debayer_cpu: Select process inner\n\tloop by function pointer","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> At a processInner_ function pointer and set this to process2() /\n\ns/At/Add/\n\n> process4() in configure instead of making the choise inline in process().\n\ns/choise/choice/\n\n> This is a preparation patch for making DebayerCpu support multi-threading.\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n\n> Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>\n> ---\n>  src/libcamera/software_isp/debayer_cpu.cpp | 10 ++++++----\n>  src/libcamera/software_isp/debayer_cpu.h   |  4 ++++\n>  2 files changed, 10 insertions(+), 4 deletions(-)\n>\n> diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp\n> index e1d3c164..5e168554 100644\n> --- a/src/libcamera/software_isp/debayer_cpu.cpp\n> +++ b/src/libcamera/software_isp/debayer_cpu.cpp\n> @@ -437,6 +437,11 @@ int DebayerCpu::setDebayerFunctions(PixelFormat inputFormat,\n>  \t\treturn invalidFmt();\n>  \t}\n>  \n> +\tif (inputConfig_.patternSize.height == 2)\n> +\t\tprocessInner_ = &DebayerCpu::process2;\n> +\telse\n> +\t\tprocessInner_ = &DebayerCpu::process4;\n> +\n>  \tif ((bayerFormat.bitDepth == 8 || bayerFormat.bitDepth == 10 || bayerFormat.bitDepth == 12) &&\n>  \t    bayerFormat.packing == BayerFormat::Packing::None &&\n>  \t    isStandardBayerOrder(bayerFormat.order)) {\n> @@ -890,10 +895,7 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output\n>  \n>  \tthreadData_[0].yStart = 0;\n>  \tthreadData_[0].yEnd = window_.height;\n> -\tif (inputConfig_.patternSize.height == 2)\n> -\t\tprocess2(frame, in.planes()[0].data(), out.planes()[0].data(), &threadData_[0]);\n> -\telse\n> -\t\tprocess4(frame, in.planes()[0].data(), out.planes()[0].data(), &threadData_[0]);\n> +\t(this->*processInner_)(frame, in.planes()[0].data(), out.planes()[0].data(), &threadData_[0]);\n>  \n>  \tmetadata.planes()[0].bytesused = out.planes()[0].size();\n>  \n> diff --git a/src/libcamera/software_isp/debayer_cpu.h b/src/libcamera/software_isp/debayer_cpu.h\n> index a54418dc..b85dd11c 100644\n> --- a/src/libcamera/software_isp/debayer_cpu.h\n> +++ b/src/libcamera/software_isp/debayer_cpu.h\n> @@ -87,6 +87,9 @@ private:\n>  \t\tbool processLastLinesSeperately;\n>  \t};\n>  \n> +\tusing processFn = void (DebayerCpu::*)(uint32_t frame, const uint8_t *src, uint8_t *dst,\n> +\t\t\t\t\t       DebayerCpuThreadData *threadData);\n> +\n>  \t/* 8-bit raw bayer format */\n>  \ttemplate<bool addAlphaByte, bool ccmEnabled>\n>  \tvoid debayer8_BGBG_BGR888(uint8_t *dst, const uint8_t *src[]);\n> @@ -164,6 +167,7 @@ private:\n>  \tunsigned int threadCount_;\n>  \tbool ccmEnabled_;\n>  \tDebayerParams params_;\n> +\tprocessFn processInner_;\n>  };\n>  \n>  } /* namespace libcamera */","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 A87C1C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 Feb 2026 21:48:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DA6A562210;\n\tTue, 17 Feb 2026 22:48:34 +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 AA6E361FA0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Feb 2026 22:48:33 +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-144-6Cq5jJlzOiKXOnYpSnV73g-1; Tue, 17 Feb 2026 16:48:31 -0500","by mail-wm1-f72.google.com with SMTP id\n\t5b1f17b1804b1-4836bf1a920so53994345e9.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Feb 2026 13:48:31 -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-43796a5ac87sm40088476f8f.3.2026.02.17.13.48.28\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 17 Feb 2026 13:48:28 -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=\"e4n5FJvj\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1771364912;\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=S4REPdFAtRgG3vrfD8+rantTQYXu9ffRMKDxK2ecpgI=;\n\tb=e4n5FJvjX+ASLRaqNE5XrnxWAIYEUPaYkXiUBZbfp3r7Q3R/l9wC9fDrLFGD5dN6jRC4zo\n\tj7Z05ljsleynwAiGsgvamubZplQfmCXw9mg2BC7yewNzVNM3gX2zLNQBIkECnhEeGByKXd\n\tgqjQ4WGkvD6Fq4lhVB40/xP3NP4WYEY=","X-MC-Unique":"6Cq5jJlzOiKXOnYpSnV73g-1","X-Mimecast-MFC-AGG-ID":"6Cq5jJlzOiKXOnYpSnV73g_1771364910","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1771364909; x=1771969709;\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=S4REPdFAtRgG3vrfD8+rantTQYXu9ffRMKDxK2ecpgI=;\n\tb=xONvU4D7SmO5VFV47D8jpJ0mvjHzGZEzmUN6IhBVqzILlG5QSR8CqY+BQRbbscZB2L\n\tbdjwKKEI9wZljgvYgewSg5RhW+b4XNtnYdMiPeA0IOqJzmSX9xCmPsm6P3sFcVsIjNuB\n\tdNM6x+6tUAaj29Z3+GsmguYY1IyTqly7WDPrXvkNauKC0EcmKK9MWYrvjZ0BhEF/6Pfz\n\t5Tw569pAu2x2hploiQi8T5ECrMnfpBIMfa5WbnOx9dNf9rm0nw0DBvoqmZJwe+1Tcack\n\tc/QH1WHZVDszl0USydAh7+HOLLwjDkJLFQUAxvgWubHWzJWZHpKuRQfOX6I2GyfIz99z\n\t2MNw==","X-Gm-Message-State":"AOJu0YzZQktcpX5Kx5X5CAfJ3pRGaMZqpwawlGv1xyk+8DDxs3KOTmBn\n\tr18ROuYf3hkhsAcF+9A7jNQd9DHo3XVzHA18OqnIRlJT3bw3iot9K89ufSjqfh3G7tICLlbO8n+\n\tnlNUGAxpwutL7FFb6ujwhC2Oh9c9545Yl14QRYusMBr8JmCyZ+RjReun5de6RLM1yA7P2D3hX3G\n\to2aaMrIKSm1aYQkzxyZN08nor/iRjSt6nel5+C7x5f+d64mgtaVImJfvL5d50=","X-Gm-Gg":"AZuq6aI7DxPTKZAGVIUrM+xYUUKwPxE1lKDRZLKzRVS56Cq5KKK5hmjJ3SELsN6bIdm\n\tzyeNnpXuVld6QEQL7cLofA59WPD2XxeCC39EDrvsrx7LU2UtqjSCiHJCmXS1qQfiLTbQ9p39u28\n\tw9FC8PFkDwlk0ERXU1Aujfg9pAolkti1HxNAltQQp9z6SUc9x5iFfHxljXPizltV4vgeeWYl2xF\n\tvXQ1ah7FpYS7z8ImWEsrTGEOf7IPf4a0W/vYMS1eA3xtkh8OzL8cnqOQqa5Z90vAXPxKzZVgaiU\n\tUQxe3l0q+hZVuWOTV4eMtb+SK+ixZwlSWElAA5JFHzwU2OhuKKEGVX3F3QQIqm4GUl1X0R/TTZc\n\tDEnnxnwrAqiS9HsRTg6ewq+GBC2pcKEzlVunFcuLDbbuo6krzDyjMO5aat9Obffj/zdlH5OnvXZ\n\t8=","X-Received":["by 2002:a05:6000:186f:b0:436:1b1:6cbb with SMTP id\n\tffacd0b85a97d-4379db30f9bmr19588153f8f.7.1771364909530; \n\tTue, 17 Feb 2026 13:48:29 -0800 (PST)","by 2002:a05:6000:186f:b0:436:1b1:6cbb with SMTP id\n\tffacd0b85a97d-4379db30f9bmr19588123f8f.7.1771364908988; \n\tTue, 17 Feb 2026 13:48:28 -0800 (PST)"],"From":"Milan Zamazal <mzamazal@redhat.com>","To":"Hans de Goede <johannes.goede@oss.qualcomm.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH 4/5] software_isp: debayer_cpu: Select process inner\n\tloop by function pointer","In-Reply-To":"<20260216190204.106922-5-johannes.goede@oss.qualcomm.com> (Hans\n\tde Goede's message of \"Mon, 16 Feb 2026 20:02:03 +0100\")","References":"<20260216190204.106922-1-johannes.goede@oss.qualcomm.com>\n\t<20260216190204.106922-5-johannes.goede@oss.qualcomm.com>","Date":"Tue, 17 Feb 2026 22:48:27 +0100","Message-ID":"<85zf579h3o.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":"6eSCt9gdfgZ1GqD29SNGZrWcj3Rwt0EqLcXSc3XFTXU_1771364910","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>"}}]