From patchwork Wed Dec 10 16:15:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 25465 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 2EF4BC3257 for ; Wed, 10 Dec 2025 16:41:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D2EDE614AE; Wed, 10 Dec 2025 17:41:00 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="VRXWqLaj"; dkim-atps=neutral Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 853E861499 for ; Wed, 10 Dec 2025 17:40:58 +0100 (CET) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-47774d3536dso305985e9.0 for ; Wed, 10 Dec 2025 08:40:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1765384858; x=1765989658; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=f3HOiwIt2OHTsUbF9Zbu4yyPAVqXezMP7iZdr11Hqd8=; b=VRXWqLajf93zgFeCKZWVE9PF+/GSr07O3ulsGmf7hY7TLGwdj+w8MhUQaNLJ7u/Ucf VoOjW7ZlPodj6RbHuJCIPwi9r25pqmyPD0gpfsAGvVe0ufpJLvCg1PK5kjtoYPDfxJJs NcnY+fvd+GrgcGsJnAOBVcgWVVDMLUskKphhGPuULZhUOu5pKC6S4Hc8Q6YIZUHvJxsL 2QuQVUoSXhrMrAFNk1FCUlLeFQXnozevytVrdcykYAzs2VnhkNhedoilQbFVSk9qW2Mj 8RwR3Loe4nboj5vtFhYWSqpmc4OR/WfBgU+YLpDO4LGUO7eFjqp1rjQ/5xJTOYrmv5oE NTJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765384858; x=1765989658; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=f3HOiwIt2OHTsUbF9Zbu4yyPAVqXezMP7iZdr11Hqd8=; b=BAAQ4mHYohiPmSq0sP29z6PoUjNHJh5Zb10Pb+41/6RNlYg14xFoPwuoDBxSN2XaWf 1BBiVj71FZbzwIwh8PdLVlQOElQWJtLv2WPVcuZTY5lLgaz7O8bcbHTz7xQGA7+t/2fD Fk71SetcpWj7yfXYYPs3JVDokt95gucKBnx5m2IcLDtVzyk7bHVnwYNoJTZVVXAENXXA oYEpbxPT4YiAY/0/XRYNbIFU4v7ulPBkWSBiM1xeLtH12WSLs5/C3iPzeEGhlLTmczTH gUHZz+rdxKVXTvVhQTTLM10EXNpsuxsQvdBdJu1Xjsf7jRWyBn6qs1GMdKCq86WJYvmD RXEw== X-Gm-Message-State: AOJu0YyWsLIk5SH8YursqTn/YXnqn5XmGwjFKBRqu43z14+hJQhaxPW6 51LuaIhDrbRwKY82A6WSfrvVBolmRgtsLRObab8iW3fxSLL8V1rRiihHLIMQzUQ4itMMBae5kE3 MZxc0 X-Gm-Gg: ASbGnctplYdrhIHT0fn1eaGTaPCFkL79H9uT4RBGcllsiLTFgXbTT7CE5CXnoX67omh Y8x0bjVLG9w7tRhPxrwcemwTV0rOIqmhIQ5y/NZtahG4evFCDlG35JZKccrI+YphYsivGdh5u92 RomSzV1gt1pKUjarUZyFB9PHX2dxeOCp8Y7K7aN4eI2f+tlwKZ+lClqAnR+FazghgMs4s1cwvNv npIDfHNN4Rde/3Nw9KV/IUeS4Rr0cjukaQcDrsXhtR5TYpurSQuFO5qPO214CsJb6L/ZaVWdZMS j9iZxmdWXNW8cRoSQvThtAH+BfnzoG6YWN5bFILsIvzUn31UxjFDjsE7BKCdwnTo1O8U0ZLlcUt FvLi8xqYYUWmdM1uc2iuoR2ju3KleJSvcnLLAXXbFW6wCni/FDvefyz92MqcASp2Dfacph1i08R 7Cf6tYSwoyyRaXJ5eS9e3JlcX6CplBPN0lNKEGrE7QjNfBlBkpACCxoXaHVwf6s4O6marZbnEye dOGv5nO81Lhv2+YzVMSpRNQ+nsDtzc/n6GTpry0 X-Google-Smtp-Source: AGHT+IFIYIINvjgXZ37FvpOTz7H940OcOPXVLhiQOg5nrWUqH87p3Vu/ClzW/vRM2gcLKeFPBPPHAw== X-Received: by 2002:a05:600c:4f53:b0:471:5c0:94fc with SMTP id 5b1f17b1804b1-47a886c6169mr443475e9.6.1765384857755; Wed, 10 Dec 2025 08:40:57 -0800 (PST) Received: from davidp-pi5.pitowers.org ([2a00:1098:3142:1f:88ea:c658:5b20:5e46]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47a88371e13sm1270415e9.11.2025.12.10.08.40.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Dec 2025 08:40:57 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org Cc: David Plowman Subject: [PATCH 00/11] Bayer re-processing Date: Wed, 10 Dec 2025 16:15:15 +0000 Message-ID: <20251210164055.17856-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 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 everyone As I mentioned to some of you last week, I'm keen actually to make some more progress with Bayer re-processing, with a view to it becoming a bona fide feature. So here it is again, this time as a regular "PATCH" rather than an "RFC". The changes over the RFC version are only minor. Apart from a rebase, a couple of things have been fixed, and a couple of things slightly adjusted in relatively minor ways. But the gist of it is the same. Therefore we have: * A "memory camera" that is the gateway to Bayer re-processing. These are made on demand rather than at startup. It's possible that a pipeline handler could supprt any number of "memory cameras" (or none). A memory camera has to be passed something that tells it how to reprocess the image. * There are now "input streams", and a camera configuration can have a "raw input stream" which supplies the buffer to be re-processed. * The Raspberry Pi pipeline handler handles these configurations correctly. As before, if anyone wants to try it out, there's a working branch here: https://github.com/davidplowman/libcamera/tree/reprocessing and a demo program that converts a DNG to a JPEG, in the most lightningest speed you have ever witnessed, here: https:://github.com/davidplowman/libcamera-apps/blob/reprocessing/apps/rpicam_convert.cpp Looking foward to everyone's feedback. Thanks! David David Plowman (11): libcamera: Infrastructure to ask for "memory" cameras libcamera: Add a direction (input or output) to the stream configuration libcamera: sensor: Add CameraSensorMemory class pipeline: rpi: Add PipelineHandlerBase::bayerToMbusCode ipa: rpi: cam_helper: Add CamHelperDefault class libcamera: pipeline: rpi: Allow creation of the first "memory" camera pipeline: rpi: Allow generation of raw input configurations libcamera: Don't wait for input streams to complete ipa: rpi: Support memory cameras pipeline: rpi: Support memory cameras pipline: rpi: Support memory cameras processing requests include/libcamera/camera_manager.h | 4 + include/libcamera/internal/camera_manager.h | 5 + include/libcamera/internal/camera_sensor.h | 2 + .../libcamera/internal/camera_sensor_memory.h | 110 ++++ include/libcamera/internal/meson.build | 1 + include/libcamera/internal/pipeline_handler.h | 8 + include/libcamera/stream.h | 10 + src/ipa/rpi/cam_helper/cam_helper_default.cpp | 45 ++ src/ipa/rpi/cam_helper/meson.build | 1 + src/ipa/rpi/common/ipa_base.cpp | 135 +++-- src/ipa/rpi/common/ipa_base.h | 5 + src/libcamera/camera_manager.cpp | 64 +++ .../pipeline/rpi/common/pipeline_base.cpp | 144 +++++- .../pipeline/rpi/common/pipeline_base.h | 6 +- src/libcamera/pipeline/rpi/pisp/pisp.cpp | 471 ++++++++++++------ src/libcamera/pipeline_handler.cpp | 23 + src/libcamera/request.cpp | 4 +- src/libcamera/sensor/camera_sensor_memory.cpp | 241 +++++++++ src/libcamera/sensor/meson.build | 1 + src/libcamera/stream.cpp | 6 +- 20 files changed, 1084 insertions(+), 202 deletions(-) create mode 100644 include/libcamera/internal/camera_sensor_memory.h create mode 100644 src/ipa/rpi/cam_helper/cam_helper_default.cpp create mode 100644 src/libcamera/sensor/camera_sensor_memory.cpp