{"id":20744,"url":"https://patchwork.libcamera.org/api/patches/20744/?format=json","web_url":"https://patchwork.libcamera.org/patch/20744/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20240801073339.4061027-7-chenghaoyang@google.com>","date":"2024-08-01T07:31:02","name":"[v7,6/7] 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/people/117/?format=json","name":"Cheng-Hao Yang","email":"chenghaoyang@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/20744/mbox/","series":[{"id":4472,"url":"https://patchwork.libcamera.org/api/series/4472/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4472","date":"2024-08-01T07:30:56","name":"Add VirtualPipelineHandler","version":7,"mbox":"https://patchwork.libcamera.org/series/4472/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20744/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20744/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 0E942BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  1 Aug 2024 07:34:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9FBBE63386;\n\tThu,  1 Aug 2024 09:34:08 +0200 (CEST)","from mail-pl1-x635.google.com (mail-pl1-x635.google.com\n\t[IPv6:2607:f8b0:4864:20::635])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4252D63381\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  1 Aug 2024 09:33:58 +0200 (CEST)","by mail-pl1-x635.google.com with SMTP id\n\td9443c01a7336-1fd9e6189d5so53066955ad.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 01 Aug 2024 00:33:58 -0700 (PDT)","from chenghaoyang-low.c.googlers.com.com\n\t(237.198.80.34.bc.googleusercontent.com. [34.80.198.237])\n\tby smtp.gmail.com with ESMTPSA id\n\td9443c01a7336-1fed7cd3dcbsm131839165ad.73.2024.08.01.00.33.54\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 01 Aug 2024 00:33:55 -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=\"OEHy1vd7\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1722497636; x=1723102436;\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=Zdz2HiC4N+RVhABxhJ7B+tzTLBNBTx7Napjziq4G5xk=;\n\tb=OEHy1vd7bRWLFAbg8l7kJZAT+UfVwlOBu4PmJf3ItfqS+/w7sTD0gqHuoCOyvS/k7N\n\tnOJN2grC+eqO14oAolYuAcyf1mxQFbu/wf0bWxXTQI8NYVgL7MuRf9bKOBJLnaisgBjB\n\tYlIptgoHZGcFOi4zR0+x1RllM28hC/DDT6yQI=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1722497636; x=1723102436;\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=Zdz2HiC4N+RVhABxhJ7B+tzTLBNBTx7Napjziq4G5xk=;\n\tb=SjVrv8/ZgYewuXrMqg+Whyd7TYioLztkb6qN4vQM9Y09PGCfd7MjNAE9iXE1PIWFyU\n\tqs8jWVb6IGrtS+TpiF/TBRCliARc2UeUY6kV3q61hwJIQxyPRwKb2ZlgubmA8fCE8yfe\n\tGylu2f4Bejcspk28mOEcLSX9T0CXYi7h17/XC5cSzi2uEqsrTsUEc2/mlzrpDdlCQ/bR\n\t5YHOebggmNzuu2qBLQUQ21rKTm7VJSCxN1V0VlEunxWgyxPY9zkZ1/38py84QiLW/ZBW\n\tVAboYBUxIditS/Xh5p7p/Zbf8MCYLUMcH66aQttKF6UjlHdk9fLKCHSPu+ATSpFGK7Xe\n\tfWtA==","X-Gm-Message-State":"AOJu0Yzlo4u7Ng96/8Y9nJqc3gfbn85SFfKbY7RoLvck4AdxnW/vZYUP\n\twyi054x2Ryj6AIsET8vMsqOtEfA1wG9GYFOgskZG32FbIdeJ79OO8C8VSE0veZij41UVdUUon3S\n\t65g==","X-Google-Smtp-Source":"AGHT+IE/VvE32lAu8ms4KP5IAA3ALlIOTJOtntA9ZC/VoeleGu4u6DSLv+i9nXwFSX5NxqYq2w1XvQ==","X-Received":"by 2002:a17:903:234f:b0:1fb:72b4:8775 with SMTP id\n\td9443c01a7336-1ff4d2135c7mr18130925ad.40.1722497635915; \n\tThu, 01 Aug 2024 00:33:55 -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 v7 6/7] libcamera: pipeline: Shift test pattern by 1 pixel\n\tleft every frame","Date":"Thu,  1 Aug 2024 07:31:02 +0000","Message-ID":"<20240801073339.4061027-7-chenghaoyang@google.com>","X-Mailer":"git-send-email 2.46.0.rc1.232.g9752f9e123-goog","In-Reply-To":"<20240801073339.4061027-1-chenghaoyang@google.com>","References":"<20240801073339.4061027-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 4eb239e2..b8956f2d 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 8dfe626e..6df9b31e 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":["v7","6/7"]}