Merge cherrypicks of [3166006, 3165952, 3164925, 3164926, 3164927, 3164928, 3167313, 3167314, 3167315, 3167316, 3167317, 3167318, 3167319, 3167320, 3167321, 3167322, 3166318, 3166319, 3166320, 3166321, 3166322, 3166323, 3166324, 3167333, 3167334, 3167373, 3165112, 3166325, 3165229, 3165230] into nyc-mr2-release
Change-Id: Ib99fea7601a6f824967cca2463b156e5b91de27f
diff --git a/decoder/ihevcd_api.c b/decoder/ihevcd_api.c
index 51e9670..2ae90b0 100644
--- a/decoder/ihevcd_api.c
+++ b/decoder/ihevcd_api.c
@@ -1215,7 +1215,7 @@
/* Request memory for static bitstream buffer which holds bitstream after emulation prevention */
size = MIN_BITSBUF_SIZE;
- pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
+ pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size + 16); //Alloc extra for parse optimization
RETURN_IF((NULL == pv_buf), IV_FAIL);
ps_codec->pu1_bitsbuf_static = pv_buf;
ps_codec->u4_bitsbuf_size_static = size;
@@ -1908,7 +1908,7 @@
size = wd * ht;
if(size > MIN_BITSBUF_SIZE)
{
- pv_buf = ps_codec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
+ pv_buf = ps_codec->pf_aligned_alloc(pv_mem_ctxt, 128, size + 16); //Alloc extra for parse optimization
RETURN_IF((NULL == pv_buf), IV_FAIL);
ps_codec->pu1_bitsbuf_dynamic = pv_buf;
ps_codec->u4_bitsbuf_size_dynamic = size;