From patchwork Mon Aug 26 15:08:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devarsh Thakkar X-Patchwork-Id: 99188 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by linuxtv.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sibL2-00077V-2v for patchwork@linuxtv.org; Mon, 26 Aug 2024 15:09:03 +0000 Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3B36428239F for ; Mon, 26 Aug 2024 15:09:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 417C3193061; Mon, 26 Aug 2024 15:08:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="ijqGN3++" X-Original-To: linux-media@vger.kernel.org Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47AB313B286; Mon, 26 Aug 2024 15:08:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.249 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724684925; cv=none; b=nmnvDHs+R2x9DS7xgXvBKmErowgKGhOMMEMFRL/ToHg3r2Xc+mDoH2vGrJfeF046eFrXmmv6/r+k/JG5tU3rMbBIBKm9NJAcw3beT8hftmqj2RtrsC5XEERKKITPY3sQ6iba3kjzjY7w/6HjXgc0KJ4f7oNFxOTNZA51MVrkG9s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724684925; c=relaxed/simple; bh=IS5O62vTquZGY9iCfoeiIpSDO0hBEfkkcs+K/HFrRBo=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=pu3d3p2pvVyqcX1rOQvDAFjuW9ZmkI/LJl7qUAnDyoLb7GSRBXyNXHah2l1NSDZ0tWgmnwJZeXBVHrttSFoE0+iATRH6r9kFfW8xwqF4sm9wDD7/CZ101qrdJgWhezcySNnwmoOQwPzYFQRP4LJTbu9GRMF9SluOwEysimVvw54= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=ijqGN3++; arc=none smtp.client-ip=198.47.23.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 47QF8OwG036649; Mon, 26 Aug 2024 10:08:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1724684904; bh=8SadMn9BIJuUjTDgmzUFfmBg/3FZu68BaYZYp7OppYg=; h=From:To:CC:Subject:Date; b=ijqGN3++9AMq+98M4ft6QqqXcXHl1J6AuXxkP9GmW57yxi/K61ABlHnB+lRiMdY8Y FicGMJuGPwnXwQeLfmlS9Fg5oZMslLbxdh1iSLDWUew3NL9x6rfDkx5ifaMyBczNlt JWZFzLkdsRiZFaHKHwpGlZu2iUydkkpqkGDcA6Vs= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 47QF8OJ0124004 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Aug 2024 10:08:24 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 26 Aug 2024 10:08:24 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 26 Aug 2024 10:08:24 -0500 Received: from localhost (ti.dhcp.ti.com [172.24.227.95] (may be forged)) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 47QF8NCb100774; Mon, 26 Aug 2024 10:08:23 -0500 From: Devarsh Thakkar To: , , , , , CC: , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 0/6] Add rounding macros and enable KUnit tests Date: Mon, 26 Aug 2024 20:38:16 +0530 Message-ID: <20240826150822.4057164-1-devarsht@ti.com> X-Mailer: git-send-email 2.39.1 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-LSpam-Score: -9.6 (---------) X-LSpam-Report: No, score=-9.6 required=5.0 tests=ARC_SIGNED=0.001,ARC_VALID=-0.1,BAYES_00=-1.9,DKIMWL_WL_HIGH=-1,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,DMARC_PASS=-0.001,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3,RCVD_IN_VALIDITY_CERTIFIED=-3,RCVD_IN_VALIDITY_RPBL=1.31,RCVD_IN_VALIDITY_SAFE=-2,SPF_HELO_NONE=0.001,SPF_PASS=-0.001 autolearn=ham autolearn_force=no This adds new rounding macros to round to closest integer along with enabling KUnit tests for all math.h macros. It also updates kernel-doc to render math.h related documentation and lastly updates the imagination jpeg encoder to use the newly introduced rounding macros to find nearest value. Also to note that math.h is orphaned and so these changes need to be pulled by subsystem using them as discussed in below threads: Link: https://lore.kernel.org/all/1db64af7-3688-4bcc-a671-9440d8f02d1a@xs4all.nl/ https://lore.kernel.org/all/ZmHDWeuezCEgj20m@smile.fi.intel.com/ Changelog: V2: - Fix grammar in new rounding off macro descriptions - Use roundup for rounclosest to avoid overflow Previous patch series: https://lore.kernel.org/all/20240708155943.2314427-1-devarsht@ti.com/#t Rangediff (V2->V1): https://gist.github.com/devarsht/a3c4420869d3f66fdc88e0af6a0f0a95 Daniel Latypov (1): lib: Add basic KUnit test for lib/math Devarsh Thakkar (5): math.h: Add macros for rounding to the closest value math.h: Use kernel-doc syntax for division macros Documentation: core-api: Add math.h macros and functions lib: math_kunit: Add tests for new macros related to rounding to nearest value media: imagination: Round to closest multiple for cropping region Documentation/core-api/kernel-api.rst | 6 + .../platform/imagination/e5010-jpeg-enc.c | 8 +- include/linux/math.h | 86 ++++- lib/math/Kconfig | 14 + lib/math/Makefile | 1 + lib/math/math_kunit.c | 329 ++++++++++++++++++ 6 files changed, 434 insertions(+), 10 deletions(-) create mode 100644 lib/math/math_kunit.c