From patchwork Fri Sep 15 07:57:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattijs Korpershoek X-Patchwork-Id: 19007 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 8D7AEBD160 for ; Fri, 15 Sep 2023 07:57:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6F72462922; Fri, 15 Sep 2023 09:57:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1694764651; bh=BlimaKRl0xyLPQ0r4LM+wfkESh4Lofh1vu5Ia6W5Lns=; h=Date:References:In-Reply-To:To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=zqBrziG973kVpkXnlw6dhR96AM2xGB1S5etxutBLVc81UFTLjMPvOQ+dNo0YtIHcE 6FdnVWRwEM8IN2u4nrfLxBwG76tiAMMV0VhQ7YZEZ+OtWZ0P5Ng5UAl47H/InrTxKD FBtscG4PWT2u/UQsoyJv40S8WTAdjgCvnkJTieZ48Vv9X8zFArgZT7IY5PEiSonf3V hg9M21fVrNtoI3CAk3m7gLGScE+otZj89mlV1Q5YQVVkMPn8Rj7QA0AlTqpsGFGJ+R Qg5el2ixSaVNbmKYSOJt8ZnridnJkXnAI3MHeGGqB1rawxYDrDRouyERFeDwSeQqwF D3r8BNIkbab/w== Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CC74262911 for ; Fri, 15 Sep 2023 09:57:28 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="NFJqjrLI"; dkim-atps=neutral Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-401b393ddd2so21128535e9.0 for ; Fri, 15 Sep 2023 00:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1694764648; x=1695369448; darn=lists.libcamera.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=FR44mURV+pW3PtQs626ezxxVyqhFayqZPrHLiDOr1BA=; b=NFJqjrLIX290GGyJ8EUEM+zHhjN60okgBgvoJJp/zkhNnBV7fC9f65Je53A/kQoI+P nhQc6p873JMr+7T3iC69cTmDmoWrOvpte6BrNqR6VIcHXTj0QEeFTEjqlfzUVbLAwAek a0y/dQIiT5SPcnArEP1y1En64aXkCUSBHZoNj2gn+ZR4pV01Szh2FG5U8QoT30w76ixP 8A4VFngT1lC0wOM4eNxh2+RFRE+/mWuRWhN90flitrfGQfl13lMrWK++ZxnVt80TQF8z UeFKRlHBP9BU+MWop5FzWVTqm+Y1pfWWJ/t2a0Q72uk/FK6W1KsCXoXTQn22TjrchOVM yeLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694764648; x=1695369448; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FR44mURV+pW3PtQs626ezxxVyqhFayqZPrHLiDOr1BA=; b=hy7bBWX1nrPwHc+qgYgeF2B7/0vGeT5iM+EIntuUjJyF/xPpiwc9vIXzDsUlKiD6PG EVFfZBuriUMXulFHILY8S/wHTLl7rCIbc/UdQkcWTFpOXhEOqRX8NSCPELE6NJpozCeY xDeRLcZzvvzbVCFEIxZhyaCp62qDvaOMndXrru+yrnY8KIdBQ5rVNIfOPlJGkXqCTl1S NfDEjSoNWoNw9ei6UYh7vUMh7Ahqvt6VwvrsPVTtoWYXsE0ssqNu+5pos8ppaaISv5nZ SkWwnkl/+pttMW4V97qEuCpmnVLK5gA5oMyZT354PTK06qCb1nPQU+6jebNY7zeOSY5d DS+g== X-Gm-Message-State: AOJu0Yzg8HFxG79cC1QxsDWtFk8kywQBZJ47yyPMnSdT+jJMxxxrrkQ/ NaGhvQd0u480L8lmPv6pWm1y0zzW1th15t/f3rY= X-Google-Smtp-Source: AGHT+IG/o48nMAFDqtTdhmW98ZQ9QbtRFVthl1zYYqzjnCnJafEHyqeZp5w7BIvqTIikacsctL5ALA== X-Received: by 2002:adf:b604:0:b0:31f:f662:8ec5 with SMTP id f4-20020adfb604000000b0031ff6628ec5mr543006wre.55.1694764648249; Fri, 15 Sep 2023 00:57:28 -0700 (PDT) Received: from [192.168.1.20] ([2a01:cb19:8704:be00:4f55:bd9d:611a:6c8e]) by smtp.gmail.com with ESMTPSA id m2-20020a056000174200b0031fe9a47a87sm2506942wrf.112.2023.09.15.00.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 00:57:27 -0700 (PDT) Date: Fri, 15 Sep 2023 09:57:25 +0200 MIME-Version: 1.0 Message-Id: <20230915-libyuv-convert-v1-1-1e5bcf68adac@baylibre.com> References: <20230915-libyuv-convert-v1-0-1e5bcf68adac@baylibre.com> In-Reply-To: <20230915-libyuv-convert-v1-0-1e5bcf68adac@baylibre.com> To: libcamera-devel@lists.libcamera.org X-Mailer: b4 0.12.4-dev-6aa5d Subject: [libcamera-devel] [PATCH RFC 1/7] android: yuv: separate source destination in length check 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: , X-Patchwork-Original-From: Mattijs Korpershoek via libcamera-devel From: Mattijs Korpershoek Reply-To: Mattijs Korpershoek Cc: Guillaume La Roque Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Right now, the assumption of PostProcessorYuv is that both the source and the destination are in formats::NV12. This might change in the future, if we add other formats or pixel format conversion as supported in libyuv. Split out source and destination check to prepare for that. No functional change. Signed-off-by: Mattijs Korpershoek --- src/android/yuv/post_processor_yuv.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/android/yuv/post_processor_yuv.cpp b/src/android/yuv/post_processor_yuv.cpp index ed44e6fe02da..9631c9617154 100644 --- a/src/android/yuv/post_processor_yuv.cpp +++ b/src/android/yuv/post_processor_yuv.cpp @@ -133,14 +133,17 @@ void PostProcessorYuv::calculateLengths(const StreamConfiguration &inCfg, sourceSize_ = inCfg.size; destinationSize_ = outCfg.size; - const PixelFormatInfo &nv12Info = PixelFormatInfo::info(formats::NV12); + const PixelFormatInfo &sourceInfo = PixelFormatInfo::info(formats::NV12); for (unsigned int i = 0; i < 2; i++) { sourceStride_[i] = inCfg.stride; - destinationStride_[i] = nv12Info.stride(destinationSize_.width, i, 1); + sourceLength_[i] = sourceInfo.planeSize(sourceSize_.height, i, + sourceStride_[i]); + } - sourceLength_[i] = nv12Info.planeSize(sourceSize_.height, i, - sourceStride_[i]); - destinationLength_[i] = nv12Info.planeSize(destinationSize_.height, i, - destinationStride_[i]); + const PixelFormatInfo &destinationInfo = PixelFormatInfo::info(formats::NV12); + for (unsigned int i = 0; i < 2; i++) { + destinationStride_[i] = sourceInfo.stride(destinationSize_.width, i, 1); + destinationLength_[i] = sourceInfo.planeSize(destinationSize_.height, i, + destinationStride_[i]); } }