summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-03-20 23:04:38 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-03-20 23:04:38 +0000
commitdd7adb0e222bb781a4fc6b9fa141dfecedc21529 (patch)
tree6c7bfd33dd40834e248b4283448b19ab249eaa8e
parent84e0b4f789ff30112aeb35ff52553ba4252c1cbb (diff)
parentc48a54d3687b637f979a5e2d3bbd9827cf5d1e84 (diff)
downloadplatform_external_libhevc-android10-qpr3-release.tar.gz
platform_external_libhevc-android10-qpr3-release.tar.bz2
platform_external_libhevc-android10-qpr3-release.zip
Change-Id: Ibaf8e146b8cd0be1511135f04f2d2c85451bcf80
-rw-r--r--common/x86/ihevc_intra_pred_filters_sse42_intr.c4
-rw-r--r--decoder/ihevcd_iquant_itrans_recon_ctb.c2
-rw-r--r--decoder/ihevcd_parse_slice_header.c13
-rw-r--r--encoder/ihevce_enc_loop_pass.c24
4 files changed, 33 insertions, 10 deletions
diff --git a/common/x86/ihevc_intra_pred_filters_sse42_intr.c b/common/x86/ihevc_intra_pred_filters_sse42_intr.c
index 6488de6..e72f042 100644
--- a/common/x86/ihevc_intra_pred_filters_sse42_intr.c
+++ b/common/x86/ihevc_intra_pred_filters_sse42_intr.c
@@ -1969,7 +1969,7 @@ void ihevc_intra_pred_luma_mode_11_to_17_sse42(UWORD8 *pu1_ref,
__m128i row_4x32b, two_nt_4x32b, ref_main_idx_4x32b, res_temp5_4x32b, sm3;
- UWORD8 ref_tmp[2 * MAX_CU_SIZE + 2];
+ UWORD8 ref_tmp[2 * MAX_CU_SIZE + 2] = {0};
UWORD8 *ref_main;
UWORD8 *ref_temp;
UNUSED(src_strd);
@@ -2799,7 +2799,7 @@ void ihevc_intra_pred_luma_mode_19_to_25_sse42(UWORD8 *pu1_ref,
WORD32 inv_ang, inv_ang_sum;
//WORD32 ref_main_idx, pos, fract, idx;
WORD32 ref_idx;
- UWORD8 ref_tmp[(2 * MAX_CU_SIZE) + 2];
+ UWORD8 ref_tmp[(2 * MAX_CU_SIZE) + 2] = {0};
UWORD8 *ref_main, *ref_temp;
__m128i /*fract_8x16b,*/ const_temp_8x16b, sm3;
diff --git a/decoder/ihevcd_iquant_itrans_recon_ctb.c b/decoder/ihevcd_iquant_itrans_recon_ctb.c
index a7cd167..50f8dce 100644
--- a/decoder/ihevcd_iquant_itrans_recon_ctb.c
+++ b/decoder/ihevcd_iquant_itrans_recon_ctb.c
@@ -946,7 +946,7 @@ WORD32 ihevcd_iquant_itrans_recon_ctb(process_ctxt_t *ps_proc)
/* While (MAX_TU_SIZE * 2 * 2) + 1 is the actaul size needed,
au1_ref_sub_out size is kept as multiple of 8,
so that SIMD functions can load 64 bits */
- UWORD8 au1_ref_sub_out[(MAX_TU_SIZE * 2 * 2) + 8];
+ UWORD8 au1_ref_sub_out[(MAX_TU_SIZE * 2 * 2) + 8] = {0};
UWORD8 *pu1_top_left, *pu1_top, *pu1_left;
WORD32 luma_pred_func_idx, chroma_pred_func_idx;
diff --git a/decoder/ihevcd_parse_slice_header.c b/decoder/ihevcd_parse_slice_header.c
index c161fc4..23d5030 100644
--- a/decoder/ihevcd_parse_slice_header.c
+++ b/decoder/ihevcd_parse_slice_header.c
@@ -325,6 +325,12 @@ IHEVCD_ERROR_T ihevcd_parse_slice_header(codec_t *ps_codec,
{
BITS_PARSE("dependent_slice_flag", value, ps_bitstrm, 1);
+ /* First slice to be decoded in the current picture can't be dependent slice */
+ if (value && 0 == ps_codec->i4_pic_present)
+ {
+ return IHEVCD_IGNORE_SLICE;
+ }
+
/* If dependendent slice, copy slice header from previous slice */
if(value && (ps_codec->s_parse.i4_cur_slice_idx > 0))
{
@@ -471,7 +477,8 @@ IHEVCD_ERROR_T ihevcd_parse_slice_header(codec_t *ps_codec,
ps_slice_hdr->i1_num_long_term_sps = value;
}
UEV_PARSE("num_long_term_pics", value, ps_bitstrm);
- if((value + ps_slice_hdr->i1_num_long_term_sps + num_neg_pics + num_pos_pics) > (MAX_DPB_SIZE - 1))
+ if(((ULWORD64)value + ps_slice_hdr->i1_num_long_term_sps + num_neg_pics +
+ num_pos_pics) > (MAX_DPB_SIZE - 1))
{
return IHEVCD_INVALID_PARAMETER;
}
@@ -487,6 +494,10 @@ IHEVCD_ERROR_T ihevcd_parse_slice_header(codec_t *ps_codec,
{
WORD32 num_bits = 32 - CLZ(ps_sps->i1_num_long_term_ref_pics_sps - 1);
BITS_PARSE("lt_idx_sps[ i ]", value, ps_bitstrm, num_bits);
+ if(value >= ps_sps->i1_num_long_term_ref_pics_sps)
+ {
+ return IHEVCD_INVALID_PARAMETER;
+ }
}
else
{
diff --git a/encoder/ihevce_enc_loop_pass.c b/encoder/ihevce_enc_loop_pass.c
index f1cb79c..4943c5c 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 */
@@ -3853,8 +3855,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;
@@ -3862,8 +3868,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;
@@ -4777,22 +4787,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 */