aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-03-20 02:38:57 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-03-20 02:38:57 +0000
commit622972a821bd6adb24a3366d1afe86194b9d5931 (patch)
tree057f446c25247cf6e1fbe5e91c810e1b140bf7fc
parent85b96647897c82b32357888c83bc9dab8881f970 (diff)
parenta486b91044e6f9dc9c11850315bed178e9f5d9ab (diff)
downloadlibhevc-622972a821bd6adb24a3366d1afe86194b9d5931.tar.gz
Merge "libhevc: Fix asan issue in intra pred mode assembly function" into qt-qpr1-dev am: 06714eb8e9 am: a486b91044
Change-Id: I68506c872c59b2434687ab3b1d10ba97dfa2c026
-rw-r--r--encoder/ihevce_enc_loop_pass.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/encoder/ihevce_enc_loop_pass.c b/encoder/ihevce_enc_loop_pass.c
index 16f2280..c73c7ff 100644
--- a/encoder/ihevce_enc_loop_pass.c
+++ b/encoder/ihevce_enc_loop_pass.c
@@ -141,6 +141,8 @@ extern UWORD8 gau1_num_parts_in_part_type[MAX_PART_TYPES];
/* Constant Macros */
/*****************************************************************************/
#define UPDATE_QP_AT_CTB 6
+#define INTRAPRED_SIMD_LEFT_PADDING 16
+#define INTRAPRED_SIMD_RIGHT_PADDING 8
/*****************************************************************************/
/* Function Definitions */
@@ -3731,8 +3733,12 @@ WORD32 ihevce_enc_loop_get_mem_recs(
ps_mem_tab[ENC_LOOP_CHROMA_PRED_INTRA].i4_mem_alignment = 8;
/* Memory required to store pred for reference substitution output */
+ /* While (MAX_TU_SIZE * 2 * 2) + 1 is the actual size needed,
+ allocate 16 bytes to the left and 7 bytes to the right to facilitate
+ SIMD access */
ps_mem_tab[ENC_LOOP_REF_SUB_OUT].i4_mem_size =
- i4_num_proc_thrds * ((MAX_TU_SIZE * 2 * 2) + 4) *
+ i4_num_proc_thrds * (((MAX_TU_SIZE * 2 * 2) + INTRAPRED_SIMD_RIGHT_PADDING)
+ + INTRAPRED_SIMD_LEFT_PADDING)*
((ps_init_prms->s_tgt_lyr_prms.i4_internal_bit_depth > 8) ? 2 : 1) * sizeof(UWORD8);
ps_mem_tab[ENC_LOOP_REF_SUB_OUT].e_mem_type = (IV_MEM_TYPE_T)i4_mem_space;
@@ -3740,8 +3746,12 @@ WORD32 ihevce_enc_loop_get_mem_recs(
ps_mem_tab[ENC_LOOP_REF_SUB_OUT].i4_mem_alignment = 8;
/* Memory required to store pred for reference filtering output */
+ /* While (MAX_TU_SIZE * 2 * 2) + 1 is the actual size needed,
+ allocate 16 bytes to the left and 7 bytes to the right to facilitate
+ SIMD access */
ps_mem_tab[ENC_LOOP_REF_FILT_OUT].i4_mem_size =
- i4_num_proc_thrds * ((MAX_TU_SIZE * 2 * 2) + 4) *
+ i4_num_proc_thrds * (((MAX_TU_SIZE * 2 * 2) + INTRAPRED_SIMD_RIGHT_PADDING)
+ + INTRAPRED_SIMD_LEFT_PADDING)*
((ps_init_prms->s_tgt_lyr_prms.i4_internal_bit_depth > 8) ? 2 : 1) * sizeof(UWORD8);
ps_mem_tab[ENC_LOOP_REF_FILT_OUT].e_mem_type = (IV_MEM_TYPE_T)i4_mem_space;
@@ -4670,22 +4680,24 @@ void *ihevce_enc_loop_init(
/* Memory assignments for reference substitution output */
{
- WORD32 pred_buf_size = ((MAX_TU_SIZE * 2 * 2) + 4);
+ WORD32 pred_buf_size = ((MAX_TU_SIZE * 2 * 2) + INTRAPRED_SIMD_RIGHT_PADDING
+ + INTRAPRED_SIMD_LEFT_PADDING);
WORD32 pred_buf_size_per_thread = pred_buf_size;
UWORD8 *pu1_base = (UWORD8 *)ps_mem_tab[ENC_LOOP_REF_SUB_OUT].pv_base +
(ctr * pred_buf_size_per_thread);
- ps_ctxt->pv_ref_sub_out = pu1_base;
+ ps_ctxt->pv_ref_sub_out = pu1_base + INTRAPRED_SIMD_LEFT_PADDING;
}
/* Memory assignments for reference filtering output */
{
- WORD32 pred_buf_size = ((MAX_TU_SIZE * 2 * 2) + 4);
+ WORD32 pred_buf_size = ((MAX_TU_SIZE * 2 * 2) + INTRAPRED_SIMD_RIGHT_PADDING
+ + INTRAPRED_SIMD_LEFT_PADDING);
WORD32 pred_buf_size_per_thread = pred_buf_size;
UWORD8 *pu1_base = (UWORD8 *)ps_mem_tab[ENC_LOOP_REF_FILT_OUT].pv_base +
(ctr * pred_buf_size_per_thread);
- ps_ctxt->pv_ref_filt_out = pu1_base;
+ ps_ctxt->pv_ref_filt_out = pu1_base + INTRAPRED_SIMD_LEFT_PADDING;
}
/* Memory assignments for recon storage during CU Recursion */