From patchwork Fri Jul 23 17:04:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29039 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5d:965a:0:0:0:0:0 with SMTP id d26csp1560353ios; Fri, 23 Jul 2021 10:05:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvtNloz72v/MDLkVK0AG6DkSNgLA7Gqt+mi3+eX60jYQd0gHsBUGavJwGhHA+ALp8uAeqZ X-Received: by 2002:a17:906:7691:: with SMTP id o17mr5596568ejm.209.1627059900158; Fri, 23 Jul 2021 10:05:00 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id h14si9338420edq.245.2021.07.23.10.04.59; Fri, 23 Jul 2021 10:05:00 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=aSRXwZ+u; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7629568AA8A; Fri, 23 Jul 2021 20:04:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-oln040092070040.outbound.protection.outlook.com [40.92.70.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 32DA468AA8A for ; Fri, 23 Jul 2021 20:04:43 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pbsoe4FeVZN2Sei8yl4stTnjgtpLcVxNQoLnY0Tbe/uG1cNGUmTvlbLiB7R7LpIk8J3WcLltmlS+s6POhWgRz4TinG/I72FhBeqHMpo/SyBzGbfY+BM9amaq8lzWFHuJp9wduFjljt2gLsOxrUIrGqJuiy9e3pDbuN6XqTTG/yIj6P0avtueIN7p9+9CQJDMQ7JlKV5kVaq3PnHdKsxYaDuTYRnOdU6BjiuVavtNj7Ax0+ZSbBCvbKBl50CQOQTpWvuU4PsfLoEZQzq/z/7EzptlrdARKQGIQ9BIkxGFlrgf6sCNbL09jZTGf6sT0/xHBWEghjkYS9dcLKGN5F5mWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/LtT50lt1C1Q/2Vfuwg8BmvmN6kw/4LiK27ICQFUq7I=; b=QhY5tR5LnwARxmsZlTc2wBI8j+gByOV/dEoNKr7KspaFN1op/LYcdDhI0wPWr+EinsXwngFictg2QvlS18xpqJEdy4/PP6Y4v0NlCjKfBUIGzJ39TQ/IVmXRSoq6FHJm9iyJSMIu3YKFCJ2W9W4x1NRLQhqeHSfu8A4we8I86VyEiAgQthOB1LNCtItmNMMg6uEtOff7UkcVyn1FIFBSrKCMt2t9n6I9x3qspggjeWkIxFvaQ8WyzPUVghzCInmThsJ/bfTf9C2tg3xUzmPEyFPRO26Aofk0nlzEmfJBslGeJW0MGxJkJSQmKYm3ZMSI/nkZPampdXmx3nsjJXlAkg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/LtT50lt1C1Q/2Vfuwg8BmvmN6kw/4LiK27ICQFUq7I=; b=aSRXwZ+uz6LMLpngImmkqVEGCoRT77R3x1RU6zS2H4P01WWNUo3xbU3ZTBMbO6c68Yba9mB3IRHrrffputtcB1coxp9X0ThzjvH7OME+Wz/4nEfYhAQSanN4iwbOuh/d27WqDmHvRi8fIWzPfGtErkmSUObJrLpV2BRSk1gxu2q03NFqBT/BYPwefqBith2gj43RnUmJVTElphTZRHk9+0sO/zgc2ThN/v91zMSgHMpTbhZScheKL3rRuhApi3A4EgSHMtK3gjDXNO4GfPAz4fjCgbf8ujB0989qwVKVzthRRPJWZk/px7TyfYwBBxxhZ0UpH6eIIVu5a5g2awqDcg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (10.141.218.86) by AS8PR03MB7045.eurprd03.prod.outlook.com (20.182.240.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.25; Fri, 23 Jul 2021 17:04:41 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::c9b2:14f8:d555:6f2d]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::c9b2:14f8:d555:6f2d%7]) with mapi id 15.20.4352.029; Fri, 23 Jul 2021 17:04:41 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 23 Jul 2021 19:04:25 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [YYxMTQs9LTf73bvKVvY5kPqK/bE+zcQt] X-ClientProxiedBy: AM0PR02CA0025.eurprd02.prod.outlook.com (2603:10a6:208:3e::38) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210723170428.1653805-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.94.230) by AM0PR02CA0025.eurprd02.prod.outlook.com (2603:10a6:208:3e::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.25 via Frontend Transport; Fri, 23 Jul 2021 17:04:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aaa22050-2978-4f74-f570-08d94dfbf63a X-MS-Exchange-SLBlob-MailProps: q+fD6XS3/UIe78BGW2DBzJQrWpKnvOI5zIiWyhgJm4vW/bnQYtUvFZmMsgI2wxlarSmbMieHVv0U1owAtaMaD0k0zmH9CP8Gbj2MXVaIQ5unwwA7w/EK8vdKPl4nF6iUx15h14q36Oj66i90HAoqFzCpyub0Qmbj89uC0BJB+0USWGSIf7NmUPgUKDGjPrtzxY4RNCXGh+Dr5yWNKXsS8/C8eWZgIPA5yzGHd+CR3k2VR6b6yeOdXbMJhbzuXUfm+TB7HVHO3HhJGDZifapUVQ6Zk7IN74nARGvF+SIiyS2xRM+cm7h65azL5b1W4nWGg+ei76hRK+Xv7NHpqMk7qXSpvmKovKXltj1M4yH34pNnV2aQL7gJoh99m2z3tPOhIgL048dzn3DXRIj4UhF5bSK/LFc0mv8nyNL2Bz9zVPBVatTGo2uapN4UcWFbKfUFmtmVdhseYEkIORf1gnP/CXMgsySkW4jeyBWjbjTSdxOX/9FqmCzMuvt+nagQCyObXcdMA6QEjcxtKFso0MK2t41dCvENGR0e5dkR2KafYilBL+O5RqtItSquew9Fol4jFYcC7gGbQNzB4fN2n449s/fmWXbMvRU9+OYcQAo8qB9jfZF1blvRed99OkJkwsDAKuRpXk23lwiyMXU6/ZYhFQ7djl/kTgHI/qCWBF3v7HWoW61FNuXmoFvt6MiIROuAKOj5leEUgJBgJzhVd/0M4Q== X-MS-TrafficTypeDiagnostic: AS8PR03MB7045: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eM6xIUfrVr9nDS7tITgiDgTpQoeoQfkFVlHzyJPxM527jIscDJdlGnEUwkXJui0Qkff4NQe+gie0DHPYEix70hoHwwuNcdO+AAwmNYGEgUo6YCwkKP8BYMlY/MnCgZ4Dze67LILV21Xa2t5UJ97fbfGUXCBgairypzLH0f/a8ezKfq1DdSOmFfH60G8gw+PJN/7mNOMtKmMuA+CgOj5sdpncd1hG2qP0sSzr7j02CrtisTOIXjmrmkXo5y5WyrQaf93xgFPgJohSUfo6k+kxa99SzRTS9neLJRGDCvn3Vd8+momNIUoRuC235k1mN8ohc8XlZP4K9aBbEGW9B/UnAecnBPZHbY5VkQMFC52/dSfO+GJfLSUm9cHRnqxa59Do4XV9qdsANbfi8ZMy198T1oVkJcIRzmzMmNPzNIhzhhP58QF7JhIar7aM6rqZFl5h X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: x4iWExCxbKD5Si9y/qsfxCDMaQPbp1Tth/zupLWz+NO4Ul248SMTqnk1L/UeEb51qODYjHk2cgjkgTYPFemrl8vs1vK/tWuFoyJz6xl/Mk80rYq07HPyouYGK1h6IsytaJJDlcm9zRIpOKsbHaXyiQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: aaa22050-2978-4f74-f570-08d94dfbf63a X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jul 2021 17:04:41.6419 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7045 Subject: [FFmpeg-devel] [PATCH 3/6] avutil/common, macros: Move several macros from common.h to macros.h X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: DRtreAKOfCgc common.h currently contains several things: Math macros, UTF-8 macros, other fundamental macros; furthermore it also contains miscellaneous math functions and it (directly and indirectly) includes lots of other headers. This commit moves the "other fundamental macros" to macros.h which is a more fitting place. Signed-off-by: Andreas Rheinhardt --- I am unsure what to do with the other stuff in common.h: The math macros and the misc math functions could maybe be offloaded into an intmath.h header (with the current intmath.h being renamed to intmath_internal.h or so and included in intmath.h like intmath.h is currently included in common.h), but the problem is that there are also float functions among them (intmath.h also contains optimized versions of these, so maybe this is not a reason not to include such functions in a header of this name). doc/APIchanges | 5 +++++ libavutil/common.h | 29 ----------------------------- libavutil/macros.h | 30 ++++++++++++++++++++++++++++++ libavutil/version.h | 2 +- 4 files changed, 36 insertions(+), 30 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 9506059ac0..cd1902179f 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,11 @@ libavutil: 2021-04-27 API changes, most recent first: + +2021-07-23 - xxxxxxxxxx - lavu 57.3.100 - common.h macros.h + Move several macros (AV_NE, FFDIFFSIGN, FFMAX, FFMAX3, FFMIN, FFMIN3, + FFSWAP, FF_ARRAY_ELEMS, MKTAG, MKBETAG) from common.h to macros.h. + 2021-07-22 - xxxxxxxxxx - lavu 57.2.100 - film_grain_params.h Add AV_FILM_GRAIN_PARAMS_H274, AVFilmGrainH274Params diff --git a/libavutil/common.h b/libavutil/common.h index aee353d399..3cc1f07566 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -42,13 +42,6 @@ #include "attributes.h" #include "macros.h" #include "version.h" -#include "libavutil/avconfig.h" - -#if AV_HAVE_BIGENDIAN -# define AV_NE(be, le) (be) -#else -# define AV_NE(be, le) (le) -#endif //rounded division & shift #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) @@ -89,25 +82,6 @@ #define FFABSU(a) ((a) <= 0 ? -(unsigned)(a) : (unsigned)(a)) #define FFABS64U(a) ((a) <= 0 ? -(uint64_t)(a) : (uint64_t)(a)) -/** - * Comparator. - * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 - * if x == y. This is useful for instance in a qsort comparator callback. - * Furthermore, compilers are able to optimize this to branchless code, and - * there is no risk of overflow with signed types. - * As with many macros, this evaluates its argument multiple times, it thus - * must not have a side-effect. - */ -#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y))) - -#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) -#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) -#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) -#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) - -#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) -#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) - /* misc math functions */ #ifdef HAVE_AV_CONFIG_H @@ -475,9 +449,6 @@ static av_always_inline av_const int av_parity_c(uint32_t v) return av_popcount(v) & 1; } -#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) -#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) - /** * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form. * diff --git a/libavutil/macros.h b/libavutil/macros.h index 2007ee5619..2a7567c3ea 100644 --- a/libavutil/macros.h +++ b/libavutil/macros.h @@ -25,6 +25,36 @@ #ifndef AVUTIL_MACROS_H #define AVUTIL_MACROS_H +#include "libavutil/avconfig.h" + +#if AV_HAVE_BIGENDIAN +# define AV_NE(be, le) (be) +#else +# define AV_NE(be, le) (le) +#endif + +/** + * Comparator. + * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 + * if x == y. This is useful for instance in a qsort comparator callback. + * Furthermore, compilers are able to optimize this to branchless code, and + * there is no risk of overflow with signed types. + * As with many macros, this evaluates its argument multiple times, it thus + * must not have a side-effect. + */ +#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y))) + +#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) +#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) +#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) +#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) + +#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) +#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) + +#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) +#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) + /** * @addtogroup preproc_misc Preprocessor String Macros * diff --git a/libavutil/version.h b/libavutil/version.h index 77ca4becd6..6b4a265457 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 57 -#define LIBAVUTIL_VERSION_MINOR 2 +#define LIBAVUTIL_VERSION_MINOR 3 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \