From patchwork Tue Aug 31 06:34:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 13572 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 8FEE2BD87D for ; Tue, 31 Aug 2021 06:35:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4EBFB69170; Tue, 31 Aug 2021 08:35:08 +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="kj1DizGk"; dkim-atps=neutral Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0A3D669166 for ; Tue, 31 Aug 2021 08:35:06 +0200 (CEST) Received: by mail-pj1-x102f.google.com with SMTP id j1so11097478pjv.3 for ; Mon, 30 Aug 2021 23:35:05 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=3k3ExmsDADITCkoKoVxB6HQlr2nUSFrjo/RKrh85abo=; b=kj1DizGkPBg20cfkuiEPrdADt3O9UFlhkNvUJgLo57vpUVH1rI9GwB74WVuFrRMK6Z c4FR5v10ixF8arZomrfFedUdmEa/Wj9spcx9EpjRQwLquO/DROIWqlSHTWp5yyiSSvIz X7O6Zdg62O6t8OVU4+sy92u+7b5vhN4Lr+xcQ= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=3k3ExmsDADITCkoKoVxB6HQlr2nUSFrjo/RKrh85abo=; b=Nq1yA6KJUbKZ1w0ewO+yC03tUtF3IxVKsvhvXZdK3oBCu0iV2qxVE4hhYZAhzf5b4H N1eZPCz/9gncCujzcUjv3dOu1lSapkA91UFRwR+AtkeR6FIr5z4qIxTk1XWyv8mATaeI Y8P/45FXLczXiQSSkPdSKm/ve7ISw+A1Pv+AsBSrAKZitnBaBACNt90Wmzz1WkH9IbGH NHp7Z0Mg00Yp1OouS2aheM5uHG/8zEAAWSJy4H9JSJJiiG0Li3v2MM7FXiQulFSl9mj3 WBNN24lBt1UL4ihCCamPtHCAMtRNIlvAOQnYUaIOzKTZFFPrCv8KhOeQvl3Dyg0pGuWg RjQQ== X-Gm-Message-State: AOAM5326cu72oGX3bsCoJIKhcpP6BiFQnGy9GrcjWcvNxpO3pnoKVdFM dlO66STTzs5CRl2SdqIfLehsEqHbez7o2w== X-Google-Smtp-Source: ABdhPJzjO/H70wQsQYk1FhSiX/M/CsCA9g89+UhTj1yE3GLrKr8SziIzjlrtarJl0ftt+2nHulwDIg== X-Received: by 2002:a17:90a:44:: with SMTP id 4mr3463079pjb.130.1630391704276; Mon, 30 Aug 2021 23:35:04 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:3c62:aba4:18ea:5441]) by smtp.gmail.com with ESMTPSA id d17sm16304027pfn.110.2021.08.30.23.35.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 23:35:03 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Tue, 31 Aug 2021 15:34:34 +0900 Message-Id: <20210831063438.785767-2-hiroh@chromium.org> X-Mailer: git-send-email 2.33.0.259.gc128427fd7-goog In-Reply-To: <20210831063438.785767-1-hiroh@chromium.org> References: <20210831063438.785767-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/5] android: yuv: Use CameraBuffer::stride() in PostProcessorYuv 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" PostProcessorYuv computes strides for a CameraBuffer. CameraBuffer has stride() function. This replaces the computation with the function. Signed-off-by: Hirokazu Honda Reviewed-by: Laurent Pinchart --- src/android/yuv/post_processor_yuv.cpp | 13 +++++++------ src/android/yuv/post_processor_yuv.h | 1 - 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/android/yuv/post_processor_yuv.cpp b/src/android/yuv/post_processor_yuv.cpp index 6952fc38..12d6297d 100644 --- a/src/android/yuv/post_processor_yuv.cpp +++ b/src/android/yuv/post_processor_yuv.cpp @@ -69,9 +69,9 @@ int PostProcessorYuv::process(const FrameBuffer &source, sourceStride_[1], sourceSize_.width, sourceSize_.height, destination->plane(0).data(), - destinationStride_[0], + destination->stride(0), destination->plane(1).data(), - destinationStride_[1], + destination->stride(1), destinationSize_.width, destinationSize_.height, libyuv::FilterMode::kFilterBilinear); @@ -115,8 +115,8 @@ bool PostProcessorYuv::isValidBuffers(const FrameBuffer &source, << destination.plane(0).size() << ", " << destination.plane(1).size() << "}, expected size: {" - << sourceLength_[0] << ", " - << sourceLength_[1] << "}"; + << destinationLength_[0] << ", " + << destinationLength_[1] << "}"; return false; } @@ -132,13 +132,14 @@ void PostProcessorYuv::calculateLengths(const StreamConfiguration &inCfg, const PixelFormatInfo &nv12Info = PixelFormatInfo::info(formats::NV12); for (unsigned int i = 0; i < 2; i++) { sourceStride_[i] = inCfg.stride; - destinationStride_[i] = nv12Info.stride(destinationSize_.width, i, 1); + const unsigned int destinationStride = + nv12Info.stride(destinationSize_.width, i, 1); const unsigned int vertSubSample = nv12Info.planes[i].verticalSubSampling; sourceLength_[i] = sourceStride_[i] * ((sourceSize_.height + vertSubSample - 1) / vertSubSample); - destinationLength_[i] = destinationStride_[i] * + destinationLength_[i] = destinationStride * ((destinationSize_.height + vertSubSample - 1) / vertSubSample); } } diff --git a/src/android/yuv/post_processor_yuv.h b/src/android/yuv/post_processor_yuv.h index f8b1ba23..1a0b5e89 100644 --- a/src/android/yuv/post_processor_yuv.h +++ b/src/android/yuv/post_processor_yuv.h @@ -36,7 +36,6 @@ private: unsigned int sourceLength_[2] = {}; unsigned int destinationLength_[2] = {}; unsigned int sourceStride_[2] = {}; - unsigned int destinationStride_[2] = {}; }; #endif /* __ANDROID_POST_PROCESSOR_YUV_H__ */