{"id":20973,"url":"https://patchwork.libcamera.org/api/1.1/patches/20973/?format=json","web_url":"https://patchwork.libcamera.org/patch/20973/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20240820172202.526547-7-chenghaoyang@google.com>","date":"2024-08-20T16:23:37","name":"[v9,6/8] libcamera: pipeline: Shift test pattern by 1 pixel left every frame","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"959d8956d87b1e19e72ead1ee54c9773fa64c658","submitter":{"id":117,"url":"https://patchwork.libcamera.org/api/1.1/people/117/?format=json","name":"Cheng-Hao Yang","email":"chenghaoyang@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/20973/mbox/","series":[{"id":4529,"url":"https://patchwork.libcamera.org/api/1.1/series/4529/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4529","date":"2024-08-20T16:23:31","name":"Add VirtualPipelineHandler","version":9,"mbox":"https://patchwork.libcamera.org/series/4529/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20973/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20973/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 6AA14C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 20 Aug 2024 17:22:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AFF3463419;\n\tTue, 20 Aug 2024 19:22:31 +0200 (CEST)","from mail-wm1-x330.google.com (mail-wm1-x330.google.com\n\t[IPv6:2a00:1450:4864:20::330])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 410F6633D3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Aug 2024 19:22:19 +0200 (CEST)","by mail-wm1-x330.google.com with SMTP id\n\t5b1f17b1804b1-4281faefea9so45950805e9.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Aug 2024 10:22:19 -0700 (PDT)","from chenghaoyang-germany.c.googlers.com.com\n\t(161.126.77.34.bc.googleusercontent.com. [34.77.126.161])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-42ab6e90db5sm30328575e9.0.2024.08.20.10.22.17\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 20 Aug 2024 10:22:18 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"Cvek/Pa0\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1724174538; x=1724779338;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=Pr2RjT5zL83ETuScO4bS+zvWmin1yvLtrtGvqaSpiWw=;\n\tb=Cvek/Pa0avygXUlKeQhjA6mqhz7vLsQzFTiWpRvjsh3ZrNHggt2hpDFLH/k6o0mY09\n\tgihJjfbVOTptLHxcM3tIdIKynMwPfDaX76Odzeuh8B76k/PYdNiBIwPQs+FbZTniR6DZ\n\tR3xYxP9fsKfIHUPszETqUQET/iwu8l0xTaSAg=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1724174538; x=1724779338;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=Pr2RjT5zL83ETuScO4bS+zvWmin1yvLtrtGvqaSpiWw=;\n\tb=M2S/o04DgKYmBhqncU3M+DRfb+y0EluEuQ/BnTMdtV0L5l7ZX2OGzD5/EMtvTA70bG\n\t1g/xrCUGZXcnbtHMNpKIAp1hiVEQwAfTMjZtrgudsxn8FQffNqSaQi30T40wv+B0hewt\n\t7aLI1Sfya+uu0NqrfLEHfHwXg2OQ6zpmrwcCnPDx/UV2Ui+golQaH0Mytxc17eiaA7H/\n\tWo17qJtrPzhuv61VF4yvO1iiyIjEtgvH9iQLYxvbWAVmjilVK25rQjnN5wRhbH2Qqmb9\n\t42tYEZaDMDro+//I+ttlHYhPeTcRqITr6/6NX+ukS4fyaZ13hgcYRS2P2kliIzh2PAAA\n\t3r2w==","X-Gm-Message-State":"AOJu0YwNcVqd7oVwi1bsXptfchPX/N20CxUdwsQMJxWCveUZ8aqvCMTH\n\t6YUP/VvRj9EGB8BJbOjs/k8aO3xQv/FnDZBb22+joAOZi8q8GF4SoHobPFMV2bTQr3RUFDrJFsE\n\twJScI4ZE=","X-Google-Smtp-Source":"AGHT+IHjtFvlEtl1gqgBVdLTrTLzusepXezFVRk0EBWLS2h6OdRHU//8vMB4GTQ3ObGob9K87bHXpw==","X-Received":"by 2002:a05:600c:1d83:b0:428:c0a:27ea with SMTP id\n\t5b1f17b1804b1-42abd212819mr556645e9.12.1724174538528; \n\tTue, 20 Aug 2024 10:22:18 -0700 (PDT)","From":"Harvey Yang <chenghaoyang@chromium.org>","X-Google-Original-From":"Harvey Yang <chenghaoyang@google.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Konami Shu <konamiz@google.com>, Harvey Yang <chenghaoyang@chromium.org>,\n\tYunke Cao <yunkec@chromium.org>, Tomasz Figa <tfiga@chromium.org>","Subject":"[PATCH v9 6/8] libcamera: pipeline: Shift test pattern by 1 pixel\n\tleft every frame","Date":"Tue, 20 Aug 2024 16:23:37 +0000","Message-ID":"<20240820172202.526547-7-chenghaoyang@google.com>","X-Mailer":"git-send-email 2.46.0.184.g6999bdac58-goog","In-Reply-To":"<20240820172202.526547-1-chenghaoyang@google.com>","References":"<20240820172202.526547-1-chenghaoyang@google.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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":"From: Konami Shu <konamiz@google.com>\n\n- This write the buffer every frame\n- Shifting makes the frame rate dropped from about 160 to 40\n\nPatchset1->2\n- Use constant instead of using a magic number\n\nPatchset2->3\n- Make shiftLeft() private\n\nSigned-off-by: Konami Shu <konamiz@google.com>\nCo-developed-by: Harvey Yang <chenghaoyang@chromium.org>\nCo-developed-by: Yunke Cao <yunkec@chromium.org>\nCo-developed-by: Tomasz Figa <tfiga@chromium.org>\n---\n .../pipeline/virtual/data/virtual.yaml        |  4 +--\n .../virtual/test_pattern_generator.cpp        | 36 +++++++++++++++++++\n 2 files changed, 38 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/virtual/data/virtual.yaml b/src/libcamera/pipeline/virtual/data/virtual.yaml\nindex 4eb239e24..b8956f2d4 100644\n--- a/src/libcamera/pipeline/virtual/data/virtual.yaml\n+++ b/src/libcamera/pipeline/virtual/data/virtual.yaml\n@@ -28,8 +28,8 @@\n   model: \"Virtual Video Device1\"\n \"Virtual2\":\n   supported_formats:\n-  - width: 100\n-    height: 100\n+  - width: 400\n+    height: 300\n   test_pattern: \"lines\"\n   location: \"front\"\n   model: \"Virtual Video Device2\"\ndiff --git a/src/libcamera/pipeline/virtual/test_pattern_generator.cpp b/src/libcamera/pipeline/virtual/test_pattern_generator.cpp\nindex 8dfe626e5..6df9b31e9 100644\n--- a/src/libcamera/pipeline/virtual/test_pattern_generator.cpp\n+++ b/src/libcamera/pipeline/virtual/test_pattern_generator.cpp\n@@ -28,6 +28,9 @@ void TestPatternGenerator::generateFrame(\n \n \tauto planes = mappedFrameBuffer.planes();\n \n+\t/* TODO: select whether to do shifting or not */\n+\tshiftLeft(size);\n+\n \t/* Convert the template_ to the frame buffer */\n \tint ret = libyuv::ARGBToNV12(\n \t\ttemplate_.get(), /*src_stride_argb=*/size.width * kARGBSize,\n@@ -39,6 +42,39 @@ void TestPatternGenerator::generateFrame(\n \t}\n }\n \n+void TestPatternGenerator::shiftLeft(const Size &size)\n+{\n+\t/* Store the first column temporarily */\n+\tuint8_t firstColumn[size.height * kARGBSize];\n+\tfor (size_t h = 0; h < size.height; h++) {\n+\t\tunsigned int index = h * size.width * kARGBSize;\n+\t\tunsigned int index1 = h * kARGBSize;\n+\t\tfirstColumn[index1] = template_[index];\n+\t\tfirstColumn[index1 + 1] = template_[index + 1];\n+\t\tfirstColumn[index1 + 2] = template_[index + 2];\n+\t\tfirstColumn[index1 + 3] = 0x00;\n+\t}\n+\n+\t/* Overwrite template_ */\n+\tuint8_t *buf = template_.get();\n+\tfor (size_t h = 0; h < size.height; h++) {\n+\t\tfor (size_t w = 0; w < size.width - 1; w++) {\n+\t\t\t/* Overwrite with the pixel on the right */\n+\t\t\tunsigned int index = (h * size.width + w + 1) * kARGBSize;\n+\t\t\t*buf++ = template_[index]; // B\n+\t\t\t*buf++ = template_[index + 1]; // G\n+\t\t\t*buf++ = template_[index + 2]; // R\n+\t\t\t*buf++ = 0x00; // A\n+\t\t}\n+\t\t/* Overwrite the new last column with the original first column */\n+\t\tunsigned int index1 = h * kARGBSize;\n+\t\t*buf++ = firstColumn[index1]; // B\n+\t\t*buf++ = firstColumn[index1 + 1]; // G\n+\t\t*buf++ = firstColumn[index1 + 2]; // R\n+\t\t*buf++ = 0x00; // A\n+\t}\n+}\n+\n std::unique_ptr<ColorBarsGenerator> ColorBarsGenerator::create()\n {\n \treturn std::make_unique<ColorBarsGenerator>();\n","prefixes":["v9","6/8"]}