[FFmpeg-devel] [PATCH] avcodec/mathops: make zero_extend() an alias of av_mod_uintp2()

James Almer jamrial at gmail.com
Tue Feb 28 04:44:39 EET 2017


They both do the same thing, but the latter has arch optimized implementations.

Signed-off-by: James Almer <jamrial at gmail.com>
---
Alternatively, i could duplicate the optimizations from av_mod_uintp2()
for zero_extend() in libavcodec/{arch}/mathops.h since the c versions
differ between the two.

 libavcodec/mathops.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h
index 2cc8963a98..ddaea57da8 100644
--- a/libavcodec/mathops.h
+++ b/libavcodec/mathops.h
@@ -146,10 +146,7 @@ static inline av_const int sign_extend(int val, unsigned bits)
 #endif
 
 #ifndef zero_extend
-static inline av_const unsigned zero_extend(unsigned val, unsigned bits)
-{
-    return (val << ((8 * sizeof(int)) - bits)) >> ((8 * sizeof(int)) - bits);
-}
+#define zero_extend av_mod_uintp2
 #endif
 
 #ifndef COPY3_IF_LT
-- 
2.12.0



More information about the ffmpeg-devel mailing list