summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2017-02-14 23:19:32 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-02-14 23:19:32 +0000
commit3f250dd3159fed1590ae7154395bf79c5ef1c1a9 (patch)
treeb3ca781f75d7267d9ea81257f45b13ac234292eb
parentcf865bbf68814d6160c737ab1dffebe62b68fabd (diff)
parent59f1a8e3835f8cb2112c224e2566d024d4a6c7da (diff)
downloadplatform_external_libhevc-nougat-mr2-dev.tar.gz
platform_external_libhevc-nougat-mr2-dev.tar.bz2
platform_external_libhevc-nougat-mr2-dev.zip
Merge "Fix in handling wrong cu_qp_delta" into lmp-dev am: 98f9e26d24 am: 10f2b105f5 am: b4ddce56d1 am: 59b232588b am: ca85c43d8d am: fc093b18cd am: 4f28fb5344 am: 29a107d6fb am: a066d53106 am: 6316faf131android-7.1.2_r6android-7.1.2_r5android-7.1.2_r4android-7.1.2_r3android-7.1.2_r2android-7.1.2_r1nougat-mr2-dev
am: 59f1a8e383 Change-Id: I0147bf4be34afb2c1ed34642b14872059d01727d
-rw-r--r--decoder/ihevcd_cabac.c3
-rw-r--r--decoder/ihevcd_parse_slice.c11
2 files changed, 11 insertions, 3 deletions
diff --git a/decoder/ihevcd_cabac.c b/decoder/ihevcd_cabac.c
index fa249c4..3a03aa8 100644
--- a/decoder/ihevcd_cabac.c
+++ b/decoder/ihevcd_cabac.c
@@ -669,14 +669,13 @@ UWORD32 ihevcd_cabac_decode_bypass_bins_egk(cab_ctxt_t *ps_cabac,
numones = k;
bin = 1;
u4_sym = 0;
- while(bin)
+ while(bin && (numones <= 16))
{
IHEVCD_CABAC_DECODE_BYPASS_BIN(bin, ps_cabac, ps_bitstrm);
u4_sym += bin << numones++;
}
numones -= 1;
- numones = CLIP3(numones, 0, 16);
if(numones)
{
diff --git a/decoder/ihevcd_parse_slice.c b/decoder/ihevcd_parse_slice.c
index 853afee..96af4e1 100644
--- a/decoder/ihevcd_parse_slice.c
+++ b/decoder/ihevcd_parse_slice.c
@@ -82,6 +82,9 @@
/* Bit stream offset threshold */
#define BITSTRM_OFF_THRS 8
+#define MIN_CU_QP_DELTA_ABS(x) (-26 + ((x) * 6) / 2)
+#define MAX_CU_QP_DELTA_ABS(x) (25 + ((x) * 6) / 2)
+
/**
* Table used to decode part_mode if AMP is enabled and current CU is not min CU
*/
@@ -302,7 +305,6 @@ WORD32 ihevcd_parse_transform_tree(codec_t *ps_codec,
}
AEV_TRACE("cu_qp_delta_abs", cu_qp_delta_abs, ps_cabac->u4_range);
-
ps_codec->s_parse.i4_is_cu_qp_delta_coded = 1;
@@ -315,6 +317,13 @@ WORD32 ihevcd_parse_transform_tree(codec_t *ps_codec,
cu_qp_delta_abs = -cu_qp_delta_abs;
}
+
+ if (cu_qp_delta_abs < MIN_CU_QP_DELTA_ABS(ps_sps->i1_bit_depth_luma_minus8)
+ || cu_qp_delta_abs > MAX_CU_QP_DELTA_ABS(ps_sps->i1_bit_depth_luma_minus8))
+ {
+ return IHEVCD_INVALID_PARAMETER;
+ }
+
ps_codec->s_parse.s_cu.i4_cu_qp_delta = cu_qp_delta_abs;
}