Commit 52b8a053 authored by Loren Merritt's avatar Loren Merritt

workaround: on some systems, alloca() isn't aligned


git-svn-id: svn://svn.videolan.org/x264/trunk@566 df754926-b1dd-0310-bc7b-ec298dee348c
parent 7bfc7360
......@@ -37,9 +37,11 @@
#define X264_VERSION "" // no configure script for msvc
#endif
/* alloca */
/* alloca: force 16byte alignment */
#ifdef _MSC_VER
#define alloca _alloca
#define x264_alloca(x) (void*)(((intptr_t)_alloca((x)+15)+15)&~15)
#else
#define x264_alloca(x) (void*)(((intptr_t) alloca((x)+15)+15)&~15)
#endif
/* threads */
......
......@@ -379,8 +379,8 @@ float x264_pixel_ssim_wxh( x264_pixel_function_t *pf,
{
int x, y, z;
float ssim = 0.0;
int (*sum0)[4] = alloca(4 * (width/4+3) * sizeof(int));
int (*sum1)[4] = alloca(4 * (width/4+3) * sizeof(int));
int (*sum0)[4] = x264_alloca(4 * (width/4+3) * sizeof(int));
int (*sum1)[4] = x264_alloca(4 * (width/4+3) * sizeof(int));
width >>= 2;
height >>= 2;
z = 0;
......
......@@ -467,7 +467,7 @@ me_hex2:
int enc_dc[4];
int sad_size = i_pixel <= PIXEL_8x8 ? PIXEL_8x8 : PIXEL_4x4;
int delta = x264_pixel_size[sad_size].w;
uint16_t *ads = alloca((max_x-min_x+8) * sizeof(uint16_t));
uint16_t *ads = x264_alloca((max_x-min_x+8) * sizeof(uint16_t));
h->pixf.sad_x4[sad_size]( zero, m->p_fenc[0], m->p_fenc[0]+delta,
m->p_fenc[0]+delta*FENC_STRIDE, m->p_fenc[0]+delta+delta*FENC_STRIDE,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment