]> granicus.if.org Git - libx264/commitdiff
Add stack alignment for lookahead functions
authorFiona Glaser <fiona@x264.com>
Wed, 31 Dec 2008 03:14:45 +0000 (22:14 -0500)
committerFiona Glaser <fiona@x264.com>
Wed, 31 Dec 2008 13:27:48 +0000 (08:27 -0500)
Should allow libx264 to be called from non-gcc-compiled applications without adding force_align_arg_pointer.

common/cpu.h
encoder/encoder.c
encoder/ratecontrol.c

index b004023aa236c43fd021861aeb73abcde99851c6..4380a3598b5860c8f6f3d2fcbd881c1816f44090 100644 (file)
@@ -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
index ce8a1f8d66995c5aa7444707e3e721660ce8fda6..abe4b92e7c58aa643bb97122a58605097c48107b 100644 (file)
@@ -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 ) )
index 816fe3d29722dfbbd15e7574e95030bc16037937..c552aa79ab734796672b57f6b4cc03ab1fa372ff 100644 (file)
@@ -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;