Aligned ps_pic_pu to 4 bytes
stmia was resulting in SEGV_MAPERR when ps_pic_pu is not aligned to 4 bytes
Bugfix: 24686670, 21468583
Change-Id: I07672d4a790f73cf27964983350181e66edc4d57
diff --git a/common/ihevc_macros.h b/common/ihevc_macros.h
index b3fb743..27d4f30 100644
--- a/common/ihevc_macros.h
+++ b/common/ihevc_macros.h
@@ -49,6 +49,7 @@
#define ALIGN32(x) ((((x) + 31) >> 5) << 5)
#define ALIGN16(x) ((((x) + 15) >> 4) << 4)
#define ALIGN8(x) ((((x) + 7) >> 3) << 3)
+#define ALIGN4(x) ((((x) + 3) >> 2) << 2)
#define ALIGN_POW2(ptr,align) ((((WORD32)ptr)+align-1)&(~(align-1)))
diff --git a/decoder/ihevcd_utils.c b/decoder/ihevcd_utils.c
index c46a4e6..aec64e2 100644
--- a/decoder/ihevcd_utils.c
+++ b/decoder/ihevcd_utils.c
@@ -354,6 +354,8 @@
/* Size for storing pu_t for each PU */
mv_bank_size += num_pu * sizeof(pu_t);
+ /* Size for storing slice_idx for each CTB */
+ mv_bank_size += ALIGN4(num_ctb * sizeof(UWORD16));
size = mv_bank_size;
return size;
@@ -720,7 +722,7 @@
pu1_buf += num_pu;
ps_mv_buf->pu1_pic_slice_map = (UWORD16 *)pu1_buf;
- pu1_buf += num_ctb * sizeof(UWORD16);
+ pu1_buf += ALIGN4(num_ctb * sizeof(UWORD16));
ps_mv_buf->ps_pic_pu = (pu_t *)pu1_buf;