{"id":20707,"url":"https://patchwork.libcamera.org/api/patches/20707/?format=json","web_url":"https://patchwork.libcamera.org/patch/20707/","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":"<20240726095626.3632402-7-chenghaoyang@chromium.org>","date":"2024-07-26T09:54:27","name":"[v6,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/20707/mbox/","series":[{"id":4461,"url":"https://patchwork.libcamera.org/api/series/4461/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4461","date":"2024-07-26T09:54:21","name":"Add VirtualPipelineHandler","version":6,"mbox":"https://patchwork.libcamera.org/series/4461/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20707/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20707/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 582DEBDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 26 Jul 2024 09:56:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AF50A6337B;\n\tFri, 26 Jul 2024 11:56:51 +0200 (CEST)","from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com\n\t[IPv6:2607:f8b0:4864:20::42c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1B84A63371\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Jul 2024 11:56:42 +0200 (CEST)","by mail-pf1-x42c.google.com with SMTP id\n\td2e1a72fcca58-70d1c8d7d95so516130b3a.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Jul 2024 02:56:42 -0700 (PDT)","from chenghaoyang-low.c.googlers.com.com\n\t(148.175.199.104.bc.googleusercontent.com. [104.199.175.148])\n\tby smtp.gmail.com with ESMTPSA id\n\td9443c01a7336-1fed7c7f63asm28396665ad.46.2024.07.26.02.56.38\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 26 Jul 2024 02:56:39 -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=\"TPrh4kjT\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1721987800; x=1722592600;\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=+L09Rrpm/0DeMUNffdDZiAx9/frA5c+esuyG5D4svek=;\n\tb=TPrh4kjTXHbg6Naq0qI3JNGW+feBh5HKea9PVLngA8JAHDt+4eH2Ek8IGm+qwzW8l7\n\te0jqlZ/ThYmcr91MuEaPGNFel8PYkLxETzubn/UqDagHXwZ3mOBdJKG8oDuJKiKpe3Cu\n\twNgLsu7HBuKyHD8t5tNMVL6r2YU4WAhED+j9g=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1721987800; x=1722592600;\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=+L09Rrpm/0DeMUNffdDZiAx9/frA5c+esuyG5D4svek=;\n\tb=mFiz7amjWzkyFcoL+XO7ZIZTedV/saoXKl9kAx9sirdymR0MGE8W8VSAYnqxUlhPpA\n\tv4FiWQrB8qFI5uhTbhVKfEnl4Q21atVkWL5DlzF9C9mOELPh56e3NnYItD4r9YEGlX5L\n\taLhJXSzzbcp4aP9B6C0/0ebGy9k7ABR6zfFc3HG48vkFJ1Q46uH43D5ifwQn8w3la4NN\n\t7llHwV1Nfc8GX0IfzsCZ+VcUUJPnC/7YoZ+YYTmgwlMudjGohQ1kn1kv7W7UMOk1f1W0\n\t2fAmj90PMplNajTGieHdTCH6cMHfw5Bx05w4bLJUfOvl5WwAkWR+fK6N9mONxtgK7x36\n\tPIDA==","X-Gm-Message-State":"AOJu0Yy8mG+T06CejcM4d6BQRXMgzd0HOdZsRYA4yuLANjn/JgADWvg5\n\tq7GW5pYuC+Ye/P3re5mjBFYpis6uvZL3n4fF0Vo97lkXRRqCKWVJb5dqzbTWEqAuJpJtE9rLNu9\n\tmnA==","X-Google-Smtp-Source":"AGHT+IElzz+mOcRObOIuIAJd8AEYYHXvsBa2sm1UALwBK53eOsXXaeRcTNFWm01RB0+tBAQMZPPN4A==","X-Received":"by 2002:a05:6a20:2452:b0:1c4:936e:b8a2 with SMTP id\n\tadf61e73a8af0-1c4936f4f36mr895565637.27.1721987800315; \n\tFri, 26 Jul 2024 02:56:40 -0700 (PDT)","From":"Harvey Yang <chenghaoyang@chromium.org>","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 v6 6/7] libcamera: pipeline: Shift test pattern by 1 pixel\n\tleft every frame","Date":"Fri, 26 Jul 2024 09:54:27 +0000","Message-ID":"<20240726095626.3632402-7-chenghaoyang@chromium.org>","X-Mailer":"git-send-email 2.46.0.rc1.232.g9752f9e123-goog","In-Reply-To":"<20240726095626.3632402-1-chenghaoyang@chromium.org>","References":"<20240726095626.3632402-1-chenghaoyang@chromium.org>","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\nChange-Id: Ief9c1e520a4ffb4cf7d47d0b37ad756be40330ea\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 b142b522c..d685a4903 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":["v6","6/7"]}