avutil: rename av_mod_uintp2 to av_zero_extend

It's more descriptive of what it does.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
James Almer 2024-06-11 13:42:17 -03:00 committed by Paul B Mahol
parent 60fe9b4f41
commit c24d1b47c3
4 changed files with 24 additions and 8 deletions

View File

@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
API changes, most recent first:
2024-06-13 - 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.

View File

@ -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.
*

View File

@ -79,7 +79,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 59
#define LIBAVUTIL_VERSION_MINOR 21
#define LIBAVUTIL_VERSION_MINOR 22
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@ -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)
/**
* @}

View File

@ -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);