[FFmpeg-cvslog] lavu/common: make FF_CEIL_RSHIFT faster when shift is constant.

Clément Bœsch git at videolan.org
Mon May 13 17:53:26 CEST 2013


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Sun May 12 13:29:23 2013 +0200| [b3c263e20925628eabf785afae5a9d7cc5d8bb4d] | committer: Clément Bœsch

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.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b3c263e20925628eabf785afae5a9d7cc5d8bb4d
---

 libavutil/common.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/common.h b/libavutil/common.h
index 9091070..c7c32fd 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -49,7 +49,8 @@
 /* assume b>0 */
 #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
 /* 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 FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b))
 #define FFABS(a) ((a) >= 0 ? (a) : (-(a)))



More information about the ffmpeg-cvslog mailing list