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.
Unified · Split
| @@ -13,6 +13,11 @@ libavutil: 2021-04-27 · 12 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | API changes, most recent first: |
| 16 | + | |
| 17 | +2021-07-23 - xxxxxxxxxx - lavu 57.3.100 - common.h macros.h | |
| 18 | + Move several macros (AV_NE, FFDIFFSIGN, FFMAX, FFMAX3, FFMIN, FFMIN3, | |
| 19 | + FFSWAP, FF_ARRAY_ELEMS, MKTAG, MKBETAG) from common.h to macros.h. | |
| 20 | + | |
| 16 | 21 | 2021-07-22 - xxxxxxxxxx - lavu 57.2.100 - film_grain_params.h |
| 17 | 22 | Add AV_FILM_GRAIN_PARAMS_H274, AVFilmGrainH274Params |
| 18 | 23 | |
| @@ -42,13 +42,6 @@ · 41 unmodified lines | ||
| 42 | 42 | #include "attributes.h" |
| 43 | 43 | #include "macros.h" |
| 44 | 44 | #include "version.h" |
| 45 | −#include "libavutil/avconfig.h" | |
| 46 | − | |
| 47 | −#if AV_HAVE_BIGENDIAN | |
| 48 | −# define AV_NE(be, le) (be) | |
| 49 | −#else | |
| 50 | −# define AV_NE(be, le) (le) | |
| 51 | −#endif | |
| 52 | 45 | |
| 53 | 46 | //rounded division & shift |
| 54 | 47 | #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) |
| @@ -89,25 +82,6 @@ · 34 unmodified lines | ||
| 89 | 82 | #define FFABSU(a) ((a) <= 0 ? -(unsigned)(a) : (unsigned)(a)) |
| 90 | 83 | #define FFABS64U(a) ((a) <= 0 ? -(uint64_t)(a) : (uint64_t)(a)) |
| 91 | 84 | |
| 92 | −/** | |
| 93 | − * Comparator. | |
| 94 | − * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 | |
| 95 | − * if x == y. This is useful for instance in a qsort comparator callback. | |
| 96 | − * Furthermore, compilers are able to optimize this to branchless code, and | |
| 97 | − * there is no risk of overflow with signed types. | |
| 98 | − * As with many macros, this evaluates its argument multiple times, it thus | |
| 99 | − * must not have a side-effect. | |
| 100 | − */ | |
| 101 | −#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y))) | |
| 102 | − | |
| 103 | −#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) | |
| 104 | −#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) | |
| 105 | −#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) | |
| 106 | −#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) | |
| 107 | − | |
| 108 | −#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) | |
| 109 | −#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) | |
| 110 | − | |
| 111 | 85 | /* misc math functions */ |
| 112 | 86 | |
| 113 | 87 | #ifdef HAVE_AV_CONFIG_H |
| @@ -475,9 +449,6 @@ static av_always_inline av_const int av_parity_c(uint32_t v) · 361 unmodified lines | ||
| 475 | 449 | return av_popcount(v) & 1; |
| 476 | 450 | } |
| 477 | 451 | |
| 478 | −#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) | |
| 479 | −#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) | |
| 480 | − | |
| 481 | 452 | /** |
| 482 | 453 | * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form. |
| 483 | 454 | * |
| @@ -25,6 +25,36 @@ · 24 unmodified lines | ||
| 25 | 25 | #ifndef AVUTIL_MACROS_H |
| 26 | 26 | #define AVUTIL_MACROS_H |
| 27 | 27 | |
| 28 | +#include "libavutil/avconfig.h" | |
| 29 | + | |
| 30 | +#if AV_HAVE_BIGENDIAN | |
| 31 | +# define AV_NE(be, le) (be) | |
| 32 | +#else | |
| 33 | +# define AV_NE(be, le) (le) | |
| 34 | +#endif | |
| 35 | + | |
| 36 | +/** | |
| 37 | + * Comparator. | |
| 38 | + * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 | |
| 39 | + * if x == y. This is useful for instance in a qsort comparator callback. | |
| 40 | + * Furthermore, compilers are able to optimize this to branchless code, and | |
| 41 | + * there is no risk of overflow with signed types. | |
| 42 | + * As with many macros, this evaluates its argument multiple times, it thus | |
| 43 | + * must not have a side-effect. | |
| 44 | + */ | |
| 45 | +#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y))) | |
| 46 | + | |
| 47 | +#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) | |
| 48 | +#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) | |
| 49 | +#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) | |
| 50 | +#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) | |
| 51 | + | |
| 52 | +#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) | |
| 53 | +#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) | |
| 54 | + | |
| 55 | +#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) | |
| 56 | +#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) | |
| 57 | + | |
| 28 | 58 | /** |
| 29 | 59 | * @addtogroup preproc_misc Preprocessor String Macros |
| 30 | 60 | * |
| @@ -79,7 +79,7 @@ · 78 unmodified lines | ||
| 79 | 79 | */ |
| 80 | 80 | |
| 81 | 81 | #define LIBAVUTIL_VERSION_MAJOR 57 |
| 82 | −#define LIBAVUTIL_VERSION_MINOR 2 | |
| 82 | +#define LIBAVUTIL_VERSION_MINOR 3 | |
| 83 | 83 | #define LIBAVUTIL_VERSION_MICRO 100 |
| 84 | 84 | |
| 85 | 85 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |