Skip to content

Commit

Permalink
Use ALIGNED() macro instead of ALIGNED_POINTER() for stack variables
Browse files Browse the repository at this point in the history
 Caused problems in some platforms e.g. i386
  • Loading branch information
fador committed Aug 14, 2024
1 parent a563b9f commit 6bd2373
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/search_intra.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,9 @@ static void search_intra_chroma_rough(encoder_state_t * const state,
cost_pixel_nxn_func *const satd_func = kvz_pixels_get_satd_func(width);
//cost_pixel_nxn_func *const sad_func = kvz_pixels_get_sad_func(width);

kvz_pixel _pred[32 * 32 + SIMD_ALIGNMENT];
kvz_pixel *pred = ALIGNED_POINTER(_pred, SIMD_ALIGNMENT);
ALIGNED(SIMD_ALIGNMENT) kvz_pixel pred[32 * 32];

kvz_pixel _orig_block[32 * 32 + SIMD_ALIGNMENT];
kvz_pixel *orig_block = ALIGNED_POINTER(_orig_block, SIMD_ALIGNMENT);
ALIGNED(SIMD_ALIGNMENT) kvz_pixel orig_block[32 * 32];

kvz_pixels_blit(orig_u, orig_block, width, width, origstride, width);
for (int i = 0; i < 5; ++i) {
Expand Down Expand Up @@ -408,11 +406,9 @@ static int8_t search_intra_rough(encoder_state_t * const state,
const bool filter_boundary = !(cfg->lossless && cfg->implicit_rdpcm);

// Temporary block arrays
kvz_pixel _preds[PARALLEL_BLKS * 32 * 32 + SIMD_ALIGNMENT];
pred_buffer preds = ALIGNED_POINTER(_preds, SIMD_ALIGNMENT);

kvz_pixel _orig_block[32 * 32 + SIMD_ALIGNMENT];
kvz_pixel *orig_block = ALIGNED_POINTER(_orig_block, SIMD_ALIGNMENT);
ALIGNED(SIMD_ALIGNMENT) kvz_pixel _preds[PARALLEL_BLKS * 32 * 32];
pred_buffer preds = (pred_buffer)_preds;
ALIGNED(SIMD_ALIGNMENT) kvz_pixel orig_block[32 * 32];

// Store original block for SAD computation
kvz_pixels_blit(orig, orig_block, width, width, origstride, width);
Expand Down

0 comments on commit 6bd2373

Please sign in to comment.