1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

lavu/common: make FF_CEIL_RSHIFT faster when shift is constant.

See "[PATCH] lavfi/lut: use FF_CEIL_RSHIFT for chroma w/h rounding."
thread for more information.
This commit is contained in:
Clément Bœsch 2013-05-12 13:29:23 +02:00
parent 45150f90e7
commit b3c263e209

View File

@ -49,7 +49,8 @@
/* assume b>0 */ /* assume b>0 */
#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
/* assume a>0 and b>0 */ /* assume a>0 and b>0 */
#define FF_CEIL_RSHIFT(a,b) (-((-(a)) >> (b))) #define FF_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \
: ((a) + (1<<(b)) - 1) >> (b))
#define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b)) #define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b))
#define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b)) #define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b))
#define FFABS(a) ((a) >= 0 ? (a) : (-(a))) #define FFABS(a) ((a) >= 0 ? (a) : (-(a)))