From patchwork Mon Dec 6 15:26:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 15051 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 16438BDB13 for ; Mon, 6 Dec 2021 15:27:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C6FED60876; Mon, 6 Dec 2021 16:27:17 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="HuOlJK5Z"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9F0C160725 for ; Mon, 6 Dec 2021 16:27:16 +0100 (CET) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 487A0EE for ; Mon, 6 Dec 2021 16:27:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1638804436; bh=gVWCZydDSa/HjS8e+cxfkNjG9UHqytMMcAacRLITPcg=; h=From:To:Subject:Date:From; b=HuOlJK5ZWR/So8YdGbx05vgxkg/SuRBCKBd6zMksw7QXb19l5lcmf0vq1al0t/RFJ +JEHYYsq8QT8JRmQfLnAV35jK18qA6N8LWlPgIomhG6SYI8thE1z8ZmlfvNDfiY10/ N6dMvNygRVKzkdSQUCxzygQbPExhZuvljFex8W9A= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 6 Dec 2021 17:26:42 +0200 Message-Id: <20211206152644.4863-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 0/2] libcamera: Introduce utils::abs_diff() 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" Hello, The utils::abs_diff() function fixes integer overflow issues when computing the absolute difference of two values. See patch 1/2 for details, patch 2/2 then uses the function through the code base. Laurent Pinchart (2): libcamera: base: utils: Add abs_diff() utility function libcamera: Use utils::abs_diff() include/libcamera/base/utils.h | 9 +++++++++ src/ipa/ipu3/algorithms/agc.cpp | 3 ++- src/ipa/ipu3/ipu3.cpp | 4 ++-- src/ipa/rkisp1/algorithms/agc.cpp | 3 ++- src/libcamera/base/utils.cpp | 17 +++++++++++++++++ src/libcamera/pipeline/ipu3/imgu.cpp | 4 ++-- .../pipeline/raspberrypi/raspberrypi.cpp | 5 ++--- 7 files changed, 36 insertions(+), 9 deletions(-) base-commit: f8d2f17a3db5ac490d7b505253a98d6795c2b630