From patchwork Fri Jan 1 17:15:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10799 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 81C38C0F1A for ; Fri, 1 Jan 2021 17:16:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F2650615B2; Fri, 1 Jan 2021 18:16:13 +0100 (CET) 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="NtjkDHc4"; dkim-atps=neutral Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 543596031C for ; Fri, 1 Jan 2021 18:16:13 +0100 (CET) Received: by mail-lf1-x12a.google.com with SMTP id b26so49837019lff.9 for ; Fri, 01 Jan 2021 09:16:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=zl1jWQjim1pjOblc626hSjE6WaIhbGtD16AJxJ6GaLU=; b=NtjkDHc4qS/RZnBPHv1r/E8CCVjhQHsrhujUGBS4O2gAKjG9Yc8rhUbUTeYqG+Q3Z5 182S9IyZnwPH6e7Z1/Iu1xb+L58i8z/buHnwAHfo7/F2NKwsdyLBZ//94wSHMI2Ma/6g R0V/jffpojRcbRb6Pxd2hbzFOK2MPPMFilCjEn0Do4zlPcGLXkaNv2BPSgqUhXyMQSXX IFm+aytvbziQJTBL4HX6QkUA6RybIVaV8AXpVmSOFuYOkjSXIhVv3OGV+tCiC1ismH86 5EmVe5KtvbCgTituRvpK9EUdK3sR0uyIbr3l04zajvnM8aM6s/JHnr62i0hlDc4BlWCv 0Sug== 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=zl1jWQjim1pjOblc626hSjE6WaIhbGtD16AJxJ6GaLU=; b=pYkSYIfhmO3AIvxKhvUyasZq/ddomKaX2i9vHXitora1rqCh94mAdUXnimjI8xIU/O YfJTWewH++X15QmbCjOZj6BFy9Qz8Qbrw/Si7erQDAlOFSrB3mWleHt+T3uF+MJghXMH gNiKXl3JL3tOIG2573dFEqeeH6FQ1RWBXsWaG6Xn2X6G3Wt0BNOLHkh9+GnhGL63KijS 3/FurxmqMa9fqyxduzf3bYSkWbC1BG/SE5ozd8sJOKWfsUHWV9rnRwp66rdNYW8GKIy1 cLgxd6dl7kg51Y8YGOhzFLb46h8LIIDAEn2IodkEXoEFtPyWmfvUSTcdkdEFaXw+LyOL k2YQ== X-Gm-Message-State: AOAM531vVaLPDs1GoFsLOjELIxQ70KVu6OAZL92l+fSwoxCyvGQDuu3q sh2aoA7RLZP1rDPXxAiTY8kvfvPrm99amwxO X-Google-Smtp-Source: ABdhPJx4xKMLuN0unIkCE2tc9/5acW3ExFE6FI3RXjXVh9+eo+f/jLHVNTFvmp+xbzQMkmHcMrw2xg== X-Received: by 2002:a19:c711:: with SMTP id x17mr22052983lff.56.1609521372144; Fri, 01 Jan 2021 09:16:12 -0800 (PST) Received: from localhost.localdomain ([85.249.43.69]) by smtp.googlemail.com with ESMTPSA id m12sm7873213lji.110.2021.01.01.09.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jan 2021 09:16:11 -0800 (PST) From: Andrey Konovalov To: libcamera-devel@lists.libcamera.org, laurent.pinchart@ideasonboard.com Date: Fri, 1 Jan 2021 20:15:51 +0300 Message-Id: <20210101171553.32727-1-andrey.konovalov@linaro.org> X-Mailer: git-send-email 2.17.1 Subject: [libcamera-devel] [PATCH][RFC v2 0/2] qcam: viewfinder_gl: add RAW12P format 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: , Cc: morgan@casual-effects.com MIME-Version: 1.0 Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This patchset adds support for OpenGL accelerated conversion from 12-bit packed raw Bayer format (debyering). All the 4 pixel layouts are supported, but only the RGGB one was tested. The lower 4 bits of the 12-bit colour values are discarded as the target RGBA format has only 8 bits per colour. Changes in v2 vs v1 [1]: * Most of the review comments are addressed. In particular: * comments explaining the calculations in the shader are added * textureUniformY_ is reused in the same way as RGB formats do * uniforms are renamed to follow the common pattern * the existing float tex_stepx is extended to vec2 tex_step and is used in both YUV_packed and bayer_12_packed shaders * firstRed_ type changed to QPointF * NOT CHANGED: the center is still vec4, and [xy]coords are still vec2. The reason is that I'd like to keep them in the same form as in the original code [2] - I still consider moving from the current bilinear to the MHC filter implemented in [2] someday. * The shader code is reworked to address the issue with the garbage due to scaling the image from the captured size to the viewfinder window size. With v1 one could see something like [3], and in v2 this is fixed [4]. For this all the processing is moved to the fragment shader, so that the hardware interpolators don't have the effect (the price is increased GPU load). [PATCH][RFC 1/2] "qcam: viewfinder_gl: set the vertex shader file name in selectFormat()" is dropped as the common identity vertex shader is used in v2. * The header in the fragment shader is updated to refer to the work [2] this shader is based on. The license is adjusted accordingly. [1] https://lists.libcamera.org/pipermail/libcamera-devel/2020-November/014893.html [2] https://casual-effects.com/research/McGuire2009Bayer/index.html [3] https://people.linaro.org/~andrey.konovalov/qcam-vf_gl-raw12p/v1_maximized.bmp [4] https://people.linaro.org/~andrey.konovalov/qcam-vf_gl-raw12p/v2-1_maximized.bmp