mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-03 05:22:10 +00:00
avutil/common, macros: Move several macros from common.h to macros.h
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 <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
fd101c9c3b
commit
2dd8acbe80
@ -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
|
||||
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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, \
|
||||
|
Loading…
Reference in New Issue
Block a user