summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-09-14 20:50:23 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-09-14 20:50:23 +0000
commit79af9ce01d66b69b27682d8c6052b7c012e86324 (patch)
tree6041a492dbed6ca7f07f6062400c02a3ec9e6279
parent97454d2b517d6e9e48e6b8ed78bfdaf6b9cd0edf (diff)
parentdfbea69aad200d7423d5460514a4947c1bf301da (diff)
downloadlibmpeg2-nougat-mr0.5-release.tar.gz
Merge cherrypicks of [5027797, 5027798, 5029209, 5030032, 5023135, 5028893, 5028915, 5028916, 5028917, 5028948, 5028949, 5028950, 5030131, 5030132, 5030133, 5030134, 5030135, 5028894, 5028918, 5030033, 5023136, 5030136, 5029210, 5030171, 5030172, 5030173, 5030174, 5030175, 5030176, 5030177, 5030178, 5030179, 5030180, 5029076, 5029077, 5029078, 5029079, 5029080, 5029081, 5029082, 5029083, 5029084, 5029085, 5029086, 5029087, 5029088, 5029089, 5029090, 5030211, 5030212, 5030213, 5030214, 5030215, 5030216, 5030217, 5020440, 5020441, 5020442, 5030137, 5030034, 5020443, 5030138, 5029124, 5027799, 5029125, 5029126, 5029127, 5023137, 5030139, 5030140, 5029132, 5030141, 5030142, 5030143, 5030181, 5030182, 5030183, 5030184, 5030185, 5030186, 5030187, 5030188, 5030189, 5030190, 5030231, 5030232, 5030233, 5030234, 5030235, 5030236, 5030237, 5030238, 5030239, 5030240, 5030241, 5030242, 5030243, 5030244, 5030245, 5030246, 5030247, 5030248, 5030249, 5030250, 5030271, 5030272, 5030273, 5030274, 5030275, 5030276, 5030277, 5030278, 5030279, 5030280, 5030281, 5020444, 5027800, 5030144] into nyc-bugfix-releaseandroid-7.0.0_r36nougat-mr0.5-release
Change-Id: Ib17ea47d6be1a5cafc3bf18a6a635c68e701953a
-rw-r--r--decoder/impeg2d_api.h2
-rw-r--r--decoder/impeg2d_api_main.c10
-rw-r--r--decoder/impeg2d_dec_hdr.c14
-rw-r--r--decoder/impeg2d_decoder.c25
-rw-r--r--decoder/impeg2d_pnb_pic.c5
-rw-r--r--decoder/impeg2d_structs.h3
-rw-r--r--test/decoder/main.c6
7 files changed, 51 insertions, 14 deletions
diff --git a/decoder/impeg2d_api.h b/decoder/impeg2d_api.h
index 3fa098b..f239637 100644
--- a/decoder/impeg2d_api.h
+++ b/decoder/impeg2d_api.h
@@ -50,7 +50,7 @@
-#define NUM_MEM_RECORDS 4 * MAX_THREADS + NUM_INT_FRAME_BUFFERS + 5 + 2
+#define NUM_MEM_RECORDS 4 * MAX_THREADS + NUM_INT_FRAME_BUFFERS + 5 + 2 + 1
#define SETBIT(a,i) ((a) |= (1 << i))
diff --git a/decoder/impeg2d_api_main.c b/decoder/impeg2d_api_main.c
index 871945b..e4f3c1c 100644
--- a/decoder/impeg2d_api_main.c
+++ b/decoder/impeg2d_api_main.c
@@ -598,7 +598,11 @@ void impeg2d_fill_mem_rec(impeg2d_fill_mem_rec_ip_t *ps_ip,
}
}
-
+ ps_mem_rec->u4_mem_alignment = 128;
+ ps_mem_rec->e_mem_type = IV_EXTERNAL_CACHEABLE_PERSISTENT_MEM;
+ ps_mem_rec->u4_mem_size = MAX_BITSTREAM_BUFFER_SIZE + MIN_BUFFER_BYTES_AT_EOS;
+ ps_mem_rec++;
+ u1_no_rec++;
{
WORD32 i4_job_queue_size;
@@ -644,6 +648,7 @@ void impeg2d_fill_mem_rec(impeg2d_fill_mem_rec_ip_t *ps_ip,
ps_mem_rec->u4_mem_size = sizeof(iv_mem_rec_t) * (NUM_MEM_RECORDS);
ps_mem_rec++;
u1_no_rec++;
+
ps_op->s_ivd_fill_mem_rec_op_t.u4_num_mem_rec_filled = u1_no_rec;
ps_op->s_ivd_fill_mem_rec_op_t.u4_error_code = 0;
}
@@ -1914,6 +1919,9 @@ IV_API_CALL_STATUS_T impeg2d_api_init(iv_obj_t *ps_dechdl,
ps_dec_state = ps_dec_state_multi_core->ps_dec_state[0];
+ ps_dec_state->pu1_input_buffer = ps_mem_rec->pv_base;
+ u4_num_mem_rec++;
+ ps_mem_rec++;
ps_dec_state->pv_jobq_buf = ps_mem_rec->pv_base;
ps_dec_state->i4_jobq_buf_size = ps_mem_rec->u4_mem_size;
diff --git a/decoder/impeg2d_dec_hdr.c b/decoder/impeg2d_dec_hdr.c
index 3dff8c2..cc69074 100644
--- a/decoder/impeg2d_dec_hdr.c
+++ b/decoder/impeg2d_dec_hdr.c
@@ -166,10 +166,6 @@ IMPEG2D_ERROR_CODES_T impeg2d_dec_seq_hdr(dec_state_t *ps_dec)
/* This is the first time we are reading the resolution */
ps_dec->u2_horizontal_size = u2_width;
ps_dec->u2_vertical_size = u2_height;
- if (0 == ps_dec->u4_frm_buf_stride)
- {
- ps_dec->u4_frm_buf_stride = (UWORD32) (u2_width);
- }
}
else
{
@@ -192,6 +188,11 @@ IMPEG2D_ERROR_CODES_T impeg2d_dec_seq_hdr(dec_state_t *ps_dec)
return e_error;
}
+ else if((ps_dec->u2_horizontal_size < MIN_WIDTH)
+ || (ps_dec->u2_vertical_size < MIN_HEIGHT))
+ {
+ return IMPEG2D_UNSUPPORTED_DIMENSIONS;
+ }
else
{
/* The resolution has changed */
@@ -209,6 +210,11 @@ IMPEG2D_ERROR_CODES_T impeg2d_dec_seq_hdr(dec_state_t *ps_dec)
return e_error;
}
+ if((ps_dec->u2_horizontal_size < MIN_WIDTH)
+ || (ps_dec->u2_vertical_size < MIN_HEIGHT))
+ {
+ return IMPEG2D_UNSUPPORTED_DIMENSIONS;
+ }
/*------------------------------------------------------------------------*/
/* Flush the following as they are not being used */
diff --git a/decoder/impeg2d_decoder.c b/decoder/impeg2d_decoder.c
index e4ff79c..726d9cd 100644
--- a/decoder/impeg2d_decoder.c
+++ b/decoder/impeg2d_decoder.c
@@ -102,12 +102,14 @@ void impeg2d_dec_hdr(void *pv_dec,impeg2d_video_decode_ip_t *ps_ip,
ps_dec = (dec_state_t *)pv_dec;
ps_op->s_ivd_video_decode_op_t.u4_error_code = 0;
- if (u4_size >= MAX_BITSTREAM_BUFFER_SIZE)
+ if (u4_size > MAX_BITSTREAM_BUFFER_SIZE)
{
- u4_size = MAX_BITSTREAM_BUFFER_SIZE - MIN_BUFFER_BYTES_AT_EOS;
+ u4_size = MAX_BITSTREAM_BUFFER_SIZE;
}
- impeg2d_bit_stream_init(&(ps_dec->s_bit_stream),ps_ip->s_ivd_video_decode_ip_t.pv_stream_buffer,
+ memcpy(ps_dec->pu1_input_buffer, ps_ip->s_ivd_video_decode_ip_t.pv_stream_buffer, u4_size);
+
+ impeg2d_bit_stream_init(&(ps_dec->s_bit_stream), ps_dec->pu1_input_buffer,
u4_size);
{
@@ -153,6 +155,12 @@ void impeg2d_dec_hdr(void *pv_dec,impeg2d_video_decode_ip_t *ps_ip,
ps_op->s_ivd_video_decode_op_t.u4_num_bytes_consumed = ps_ip->s_ivd_video_decode_ip_t.u4_num_Bytes;
}
ps_op->s_ivd_video_decode_op_t.u4_frame_decoded_flag = 0;
+
+ /* Set the stride */
+ if (0 == ps_dec->u4_frm_buf_stride)
+ {
+ ps_dec->u4_frm_buf_stride = ps_dec->u2_horizontal_size;
+ }
/* MOD */
ps_dec->u2_header_done = 1;
@@ -194,16 +202,19 @@ void impeg2d_dec_frm(void *pv_dec,impeg2d_video_decode_ip_t *ps_ip,
ps_op->s_ivd_video_decode_op_t.u4_num_bytes_consumed = 0;
IMPEG2D_FRM_NUM_SET();
- if (u4_size >= MAX_BITSTREAM_BUFFER_SIZE)
+ if (u4_size > MAX_BITSTREAM_BUFFER_SIZE)
{
- u4_size = MAX_BITSTREAM_BUFFER_SIZE - MIN_BUFFER_BYTES_AT_EOS;
+ u4_size = MAX_BITSTREAM_BUFFER_SIZE;
}
- ps_dec->pu1_inp_bits_buf = ps_ip->s_ivd_video_decode_ip_t.pv_stream_buffer;
+ memcpy(ps_dec->pu1_input_buffer, ps_ip->s_ivd_video_decode_ip_t.pv_stream_buffer, u4_size);
+
+ ps_dec->pu1_inp_bits_buf = ps_dec->pu1_input_buffer;
+
ps_dec->u4_num_inp_bytes = u4_size;
ps_stream = &ps_dec->s_bit_stream;
- impeg2d_bit_stream_init(ps_stream,ps_ip->s_ivd_video_decode_ip_t.pv_stream_buffer,u4_size);
+ impeg2d_bit_stream_init(ps_stream, ps_dec->pu1_input_buffer, u4_size);
/* @ */ /* Updating the bufferID */
diff --git a/decoder/impeg2d_pnb_pic.c b/decoder/impeg2d_pnb_pic.c
index a3ae436..f7937a8 100644
--- a/decoder/impeg2d_pnb_pic.c
+++ b/decoder/impeg2d_pnb_pic.c
@@ -299,6 +299,11 @@ WORD32 impeg2d_dec_pnb_mb_params(dec_state_t *ps_dec)
{
u2_mb_addr_incr = impeg2d_get_mb_addr_incr(ps_stream);
+ if(0 == u2_mb_addr_incr)
+ {
+ return IV_FAIL;
+ }
+
if(ps_dec->u2_first_mb)
{
/****************************************************************/
diff --git a/decoder/impeg2d_structs.h b/decoder/impeg2d_structs.h
index 971bc91..9d0c756 100644
--- a/decoder/impeg2d_structs.h
+++ b/decoder/impeg2d_structs.h
@@ -337,6 +337,9 @@ typedef struct dec_state_struct_t
WORD32 i4_start_mb_y;
WORD32 i4_end_mb_y;
+ /* Buffer to store the input stream */
+ UWORD8 *pu1_input_buffer;
+
/**
* Job queue buffer base
*/
diff --git a/test/decoder/main.c b/test/decoder/main.c
index e6eb1ef..916081d 100644
--- a/test/decoder/main.c
+++ b/test/decoder/main.c
@@ -2415,9 +2415,13 @@ int main(WORD32 argc, CHAR *argv[])
if(ret != IV_SUCCESS)
{
+ if (IMPEG2D_UNSUPPORTED_DIMENSIONS == s_video_decode_op.u4_error_code)
+ {
+ sprintf(ac_error_str, "\nSummary\nUnsupported Dimensions. Reinit decoder with width %d and height %d\n", s_video_decode_op.u4_pic_wd, s_video_decode_op.u4_pic_ht);
+ codec_exit(ac_error_str);
+ }
sprintf(ac_error_str, "\nError in header decode %x",
s_video_decode_op.u4_error_code);
- // codec_exit(ac_error_str);
}
u4_num_bytes_dec = s_video_decode_op.u4_num_bytes_consumed;