[x264-devel] commit: Deduplicate the ALIGN macro, move it to common.h (Nathan Caldwell )

git at videolan.org git at videolan.org
Wed Jun 9 20:38:03 CEST 2010


x264 | branch: master | Nathan Caldwell <saintdev at gmail.com> | Sun Jun  6 14:19:41 2010 -0600| [0d0dc6a720f5a41add8989cfa29090cf48d6028f] | committer: Jason Garrett-Glaser 

Deduplicate the ALIGN macro, move it to common.h

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=0d0dc6a720f5a41add8989cfa29090cf48d6028f
---

 common/common.h     |    1 +
 common/frame.c      |    2 --
 common/macroblock.c |    2 --
 3 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/common/common.h b/common/common.h
index 06b6256..0fc0e67 100644
--- a/common/common.h
+++ b/common/common.h
@@ -36,6 +36,7 @@
 #define XCHG(type,a,b) do{ type t = a; a = b; b = t; } while(0)
 #define IS_DISPOSABLE(type) ( type == X264_TYPE_B )
 #define FIX8(f) ((int)(f*(1<<8)+.5))
+#define ALIGN(x,a) (((x)+((a)-1))&~((a)-1))
 
 #define CHECKED_MALLOC( var, size )\
 do {\
diff --git a/common/frame.c b/common/frame.c
index 44c579e..d1af24c 100644
--- a/common/frame.c
+++ b/common/frame.c
@@ -24,8 +24,6 @@
 
 #include "common.h"
 
-#define ALIGN(x,a) (((x)+((a)-1))&~((a)-1))
-
 x264_frame_t *x264_frame_new( x264_t *h, int b_fdec )
 {
     x264_frame_t *frame;
diff --git a/common/macroblock.c b/common/macroblock.c
index abf1659..08e3c78 100644
--- a/common/macroblock.c
+++ b/common/macroblock.c
@@ -257,7 +257,6 @@ int x264_macroblock_cache_allocate( x264_t *h )
     if( h->param.analyse.i_weighted_pred )
     {
         int i_padv = PADV << h->param.b_interlaced;
-#define ALIGN(x,a) (((x)+((a)-1))&~((a)-1))
         int align = h->param.cpu&X264_CPU_CACHELINE_64 ? 64 : h->param.cpu&X264_CPU_CACHELINE_32 ? 32 : 16;
         int i_stride, luma_plane_size = 0;
         int numweightbuf;
@@ -291,7 +290,6 @@ int x264_macroblock_cache_allocate( x264_t *h )
 
         for( int i = 0; i < numweightbuf; i++ )
             CHECKED_MALLOC( h->mb.p_weight_buf[i], luma_plane_size * sizeof(pixel) );
-#undef ALIGN
     }
 
     return 0;



More information about the x264-devel mailing list