From patchwork Thu Oct 27 05:55:11 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: 17697 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 BD70FC3285 for ; Thu, 27 Oct 2022 05:55:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 66ADC62F89; Thu, 27 Oct 2022 07:55:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1666850133; 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=3Y/6G/zIwfLIJUP++Z9M1XnJnsz6XZMhehB1SnWMeP5yZfZ4kduEkobi7dhB/m0Ec eT+d9eBpsjFHYFdLuhjmQsOXaHdFOFWWuGD1bjaB0aSdoMqcXlhZXbS95inm3yQrBE 9kJ9EVpSVhI4+fM7Az9fWpQhA13wAii//WLa3UNLM11MBeO6MvYMQPD4QPLo2nHDgU Pgat5YhjxDDudpa46EOr6G+EJa/urJKzEVGbnTw+K297xupalj2qvpiw+0P2UZiR11 3YjT0S9qutFGRCVo1nJMp1Vc3RH9W4H/kD16bbSnx+u+Vg49O46SWK1JiYDXwlSwJ7 UNMqZUCZ7Vh5g== Received: from mail-oa1-x2a.google.com (mail-oa1-x2a.google.com [IPv6:2001:4860:4864:20::2a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AE3B862F76 for ; Thu, 27 Oct 2022 07:55:26 +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="pJy5FlJo"; dkim-atps=neutral Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-13b103a3e5dso702137fac.2 for ; Wed, 26 Oct 2022 22:55:26 -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=pJy5FlJoD1blm4OaOMfnlZWYNN6eXTUzFa4+GmZqKnMZ+hm+mVCSDl+48YN2XzjSnP kJqQUvifes1NouZJTbUD2ot0G82GxcGsHHFG4RyBPyE2TAn38xh/g6eXiTyPR6EXxR/1 Xf3WDe/HTuTfg80ZzdR7h3i0gjyx1+h88JqOS5P8n/ran6q2b6MI12y7sg5AHKGU5cv6 BF0JWAr9+tSj4IO41ibrE8I91WQBJRzTuGh5CbD68mgmUj7KUsVGaRw8/uQbExwEplQR vmcy0M7i3TOW4o5eAzx/lKi2trpIAqP17GiPurBhVFPBKbcoCWotXaLK3KaAUzwwarMy VoTg== 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=uWA3bvcBYVhwyKnV3iv4AnRClmKbPAI2s9Uk3fTOCwBb8OBOPFmhhegk36WMh25NND iQ8/ScT5mkYWwzzfzLHnKw3qte+l+ATV3uB7x1mytKUVX2lIQtS89MspInzU936PifSQ 1QbUDjaH5jDiWg0MM5wv7OmMzYtYtLONjcLhBNpKs5xozQx8E1q4+6VFHA6BG8CipMN9 Fpl3bXvX6yBQiG3lbe5iqQLwdxT4gzGRst1ZeZFrLYf7fOmagDu9tCYFYRZFxYqYXgXe fpJoTJyeI8SHxcOi8fEmLJSNkgxYV5qbbL7+oeXvQyg2qvmB4AOubnFSypgVNU6pgQaW jHnw== X-Gm-Message-State: ACrzQf16AkZJBEa4ft9sPrVk4gdvKliLQ2L/GlDiYfzjjuupt75mP25f WwPyomU7pSVYOw5luCUwV8pGgcAewEj7yTgs X-Google-Smtp-Source: AMsMyM6de7wW9IZUXlh3Q72VpYqii8C+S+ajK54vfH1U00uLXs9b6nYn22vGnjapsV/pwL7Xi3NGYA== X-Received: by 2002:a05:6871:794:b0:12c:4bff:341d with SMTP id o20-20020a056871079400b0012c4bff341dmr4425623oap.127.1666850125230; Wed, 26 Oct 2022 22:55:25 -0700 (PDT) Received: from nroth-pc.attlocal.net ([2600:1700:20:20c0:6406:fc7a:e46d:1666]) by smtp.gmail.com with ESMTPSA id 9-20020a9d0c09000000b00661a05691fasm140021otr.79.2022.10.26.22.55.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 22:55:25 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 27 Oct 2022 00:55:11 -0500 Message-Id: <20221027055515.321791-7-nicholas@rothemail.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027055515.321791-1-nicholas@rothemail.net> References: <20221027055515.321791-1-nicholas@rothemail.net> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 06/10] ipa: replaces 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 --- 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) { /*