From patchwork Tue Sep 8 15:07:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 9543 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 D5E3ABDB1C for ; Tue, 8 Sep 2020 15:08:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5FE9262C37; Tue, 8 Sep 2020 17:08:03 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ZacsSwDf"; dkim-atps=neutral Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1E7526037B for ; Tue, 8 Sep 2020 17:08:02 +0200 (CEST) Received: by mail-lj1-x243.google.com with SMTP id a22so14100008ljp.13 for ; Tue, 08 Sep 2020 08:08:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=n0wjUziJZ5FcNtxneyRZMZpps6ybhlMk3uks+yg213s=; b=ZacsSwDf6j+Ry5zTXSZoB3WgL0RG0XeNyRqktOQIpHfHalt6fiul+AJ5x/R0Mwz+c6 2QJ4s94R3yI83V1KcgvHlYeV7o6uSXsBNqkHYJs/FVbbFrPv1ack/uqobjvMshPnjt+F 5zWVhrGcdbnUQ+v88vIjR3Ckdk/aqYaFkHlCgqDRGAdiausDVdt+LwOx819kc0ruKft9 PAPdkakbcUqR+CXmDUKKwGxoEY3+hCSH+sgCdttK9EFm0ciLtVMFyLbtpdgqAZBg23ZS X9Wrsl9RLUoNFlHZYjNr52gucShyrIRx5utp2upw9vrIHqlpK+W/p9FbViNTi8lS3aif 4SCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=n0wjUziJZ5FcNtxneyRZMZpps6ybhlMk3uks+yg213s=; b=tqCtjy0zRwCqbOn+Uz1j37aON6JzDTMwx/Rhsuo9Ti8hSJdMV8u9BF+usnFkyXXge7 iwOToEUjqHAkG1U4u0Cfflk1G/CPnoQ6RH6xciGA2jJjk5UJFEMkqHsf1uL5DIEC8RpM ENeCgJ5W2hxjCiHeEWZyT7CoNKtcoiAVDdiRxgDAMh48haD7XZSm3rWOl8fo0ptRuP/4 6FMwcGjriW0mN0XkmGhGXiOHYQTPjsxqJA7U5LXnQ7NT8RjdJpioIgsYl5t9RokToC08 WVXvS497pP9eKYBVi8HlaIAnFZW322yuthZRnAI/o+uuO2oMRbGaGpXmP65uxvrHZNrx XFIg== X-Gm-Message-State: AOAM531VXLP2xZur8rArFHEKSaR0kSySyZ2Ou7geN4t0YeJ2WrVPq71N 9KL2WC+jILmUvYAZ9Lks/24yjVVni+wjsg== X-Google-Smtp-Source: ABdhPJwvL38nt/HmapREJFnyc//juHDfw8NR8AYC5I4Ouo0cZKURcRdWYoOsdxk7M16VDWy7iI0+vA== X-Received: by 2002:a2e:9690:: with SMTP id q16mr12265071lji.401.1599577681037; Tue, 08 Sep 2020 08:08:01 -0700 (PDT) Received: from localhost.localdomain (37-144-159-139.broadband.corbina.ru. [37.144.159.139]) by smtp.googlemail.com with ESMTPSA id f19sm10614121lfs.85.2020.09.08.08.07.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 08:08:00 -0700 (PDT) From: Andrey Konovalov To: libcamera-devel@lists.libcamera.org Date: Tue, 8 Sep 2020 18:07:37 +0300 Message-Id: <20200908150739.1552-1-andrey.konovalov@linaro.org> X-Mailer: git-send-email 2.17.1 Subject: [libcamera-devel] [RFC PATCH v2 0/2] qcam: format_converter: add 10 and 12 bit packed raw Bayer formats 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: , MIME-Version: 1.0 Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This is a simple implementation of de-bayering in software. 10 and 12 bit packed raw Bayer formats are supported. No interpolation is used to get more speed by the price of lower image quality. In qcam this conversion is used for viewfinder only, so lower lag is more important than the image quality. Only SRGGB10P and SRGGB12P formats were tested (the ones I can get from the camera sensor I am currently using). On DragonBoard410c, at 1920x1080 resolution the average frame rate printed by qcam is about 12.3 fps for SRGGB12P, and is about 13.4 fps for SRGGB10P. Changes in v2: * new patch added to put the different configurations into params_ union * calculation of the offsets of the color values in the src buffer moved from the convert function to configure(). So that this calculation is done at configure time vs per every frame in v1. The number of RAW Bayer CSI2P parameters in params_ increased to store the precomputed values * in the configure() method the check if width_ and height_ are both even numbers is added. If this is not the case, -EINVAL is returned, and the warning message is printed * when converting the square of 2x2 bayer pixels (one red, one blue, and two green pixels) into four BGRA pixels, the green value is now the average of two green bayer components. Using the average vs one green value for even raw, and the other green value for the odd raw makes the "saw" pattern on vertical borders less noticeable. That said, all the four BGRA pixels use the same color values now * An attempt to consolidate writes to the destination buffer is made. This (and the odd lines in the destination buffer being the same as the preceding even ones in v2) increased the fps by 40% to 50% compared to v1 * s_linelen replaced with srcLineLength, d_linelen - with dstLineLength * convertRAW_CSI2P() renamed to convertRawCSI2P() Andrey Konovalov (2): qcam: format_converter: put parameters of different formats into union qcam: format_converter: add 10 and 12 bit packed raw Bayer formats src/qcam/format_converter.cpp | 271 ++++++++++++++++++++++++++-------- src/qcam/format_converter.h | 54 +++++-- 2 files changed, 249 insertions(+), 76 deletions(-)