Patch Detail
Show a patch.
GET /api/patches/13705/?format=api
{ "id": 13705, "url": "https://patchwork.libcamera.org/api/patches/13705/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13705/", "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": "<20210907002044.7319-3-laurent.pinchart@ideasonboard.com>", "date": "2021-09-07T00:20:41", "name": "[libcamera-devel,v2,2/5] qcam: format_converter: Add configurable stride support", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "e318f42cdd6128fde2aeee04cc2be7a281cb4a57", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/13705/mbox/", "series": [ { "id": 2484, "url": "https://patchwork.libcamera.org/api/series/2484/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2484", "date": "2021-09-07T00:20:39", "name": "qcam: Fix stride handling", "version": 2, "mbox": "https://patchwork.libcamera.org/series/2484/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13705/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13705/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 32D9EBDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 7 Sep 2021 00:21:15 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7DDB66916C;\n\tTue, 7 Sep 2021 02:21:11 +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 E5C1A69168\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 7 Sep 2021 02:21:07 +0200 (CEST)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8A2BA891\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 7 Sep 2021 02:21:07 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"IUgHo/S9\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630974067;\n\tbh=yI7FDPFuliZmBZ0WCHAxF7tjPfiMMucGxtT5aeV7GT8=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=IUgHo/S9DemX7LS7VmQ5TFmkKRLTYeeogQlcwmaAhu7zfQhAYiflKZt6gM7BgFWp2\n\tmxenJVqwRuorw/N6IeEuOoLKUeMjYhWw9flM4EZIC3ffy7wcC6w5GPcVfG4GtlXJP1\n\tcXnVDmpSmxPM1E3F94JGX8eB/He9/sUs/nLwhtiU=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 7 Sep 2021 03:20:41 +0300", "Message-Id": "<20210907002044.7319-3-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.32.0", "In-Reply-To": "<20210907002044.7319-1-laurent.pinchart@ideasonboard.com>", "References": "<20210907002044.7319-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 2/5] qcam: format_converter: Add\n\tconfigurable stride support", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Make the stride configurable to support convertion of images with\npadding at the end of lines.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nChanges since v1:\n\n- Fix bad rebase\n---\n src/qcam/format_converter.cpp | 11 ++++++-----\n src/qcam/format_converter.h | 4 +++-\n src/qcam/viewfinder_qt.cpp | 5 ++---\n 3 files changed, 11 insertions(+), 9 deletions(-)", "diff": "diff --git a/src/qcam/format_converter.cpp b/src/qcam/format_converter.cpp\nindex 673ad33e141d..b4c7b0ca0edf 100644\n--- a/src/qcam/format_converter.cpp\n+++ b/src/qcam/format_converter.cpp\n@@ -30,7 +30,7 @@\n #endif\n \n int FormatConverter::configure(const libcamera::PixelFormat &format,\n-\t\t\t const QSize &size)\n+\t\t\t const QSize &size, unsigned int stride)\n {\n \tswitch (format) {\n \tcase libcamera::formats::NV12:\n@@ -152,6 +152,7 @@ int FormatConverter::configure(const libcamera::PixelFormat &format,\n \tformat_ = format;\n \twidth_ = size.width();\n \theight_ = size.height();\n+\tstride_ = stride;\n \n \treturn 0;\n }\n@@ -186,7 +187,7 @@ static void yuv_to_rgb(int y, int u, int v, int *r, int *g, int *b)\n \n void FormatConverter::convertNV(const Image *srcImage, unsigned char *dst)\n {\n-\tunsigned int c_stride = width_ * (2 / horzSubSample_);\n+\tunsigned int c_stride = stride_ * (2 / horzSubSample_);\n \tunsigned int c_inc = horzSubSample_ == 1 ? 2 : 0;\n \tunsigned int cb_pos = nvSwap_ ? 1 : 0;\n \tunsigned int cr_pos = nvSwap_ ? 0 : 1;\n@@ -195,7 +196,7 @@ void FormatConverter::convertNV(const Image *srcImage, unsigned char *dst)\n \tint r, g, b;\n \n \tfor (unsigned int y = 0; y < height_; y++) {\n-\t\tconst unsigned char *src_y = src + y * width_;\n+\t\tconst unsigned char *src_y = src + y * stride_;\n \t\tconst unsigned char *src_cb = src_c + (y / vertSubSample_) *\n \t\t\t\t\t c_stride + cb_pos;\n \t\tconst unsigned char *src_cr = src_c + (y / vertSubSample_) *\n@@ -243,7 +244,7 @@ void FormatConverter::convertRGB(const Image *srcImage, unsigned char *dst)\n \t\t\tdst[4 * x + 3] = 0xff;\n \t\t}\n \n-\t\tsrc += width_ * bpp_;\n+\t\tsrc += stride_;\n \t\tdst += width_ * 4;\n \t}\n }\n@@ -258,7 +259,7 @@ void FormatConverter::convertYUV(const Image *srcImage, unsigned char *dst)\n \tint r, g, b, y, cr, cb;\n \n \tcr_pos = (cb_pos_ + 2) % 4;\n-\tsrc_stride = width_ * 2;\n+\tsrc_stride = stride_;\n \tdst_stride = width_ * 4;\n \n \tfor (src_y = 0, dst_y = 0; dst_y < height_; src_y++, dst_y++) {\ndiff --git a/src/qcam/format_converter.h b/src/qcam/format_converter.h\nindex 2220a62b5f11..bb04aa959a1a 100644\n--- a/src/qcam/format_converter.h\n+++ b/src/qcam/format_converter.h\n@@ -19,7 +19,8 @@ class QImage;\n class FormatConverter\n {\n public:\n-\tint configure(const libcamera::PixelFormat &format, const QSize &size);\n+\tint configure(const libcamera::PixelFormat &format, const QSize &size,\n+\t\t unsigned int stride);\n \n \tvoid convert(const Image *src, size_t size, QImage *dst);\n \n@@ -38,6 +39,7 @@ private:\n \tlibcamera::PixelFormat format_;\n \tunsigned int width_;\n \tunsigned int height_;\n+\tunsigned int stride_;\n \n \tenum FormatFamily formatFamily_;\n \ndiff --git a/src/qcam/viewfinder_qt.cpp b/src/qcam/viewfinder_qt.cpp\nindex cd051760160c..a05c75ed9e12 100644\n--- a/src/qcam/viewfinder_qt.cpp\n+++ b/src/qcam/viewfinder_qt.cpp\n@@ -52,8 +52,7 @@ const QList<libcamera::PixelFormat> &ViewFinderQt::nativeFormats() const\n }\n \n int ViewFinderQt::setFormat(const libcamera::PixelFormat &format,\n-\t\t\t const QSize &size,\n-\t\t\t [[maybe_unused]] unsigned int stride)\n+\t\t\t const QSize &size, unsigned int stride)\n {\n \timage_ = QImage();\n \n@@ -62,7 +61,7 @@ int ViewFinderQt::setFormat(const libcamera::PixelFormat &format,\n \t * the destination image.\n \t */\n \tif (!::nativeFormats.contains(format)) {\n-\t\tint ret = converter_.configure(format, size);\n+\t\tint ret = converter_.configure(format, size, stride);\n \t\tif (ret < 0)\n \t\t\treturn ret;\n \n", "prefixes": [ "libcamera-devel", "v2", "2/5" ] }