From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 1/3 v2] avutil: rename av_mod_uintp2 to av_zero_extend
Date: Tue, 11 Jun 2024 22:10:59 -0300
Message-ID: <20240612011101.7641-1-jamrial@gmail.com> (raw)
It's more descriptive of what it does.
Signed-off-by: James Almer <jamrial@gmail.com>
---
TODO: Version bump
doc/APIchanges | 3 +++
libavutil/common.h | 20 ++++++++++++++++----
libavutil/version.h | 1 +
libavutil/x86/intmath.h | 6 +++---
4 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index 891eaebf1a..a380e62466 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
API changes, most recent first:
+2024-06-12 - xxxxxxxxxx - lavu 59.22.100 - common.h
+ Deprecate av_mod_uintp2[_c]() and replace it with av_zero_extend[_c]().
+
2024-06-08 - xxxxxxxxxx - lavc 61.7.100 - defs.h
Add AV_PROFILE_AAC_USAC.
diff --git a/libavutil/common.h b/libavutil/common.h
index 3e4c339893..fa2333d181 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -42,6 +42,7 @@
#include "attributes.h"
#include "error.h"
#include "macros.h"
+#include "version.h"
#ifdef HAVE_AV_CONFIG_H
# include "config.h"
@@ -122,9 +123,6 @@
#ifndef av_clip_uintp2
# define av_clip_uintp2 av_clip_uintp2_c
#endif
-#ifndef av_mod_uintp2
-# define av_mod_uintp2 av_mod_uintp2_c
-#endif
#ifndef av_sat_add32
# define av_sat_add32 av_sat_add32_c
#endif
@@ -149,6 +147,9 @@
#ifndef av_clipd
# define av_clipd av_clipd_c
#endif
+#ifndef av_zero_extend
+# define av_zero_extend av_zero_extend_c
+#endif
#ifndef av_popcount
# define av_popcount av_popcount_c
#endif
@@ -288,11 +289,22 @@ static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
* @param p bit position to clip at
* @return clipped value
*/
-static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p)
+static av_always_inline av_const unsigned av_zero_extend_c(unsigned a, unsigned p)
{
return a & ((1U << p) - 1);
}
+#if FF_API_MOD_UINTP2
+#ifndef av_mod_uintp2
+# define av_mod_uintp2 av_mod_uintp2_c
+#endif
+attribute_deprecated
+static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p)
+{
+ return av_zero_extend_c(a, p);
+}
+#endif
+
/**
* Add two signed 32-bit values with saturation.
*
diff --git a/libavutil/version.h b/libavutil/version.h
index 9d08d56884..38456affb8 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -112,6 +112,7 @@
#define FF_API_PALETTE_HAS_CHANGED (LIBAVUTIL_VERSION_MAJOR < 60)
#define FF_API_VULKAN_CONTIGUOUS_MEMORY (LIBAVUTIL_VERSION_MAJOR < 60)
#define FF_API_H274_FILM_GRAIN_VCS (LIBAVUTIL_VERSION_MAJOR < 60)
+#define FF_API_MOD_UINTP2 (LIBAVUTIL_VERSION_MAJOR < 60)
/**
* @}
diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h
index 8a6b5ae261..821a06ab66 100644
--- a/libavutil/x86/intmath.h
+++ b/libavutil/x86/intmath.h
@@ -82,13 +82,13 @@ static av_always_inline av_const int ff_ctzll_x86(long long v)
#if defined(__BMI2__)
#if AV_GCC_VERSION_AT_LEAST(5,1)
-#define av_mod_uintp2 __builtin_ia32_bzhi_si
+#define av_zero_extend __builtin_ia32_bzhi_si
#elif HAVE_INLINE_ASM
/* GCC releases before 5.1.0 have a broken bzhi builtin, so for those we
* implement it using inline assembly
*/
-#define av_mod_uintp2 av_mod_uintp2_bmi2
-static av_always_inline av_const unsigned av_mod_uintp2_bmi2(unsigned a, unsigned p)
+#define av_zero_extend av_zero_extend_bmi2
+static av_always_inline av_const unsigned av_zero_extend_bmi2(unsigned a, unsigned p)
{
if (av_builtin_constant_p(p))
return a & ((1 << p) - 1);
--
2.45.2
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2024-06-12 1:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-12 1:10 James Almer [this message]
2024-06-12 1:11 ` [FFmpeg-devel] [PATCH 2/3 v2] avutil/common: assert that bit position in av_zero_extend is valid James Almer
2024-06-12 1:11 ` [FFmpeg-devel] [PATCH 3/3 v2] avcodec: use the renamed av_zero_extend James Almer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240612011101.7641-1-jamrial@gmail.com \
--to=jamrial@gmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git