From patchwork Thu Aug 5 13:28:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 13206 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id A193BC3237 for ; Thu, 5 Aug 2021 13:28:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 160C368811; Thu, 5 Aug 2021 15:28:19 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="b/JQaN39"; dkim-atps=neutral Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5C17A6026D for ; Thu, 5 Aug 2021 15:28:18 +0200 (CEST) Received: by mail-pj1-x102d.google.com with SMTP id m10-20020a17090a34cab0290176b52c60ddso9373524pjf.4 for ; Thu, 05 Aug 2021 06:28:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zEbWiI382lmibgIWTF7PpOMVaD87Eq0+Mkl0oYoTX1A=; b=b/JQaN39yNWkoeB8PJ2QDW/26TDHeiQErAOLACh590qqgvKU5b3q+HA3k37hwq7icu e/B3kViD1fXAzur3Sc/fPFGnlTRtA23rdRxJwa3JV5m4c79cMvMS3jX5Kw9Ya944tkzg Q9BDBiP9FqjZ0oXh+WVawTczGD1Z43dXKdxts= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zEbWiI382lmibgIWTF7PpOMVaD87Eq0+Mkl0oYoTX1A=; b=hVcmYmOb0UXs2EXoqYfNKyC/kswUgw48PIbMmLTRw1eyNArUHVqffvFISp62hy0Hu0 iT8yazZCv/XEqWaVt/fUEWsjBPSKBcJT6lNfAoD1V/olv4lMG/wjvBMzMcz2VxfhbLf1 HaKN54l+y1Z89rPKrOc35dHjjwszl5n8jupbUqki3xheOvUc7dn6fv2Y6RWzvKCBXHIn 46YAYmTLJhWYEsxd1zNNYPo2jvr0NuZ5FCmVczzvqnO4Y0il0zpsGbZareaIlTLYD5Nw PuYD70USvWaWpZPtW5BPNX3Vooj0jNXwOsfUhbpeXEfn0MeknVGh5WC1Lc+zvbcY9n5M Ni4A== X-Gm-Message-State: AOAM530id/LyxR/+RYvN3Owg25cwLBqr7KgVfN1qWFSWCEM+EsoBvMMf cZ+se19V1KQlsHSVvPhvobDuzu8mTJwNhQ== X-Google-Smtp-Source: ABdhPJzDUoJFWaVQFTfZnBmh+7XIf3dmLa93IWM6IPF5ln3Q8oLmMrETtM5FGBUXflu8fe1e4W709w== X-Received: by 2002:a17:90b:3556:: with SMTP id lt22mr15647277pjb.174.1628170096400; Thu, 05 Aug 2021 06:28:16 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:490b:61c8:a52a:e6eb]) by smtp.gmail.com with ESMTPSA id z18sm2590442pfn.88.2021.08.05.06.28.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 06:28:15 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Thu, 5 Aug 2021 22:28:05 +0900 Message-Id: <20210805132805.824754-1-hiroh@chromium.org> X-Mailer: git-send-email 2.32.0.554.ge1b32706d8-goog MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] android: yuv: Fix wrong access of source buffer X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" File descriptors of FrameBuffer given in PostProcessor::process() for all the planes point the same buffer. To access the beginning of the second or later plane, it is necessary to add offsets to the beginning of the buffer. Fix the wrong access to the second plane of NV12 in PostProcessorYuv. Signed-off-by: Hirokazu Honda --- src/android/yuv/post_processor_yuv.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/android/yuv/post_processor_yuv.cpp b/src/android/yuv/post_processor_yuv.cpp index 772e805b..3b801e96 100644 --- a/src/android/yuv/post_processor_yuv.cpp +++ b/src/android/yuv/post_processor_yuv.cpp @@ -62,9 +62,12 @@ int PostProcessorYuv::process(const FrameBuffer &source, return -EINVAL; } - int ret = libyuv::NV12Scale(sourceMapped.maps()[0].data(), + const uint8_t *sourceY = sourceMapped.maps()[0].data(); + const uint8_t *sourceUV = sourceY + sourceStride_[0] * sourceSize_.height; + + int ret = libyuv::NV12Scale(sourceY, sourceStride_[0], - sourceMapped.maps()[1].data(), + sourceUV, sourceStride_[1], sourceSize_.width, sourceSize_.height, destination->plane(0).data(),