[automerger] Merge changes from topic "am-c9e7b840dd89496cad321d7c52b28826" into nyc-dr1-dev am: 72c25a331e am: 99d693c89f am: 29819a74ab am: 2c48ad1660 am: 989db21f60
am: 0456f282de

Change-Id: I8e481afdf99cda321f2342a78bd6071212dec7a3
diff --git a/Android.bp b/Android.bp
index ac7d304..464f768 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,5 +1,7 @@
 cc_library_static {
     name: "libavcdec",
+    vendor_available: true,
+    shared_libs: ["liblog", "libcutils",],
 
     cflags: [
         "-fPIC",
@@ -230,6 +232,8 @@
 
 cc_library_static {
     name: "libavcenc",
+    vendor_available: true,
+    shared_libs: ["liblog", "libcutils",],
 
     cflags: [
         "-DNDEBUG",
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..3da5c7a
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1,3 @@
+marcone@google.com
+essick@google.com
+lajos@google.com
diff --git a/decoder/ih264d_defs.h b/decoder/ih264d_defs.h
index d6e3029..260e358 100644
--- a/decoder/ih264d_defs.h
+++ b/decoder/ih264d_defs.h
@@ -34,8 +34,9 @@
  *
  ************************************************************************
  */
-#define H264_MAX_FRAME_WIDTH                3840
-#define H264_MAX_FRAME_HEIGHT               2176
+#define H264_MAX_FRAME_WIDTH                4080
+#define H264_MAX_FRAME_HEIGHT               4080
+#define H264_MAX_FRAME_SIZE                 (4096 * 2048)
 
 #define H264_MIN_FRAME_WIDTH                16
 #define H264_MIN_FRAME_HEIGHT               16
diff --git a/decoder/ih264d_parse_headers.c b/decoder/ih264d_parse_headers.c
index b669331..03ed508 100644
--- a/decoder/ih264d_parse_headers.c
+++ b/decoder/ih264d_parse_headers.c
@@ -795,6 +795,12 @@
                     u1_level_idc, ps_seq->u2_total_num_of_mbs);
 
     u1_frm = ih264d_get_bit_h264(ps_bitstrm);
+    if((ps_dec->i4_header_decoded & 1) && (ps_seq->u1_frame_mbs_only_flag != u1_frm))
+    {
+        ps_dec->u1_res_changed = 1;
+        return IVD_RES_CHANGED;
+    }
+
     ps_seq->u1_frame_mbs_only_flag = u1_frm;
 
     COPYTHECONTEXT("SPS: frame_mbs_only_flag", u1_frm);
@@ -925,7 +931,9 @@
         }
 
         /* Check for unsupported resolutions */
-        if((u2_pic_wd > H264_MAX_FRAME_WIDTH) || (u2_pic_ht > H264_MAX_FRAME_HEIGHT))
+        if((u2_pic_wd > H264_MAX_FRAME_WIDTH) || (u2_pic_ht > H264_MAX_FRAME_HEIGHT)
+                || (u2_pic_wd < H264_MIN_FRAME_WIDTH) || (u2_pic_ht < H264_MIN_FRAME_HEIGHT)
+                || (u2_pic_wd * (UWORD32)u2_pic_ht > H264_MAX_FRAME_SIZE))
         {
             return IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED;
         }
diff --git a/decoder/ih264d_utils.c b/decoder/ih264d_utils.c
index 9958f9b..edfb8f1 100644
--- a/decoder/ih264d_utils.c
+++ b/decoder/ih264d_utils.c
@@ -641,27 +641,6 @@
     return (i4_size);
 }
 
-/***************************************************************************/
-/* If change in Level or the required PicBuffers i4_size is more than the  */
-/* current one FREE the current PicBuffers and allocate affresh            */
-/***************************************************************************/
-UWORD8 ih264d_is_sps_changed(prev_seq_params_t * ps_prv,
-                             dec_seq_params_t * ps_cur)
-{
-
-    if((ps_prv->u2_frm_wd_in_mbs != ps_cur->u2_frm_wd_in_mbs)
-                    || (ps_prv->u1_level_idc != ps_cur->u1_level_idc)
-                    || (ps_prv->u1_profile_idc != ps_cur->u1_profile_idc)
-                    || (ps_cur->u2_frm_ht_in_mbs != ps_prv->u2_frm_ht_in_mbs)
-                    || (ps_cur->u1_frame_mbs_only_flag
-                                    != ps_prv->u1_frame_mbs_only_flag)
-                    || (ps_cur->u1_direct_8x8_inference_flag
-                                    != ps_prv->u1_direct_8x8_inference_flag))
-        return 1;
-
-    return 0;
-}
-
 /**************************************************************************/
 /* This function initialises the value of ps_dec->u1_recon_mb_grp         */
 /* ps_dec->u1_recon_mb_grp must satisfy the following criteria            */
@@ -747,8 +726,7 @@
     /* If change in Level or the required PicBuffers i4_size is more than the  */
     /* current one FREE the current PicBuffers and allocate affresh            */
     /***************************************************************************/
-    if(!ps_dec->u1_init_dec_flag
-                    || ih264d_is_sps_changed(ps_prev_seq_params, ps_seq))
+    if(!ps_dec->u1_init_dec_flag)
     {
         ps_dec->u1_max_dec_frame_buffering = ih264d_get_dpb_size(ps_seq);