[x264-devel] commit: Add stack alignment for lookahead functions (Jason Garrett-Glaser )

git version control git at videolan.org
Wed Dec 31 14:28:01 CET 2008


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Tue Dec 30 22:14:45 2008 -0500| [390d26ad2ca72b420448c36a747d3ee49b79e75b] | committer: Jason Garrett-Glaser 

Add stack alignment for lookahead functions
Should allow libx264 to be called from non-gcc-compiled applications without adding force_align_arg_pointer.

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

 common/cpu.h          |    3 ++-
 encoder/encoder.c     |    2 +-
 encoder/ratecontrol.c |    4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/common/cpu.h b/common/cpu.h
index b004023..4380a35 100644
--- a/common/cpu.h
+++ b/common/cpu.h
@@ -35,7 +35,8 @@ void     x264_cpu_mask_misalign_sse( void );
  * This applies only to x86_32, since other architectures that need alignment
  * also have ABIs that ensure aligned stack. */
 #if defined(ARCH_X86) && defined(HAVE_MMX)
-void x264_stack_align( void (*func)(x264_t*), x264_t *arg );
+int x264_stack_align( void (*func)(x264_t*), x264_t *arg );
+#define x264_stack_align(func,arg) x264_stack_align((void (*)(x264_t*))func,arg)
 #else
 #define x264_stack_align(func,arg) func(arg)
 #endif
diff --git a/encoder/encoder.c b/encoder/encoder.c
index 5ecab7e..fd86a18 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -1436,7 +1436,7 @@ int     x264_encoder_encode( x264_t *h,
             return 0;
         }
 
-        x264_slicetype_decide( h );
+        x264_stack_align( x264_slicetype_decide, h );
 
         /* 3: move some B-frames and 1 non-B to encode queue */
         while( IS_X264_TYPE_B( h->frames.next[bframes]->i_type ) )
diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index 5a74172..2b876d3 100644
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -1507,7 +1507,7 @@ static float rate_estimate_qscale( x264_t *h )
                     expected_size = qscale2bits(&rce, q);
                     expected_vbv = rcc->buffer_fill + rcc->buffer_rate - expected_size;
                 }
-                rcc->last_satd = x264_rc_analyse_slice( h );
+                rcc->last_satd = x264_stack_align( x264_rc_analyse_slice, h );
             }
             q = x264_clip3f( q, lmin, lmax );
         }
@@ -1525,7 +1525,7 @@ static float rate_estimate_qscale( x264_t *h )
 
             double wanted_bits, overflow=1, lmin, lmax;
 
-            rcc->last_satd = x264_rc_analyse_slice( h );
+            rcc->last_satd = x264_stack_align( x264_rc_analyse_slice, h );
             rcc->short_term_cplxsum *= 0.5;
             rcc->short_term_cplxcount *= 0.5;
             rcc->short_term_cplxsum += rcc->last_satd;



More information about the x264-devel mailing list