From patchwork Fri Oct 28 03:17:22 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: 17718 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 13B32C3285 for ; Fri, 28 Oct 2022 03:17:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C6CCD62FC4; Fri, 28 Oct 2022 05:17:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1666927062; 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=0fjSDZMjtJPrmfYnHp2l+NJu2KE+r8pldLg1aaBcSAE8Dr/PeaxrLifbIPrLvSq34 +LFk3APlGYjliwXGYjpF4ZaSmvOYqLMMPq/w4MeBo4j72W1N2KgTDyx7Z5nmXQ6PSX rghwmfjMcY2Tn980c+mK+ayNgBu+IZbgzlkiZQo4qpjBADofrgXLtwByinGBbEyEHO yozwdN3mKsbFRRpZ4w17uRQE/KNH9BANiPoNwbuaYG5oueCdmAIkJi1e/P/rDfQHAy LZhCdZ+6AqZIIsaQWjCMYBQBsE4ECi5V9scTtB/1nhJmcjMfXI/YrBmN6uZPTkZoUM FnZnkPQ+PngFg== Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8E77562FB5 for ; Fri, 28 Oct 2022 05:17:35 +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="JwNSZccG"; dkim-atps=neutral Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-12c8312131fso4995354fac.4 for ; Thu, 27 Oct 2022 20:17:35 -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=JwNSZccGijEqrToI0s2uAb523FPaK7YRYZjHoqvCozsBau94Xg5o0uuFhh9UR4ROeV kkaAfBtMGXNUOX+pOUnsExe1ipi8HNvzmNFIGBKBexo48T9LAJz8mCUWLpQgNDvZt/7S Vvim4NlDCG6vuUDkyCIdZXpOuNXpt/cI5eo4anfA54LuMQZWY81H4W2devg8YAG84BEd eKoyIM7c5d1q/V2EzUAmp9h+cGB2HgPKWhIoj/fQcRng22uRFVaBJb0UP6c9UO9X0CYC 5WMXf82EYe5/19QCD5p03/PVhk/2Kzqkr7RUjBC5LZYedD9l3wXTNxm2JLy1Mfs4hdRl YjoQ== 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=mW9M60h5/H+kJeY7iE7X4O9NjuE3OY451Q0hSZHRui56G8bjKM54UIfwYULfdLHdcT 2d+w7qRkrBlVBp8NZWVfab+THNRAyiCfA/13rrrFKIVPq8MDQXcmL7JWnqxN77uIwXDv gKejnZHLavZhGOBy9Wtm3rIKVfMvv48EI4ypxmhhM2hA3/lwWthNab7rFkAT2ecKLfCQ 48gFgq3p9r/AaHJTvKfLYSFP35GEDhgY/zhh6aQf2sHGAHO6KBkRAe+nNS7bZib+McyF DGZFjirnE+A1CRCESMkT+xdP+8xQWoTE3yQsF6WXQP2xoRASAu0tPYxBuy2OtxIDgzQg aiKw== X-Gm-Message-State: ACrzQf1YuXkUzzqDlo+vl83FyXN3W3X/eoQttm1XkFG3sU+HBKOEoWMx 8CiOTgXfdElmttCn8Os3+GhnFRjN8QGZc3Rl+fM= X-Google-Smtp-Source: AMsMyM5Ck4hasarzQ77XKMryQZzln96CcKyMmKPhrvhIInxcMTlRBoEBmmVeQJmElcdpz8/ktK/kiw== X-Received: by 2002:a05:6870:f21b:b0:13a:ffec:f7ba with SMTP id t27-20020a056870f21b00b0013affecf7bamr7969090oao.218.1666927053860; Thu, 27 Oct 2022 20:17:33 -0700 (PDT) Received: from nroth-pc.attlocal.net ([2600:1700:20:20c0:293a:90ce:6463:244d]) by smtp.gmail.com with ESMTPSA id fp19-20020a056870659300b0013626c1a5f6sm1527738oab.10.2022.10.27.20.17.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 20:17:33 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 27 Oct 2022 22:17:22 -0500 Message-Id: <20221028031726.4849-7-nicholas@rothemail.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221028031726.4849-1-nicholas@rothemail.net> References: <20221027224135.348115-1-nicholas@rothemail.net> <20221028031726.4849-1-nicholas@rothemail.net> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 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 Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham Reviewed-by: Naushir Patuck --- 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) { /*