Patch Detail
Show a patch.
GET /api/patches/16073/?format=api
{ "id": 16073, "url": "https://patchwork.libcamera.org/api/patches/16073/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16073/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220527144447.94891-3-tomi.valkeinen@ideasonboard.com>", "date": "2022-05-27T14:44:19", "name": "[libcamera-devel,v3,02/30] py: cam_qt: Use libcamera.formats", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "21fc8817a952033e7df02abe569ff284ab7edb91", "submitter": { "id": 109, "url": "https://patchwork.libcamera.org/api/people/109/?format=api", "name": "Tomi Valkeinen", "email": "tomi.valkeinen@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16073/mbox/", "series": [ { "id": 3146, "url": "https://patchwork.libcamera.org/api/series/3146/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3146", "date": "2022-05-27T14:44:17", "name": "More misc Python patches", "version": 3, "mbox": "https://patchwork.libcamera.org/series/3146/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16073/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16073/checks/", "tags": {}, "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 712B0BD161\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 May 2022 14:45:12 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2A5A16563B;\n\tFri, 27 May 2022 16:45:09 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8E762633A4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 May 2022 16:45:05 +0200 (CEST)", "from deskari.lan (91-156-85-209.elisa-laajakaista.fi\n\t[91.156.85.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 08077B1D;\n\tFri, 27 May 2022 16:45:04 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653662709;\n\tbh=u2tqjxRj2OwecQxi/1sS9LWYVbQZr9S9oBztjV3FNyo=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=Qg3fHcaXGRSEL6b5cjtjPgNSvDT890FAbyaDO1If9b2N9Rh4x/LejWhamspRoGVPo\n\tc+X7NmnscG+lucRVUJBIJk/i8Y1qLHjwc2yYEauNU8lfSyQKBZQwjsb9Ds99uHaILf\n\tgmSAwP8OOl3NdqamXmfmxlUf5JB+wGEr3Nf0kRjdgjiE7jHuvNoHKBP2y+az1erqM4\n\tDVvZvfYj9SKewCNWtnE5OJ8Zx4XHd0GLmYnvVVG2y9EJJGZQzo/KghRs5y8HItVB3a\n\tY14n4smo/uXeUwKtcmeAyU8IgKzCbuoX+d6DfjHvcvgh07KwnihjtcUXbqIWxffrMU\n\tY+XqeOOrL60oQ==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653662705;\n\tbh=u2tqjxRj2OwecQxi/1sS9LWYVbQZr9S9oBztjV3FNyo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Kh7cbjY3sQTKEne8uCrA6FfyLnl+5DSXTEPkDB9Z1+xVMjTNpRkAEvkmeypeCohgQ\n\t77bWiTzk20Zl+JYJId4B6T9okQuXdiGkbXeagsnE3ptG1OC+tEJ5Yj8cpXTcaR8P8m\n\tge3eGWNE8nZxjZbg0YHFFB/l7KruevkMUlQrYmZM=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Kh7cbjY3\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org,\n\tDavid Plowman <david.plowman@raspberrypi.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tJacopo Mondi <jacopo@jmondi.org>", "Date": "Fri, 27 May 2022 17:44:19 +0300", "Message-Id": "<20220527144447.94891-3-tomi.valkeinen@ideasonboard.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20220527144447.94891-1-tomi.valkeinen@ideasonboard.com>", "References": "<20220527144447.94891-1-tomi.valkeinen@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 02/30] py: cam_qt: Use libcamera.formats", "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>", "From": "Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Use the new libcamera.formats in cam_qt.py.\n\nSigned-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/py/cam/cam_qt.py | 16 ++++++++--------\n 1 file changed, 8 insertions(+), 8 deletions(-)", "diff": "diff --git a/src/py/cam/cam_qt.py b/src/py/cam/cam_qt.py\nindex 91be2a08..0a25a823 100644\n--- a/src/py/cam/cam_qt.py\n+++ b/src/py/cam/cam_qt.py\n@@ -8,6 +8,7 @@ from numpy.lib.stride_tricks import as_strided\n from PIL import Image\n from PIL.ImageQt import ImageQt\n from PyQt5 import QtCore, QtGui, QtWidgets\n+import libcamera as libcam\n import numpy as np\n import sys\n \n@@ -87,9 +88,7 @@ def to_rgb(fmt, size, data):\n w = size.width\n h = size.height\n \n- fmt = str(fmt)\n-\n- if fmt == 'YUYV':\n+ if fmt == libcam.formats.YUYV:\n # YUV422\n yuyv = data.reshape((h, w // 2 * 4))\n \n@@ -111,20 +110,21 @@ def to_rgb(fmt, size, data):\n rgb[:, :, 2] -= 226.8183044444304\n rgb = rgb.astype(np.uint8)\n \n- elif fmt == 'RGB888':\n+ elif fmt == libcam.formats.RGB888:\n rgb = data.reshape((h, w, 3))\n rgb[:, :, [0, 1, 2]] = rgb[:, :, [2, 1, 0]]\n \n- elif fmt == 'BGR888':\n+ elif fmt == libcam.formats.BGR888:\n rgb = data.reshape((h, w, 3))\n \n- elif fmt in ['ARGB8888', 'XRGB8888']:\n+ elif fmt in [libcam.formats.ARGB8888, libcam.formats.XRGB8888]:\n rgb = data.reshape((h, w, 4))\n rgb = np.flip(rgb, axis=2)\n # drop alpha component\n rgb = np.delete(rgb, np.s_[0::4], axis=2)\n \n- elif fmt.startswith('S'):\n+ elif str(fmt).startswith('S'):\n+ fmt = str(fmt)\n bayer_pattern = fmt[1:5]\n bitspp = int(fmt[5:])\n \n@@ -296,7 +296,7 @@ class MainWindow(QtWidgets.QWidget):\n h = cfg.size.height\n pitch = cfg.stride\n \n- if str(cfg.pixel_format) == 'MJPEG':\n+ if cfg.pixel_format == libcam.formats.MJPEG:\n img = Image.open(BytesIO(mfb.planes[0]))\n qim = ImageQt(img).copy()\n pix = QtGui.QPixmap.fromImage(qim)\n", "prefixes": [ "libcamera-devel", "v3", "02/30" ] }