From patchwork Wed Sep 1 13:59:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siyuan Fan X-Patchwork-Id: 13593 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 AC9FDBD87D for ; Wed, 1 Sep 2021 13:59:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 259026916A; Wed, 1 Sep 2021 15:59:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=foxmail.com header.i=@foxmail.com header.b="aiddnVEC"; dkim-atps=neutral Received: from out203-205-251-60.mail.qq.com (out203-205-251-60.mail.qq.com [203.205.251.60]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7982460288 for ; Wed, 1 Sep 2021 15:59:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1630504752; bh=mj5ewBc4+qS91HqrsPGdASu1I6Ln4Rz8ZYVmEKgbbeI=; h=From:To:Cc:Subject:Date; b=aiddnVECo9fr8mcUiltltiooYYscpD7XfVRINfyHdZrNqTbLLKdTZMUMPmo09FRRe L09M+N83ULGBDKt8NkyGuVSM88X5/28fbhWx+8cgicD1MO2OWWNIClo/d/nV8Kyvi8 7RZotHiOSpKg2tP4AS15ALUDuKACWmgN49SGbMTg= Received: from localhost.localdomain ([123.126.82.10]) by newxmesmtplogicsvrsza8.qq.com (NewEsmtp) with SMTP id ECAA48C4; Wed, 01 Sep 2021 21:59:10 +0800 X-QQ-mid: xmsmtpt1630504750t980clm8h Message-ID: X-QQ-XMAILINFO: NGqlrl/ejBRsvVJIaBNS34SfZ6SYebpxsAYmjpU3cspAbvj2ml11fJ0wsFRbC9 33sVfma27u94xOXvj0tVD0ycQNdAwhkVcW7gADT3tmp8f35Bw93TC9ynAw/jG7sNt+q1NU81/RbJ c/lkswRAAe6ky7nY6hoFvzBZkIONOkHGtiBxMdfZfjylHdhOGsq77loHNjwY4YIHPv8mfC9JWZQs ili758OGJbhaEhr2FP+vurBRvfFwaQr3bj9bRMC0t+o6Qk81b0fkY85vbDq8FH8pJdKPNp51snin R7dA3iJ1V/CXvoT0SulVvdyEJ4kIzOjjWtJoF8eSwCCRvZjk5AJDm/kQ3T21O6/MMOH3wBjQ91wq tvETlwMVgvAAO6tU+QoR1rqV9QCGyJbW9rWJV5ZFOAdF+UewrBMB1YmavnqjsZvAMW8u1bCt1U2U ad5qs8vyzQfL2iWB9ByFy30WmzryjX9UWEVIu8/kRQBZNVU+pwNCJwIXidBTitz/D1GtFC6NR5H8 f43vaV+D7VlQcJ1wcnQ8NVKN7GoA3DVBQtW9c/G9Q2b1lRROI4pqOGtdP9+sSI528pLce8ZxFg0s u1HBASXm4g/QzY8iywXnR/5osJ3Aqj7NgzEIQKmjp78OiTaUCLz6+asGFjVQL9WDeuEd1mHvj04L bAOIg8NKGMXZ0EEHIs2Rs+WdSzhTk8K/gyxvmqwACobVWTDM2Hjei6txgPcS85IzpC+IU2mG2hQb s4XVNid5HtvKZXR99zlzQ4z2kSJH0EfJVG/89YQH2B4JeBxZ7B4iz4nYSdqMDPMnpkInKnlFige4 EiJC8YE6paqowsml809oorwFd/LAEuezwFq3JlzH/MDTnAqgG/GMNtKU44TkiQjb8= From: Siyuan Fan To: libcamera-devel@lists.libcamera.org Date: Wed, 1 Sep 2021 14:59:08 +0100 X-OQ-MSGID: <20210901135908.3116-1-siyuan.fan@foxmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v1] libcamera: isp: Add ISP class 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" From: Fan Siyuan The ISP class is a abstract base class of software ISP. It includes image format configuration, ISP algorithm parameters parser, pixel processing image export and thread configuration. This new class will be used as the basic class for ISPCPU and ISPGPU. Signed-off-by: Fan Siyuan --- ISP Parameters Tuning is a important part, so I've designed a parameters parser in order that users can call any algorithm combination by passing any number of tuple. Each tuple format is including algorithm name string and algorithm param, such as tuple for black level correct. Currently this function is only a demo. I'm thus sending it as an RFC. --- include/libcamera/internal/isp.h | 67 ++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 include/libcamera/internal/isp.h diff --git a/include/libcamera/internal/isp.h b/include/libcamera/internal/isp.h new file mode 100644 index 00000000..caab7050 --- /dev/null +++ b/include/libcamera/internal/isp.h @@ -0,0 +1,67 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2021, Siyuan Fan + * + * isp.h - The software ISP abstract base class + */ +#ifndef __LIBCAMERA_INTERNAL_ISP_H__ +#define __LIBCAMERA_INTERNAL_ISP_H__ + +#include +#include +#include + +#include +#include +#include +#include + +#include "libcamera/base/object.h" +#include "libcamera/base/signal.h" + +namespace libcamera{ + +class ISP : public Object +{ +public: + ISP() {} + + virtual ~ISP() {} + + template + void for_each_in_tuple(const std::tuple & tuple, F func, std::index_sequence) { + + return (void(func(std::get(tuple))), ...); + } + + template + void for_each_in_tuple(const std::tuple & tuple, F func) { + for_each_in_tuple(tuple, func, std::make_index_sequence()); + } + + template + void parse(const T &head, const Args &... rest) + { + for_each_in_tuple(head, [&](const auto &x) { + // parse parameters for diff algorithm + }); + } + + virtual int configure(PixelFormat inputFormat, PixelFormat outputFormat, Size inputSize, Size outputSize) = 0; + + virtual void processing(FrameBuffer *srcBuffer, FrameBuffer *dstBuffer, + int width, int height) = 0; + + virtual int exportBuffers(std::vector> *buffers, + unsigned int count, int width, int height) = 0; + + virtual void start() = 0; + + virtual void stop() = 0; + + Signal ispCompleted; +}; + +} /* namespace libcamera */ + +#endif /* __LIBCAMERA_INTERNAL_ISP_H__ */