From patchwork Thu Oct 27 22:41:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Dufresne via libcamera-devel X-Patchwork-Id: 17705 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 A3D05C3285 for ; Thu, 27 Oct 2022 22:41:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4C1CA62FB5; Fri, 28 Oct 2022 00:41:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1666910510; bh=3SsAYU1JMVdyMQ/zKyB1Y/Gfebk17k1NLKqdg6/vOfI=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=JK+/lwHM4LsoYMVGdK/EciTAzWE7gSm5GKPJSGHl64N51FeoU+F1DMBEL2tlvSo/R 2nq2Hx9ISOwsdcVd82Xxdia5TW0fsTo87Qmuuor5hIeGx4WgSQvle5hpwmZPq+7XYk 9KMj8w9bBb6+GU+pcJEfPxy+0F3c38t02CTe1DmglbyZVzKni5zxbHvnD0TfHXco0O GfjIvozYOMRR22nzZds6u7wRizRBUr90X7cupv6oLjl4kObRcVmcZEkXkuVTn3vSaq C+FmHN1GJir/avXeA58v/MNztA05yVIh2CBM1uf7iYhuAZYqtk9VApFm2CMEl3gXHC hJccRL5WCAWsQ== Received: from mail-oa1-x32.google.com (mail-oa1-x32.google.com [IPv6:2001:4860:4864:20::32]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C744F62FAB for ; Fri, 28 Oct 2022 00:41:44 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=rothemail-net.20210112.gappssmtp.com header.i=@rothemail-net.20210112.gappssmtp.com header.b="0MhM2v8T"; dkim-atps=neutral Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-1322d768ba7so4314628fac.5 for ; Thu, 27 Oct 2022 15:41:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rothemail-net.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=RPptAfrtD7k2o7VEK6frv0lekwlYg6ZLNrxS93bfFPA=; b=0MhM2v8TAfRmtn2vOniLGNGEMvY38mode8Q3Hlg6qinP2mvKAujcHfUTak/TqGytz5 ab+aLikr3lfH9iUUsrcI4nvloOdQiq3GcJyUqrqbHG3PvfByRNblJo79/2ylMIBHplax 3TV7pXfNf4aIViGeCPtux1n4U7qkCPLi2g2AGGetid/f+uDtKe6uMblc4zq89puuRXXX 1ik4/xKS0ZlWsDkZY9MzdJwRnaYWvx+/2MoAiN9zd1OPi0WsfnMen9QRb3NKqjyFGTW8 WIZdhEZFxnY7iiQ/Kr550tTYjj+3Osh759MzEYKR+ZsrwB4QCDiHh4KpXMQdPuMqmk/+ SkHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=RPptAfrtD7k2o7VEK6frv0lekwlYg6ZLNrxS93bfFPA=; b=eTa/1Mm20rSylivaLRP0EbxfAgDxafJjbAeCLeFqkjfQpgeWG7v9swm3Q6iE0qFl1r sO0xsru1MwfJevIgFUPI4zPPaC0sa+5lU9vG5vgHNcUMTt/dMuYILIE4yTWQvubb+0mR zafeNlvGe9CdfbexSyI7Ny6W9oqwpOvNQhDl+VRxm/nNPAjrtZgUPiGxIrmPkfsbYbh1 EtuJP+vNGHhCU8vKe305w+SyZDI3KdAs+T2KoUelSh0FuBetOlooesWyBVVIqJnSDgut sgbExfCBgOWK+6clW1bXseSAVcvlLUaN+8AbnUA4Nb49zJ9NCpQLdGjYRi9eKL6AVcyR yCuQ== X-Gm-Message-State: ACrzQf2kDZ2+7mR0SA+YH1J7N3oYQ3FX6b8xLKekJmLand5tgZHZSZn1 sxU89Tnd9u/8wJ2alxj0uGM5lR3RiwPAteie X-Google-Smtp-Source: AMsMyM76cmhi7yJSt28cZlYREOVbq0joiiSzhjw0qGOsIJxwD41vfqWSf65r5sQp+riItjcrE3VeLg== X-Received: by 2002:a05:6870:630f:b0:132:8af2:c8f2 with SMTP id s15-20020a056870630f00b001328af2c8f2mr7183365oao.284.1666910504054; Thu, 27 Oct 2022 15:41:44 -0700 (PDT) Received: from nroth-pc.attlocal.net ([2600:1700:20:20c0:6a4b:7aa7:dda2:75cb]) by smtp.gmail.com with ESMTPSA id r20-20020a056830419400b006619533d1ddsm976825otu.76.2022.10.27.15.41.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 15:41:43 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 27 Oct 2022 17:41:31 -0500 Message-Id: <20221027224135.348115-7-nicholas@rothemail.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027224135.348115-1-nicholas@rothemail.net> References: <20221027224135.348115-1-nicholas@rothemail.net> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 06/10] ipa: raspberry: replace abs() with std::abs() 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: Nicholas Roth via libcamera-devel From: Nicolas Dufresne via libcamera-devel Reply-To: libcamera-devel@lists.libcamera.org Cc: nicholas@rothemail.net Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Nicholas Roth pwl.cpp uses abs() instead of std::abs(), which causes unexpected behavior in the Clang compiler used for Android. Replace with C++-standard absolute value function std::abs(), which supports double-precision absolute values in a standard way. Signed-off-by: Nicholas Roth --- src/ipa/raspberrypi/controller/pwl.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ipa/raspberrypi/controller/pwl.cpp b/src/ipa/raspberrypi/controller/pwl.cpp index c59f5fa1..70c2e24b 100644 --- a/src/ipa/raspberrypi/controller/pwl.cpp +++ b/src/ipa/raspberrypi/controller/pwl.cpp @@ -6,6 +6,7 @@ */ #include +#include #include #include "pwl.h" @@ -168,7 +169,7 @@ Pwl Pwl::compose(Pwl const &other, const double eps) const while (thisSpan != (int)points_.size() - 1) { double dx = points_[thisSpan + 1].x - points_[thisSpan].x, dy = points_[thisSpan + 1].y - points_[thisSpan].y; - if (abs(dy) > eps && + if (std::abs(dy) > eps && otherSpan + 1 < (int)other.points_.size() && points_[thisSpan + 1].y >= other.points_[otherSpan + 1].x + eps) { @@ -181,7 +182,7 @@ Pwl Pwl::compose(Pwl const &other, const double eps) const points_[thisSpan].y) * dx / dy; thisY = other.points_[++otherSpan].x; - } else if (abs(dy) > eps && otherSpan > 0 && + } else if (std::abs(dy) > eps && otherSpan > 0 && points_[thisSpan + 1].y <= other.points_[otherSpan - 1].x - eps) { /*