Upgrade libhevc to v1.3.0 am: 0150e6a556 am: ded35ac0ac am: def1d58fab

Original change: https://android-review.googlesource.com/c/platform/external/libhevc/+/2799053

Change-Id: Icb62113f648c2abb491355c1e57cf2d6b8f0b60c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/encoder/ihevce_memory_init.c b/encoder/ihevce_memory_init.c
index 479ab3b..b6f3b87 100644
--- a/encoder/ihevce_memory_init.c
+++ b/encoder/ihevce_memory_init.c
@@ -1515,8 +1515,6 @@
             ps_intrf_ctxt->i4_error_code = IHEVCE_CANNOT_ALLOCATE_MEMORY;
             return;
         }
-
-        memset(pu1_mem, 0, ps_memtab[ctr].i4_mem_size);
     }
 
     /* --------------------------------------------------------------------- */
diff --git a/encoder/ihevce_plugin.c b/encoder/ihevce_plugin.c
index 00637fa..26f3ba4 100644
--- a/encoder/ihevce_plugin.c
+++ b/encoder/ihevce_plugin.c
@@ -112,6 +112,8 @@
 *
 * \brief
 *    Memory manager specific alloc function
+*    it expects to reset the allocated memory and provide the zero initialised
+*    memory whenever this function getting called
 *
 * \param[in] pv_handle : handle to memory manager
 *                        (currently not required can be set to null)
@@ -158,6 +160,10 @@
             ps_sys_api->pv_cb_handle, "IHEVCE ERROR: Unable to allocate memory\n");
         ASSERT(0);
     }
+    else
+    {
+        memset(ps_memtab->pv_base, 0, ps_memtab->i4_mem_size);
+    }
     return;
 }
 
@@ -167,6 +173,8 @@
 *
 * \brief
 *    common memory allocate function should be used across all threads
+*    it expects to reset the allocated memory and return the zero initialised
+*    memory pointer whenever this function getting called
 *
 * \param[in] pv_handle : handle to memory manager
 *                        (currently not required can be set to null)
@@ -183,7 +191,12 @@
 void *memory_alloc(void *pv_handle, UWORD32 u4_size)
 {
     (void)pv_handle;
-    return (malloc(u4_size));
+    void *pv_buf = malloc(u4_size);
+    if(pv_buf)
+    {
+        memset(pv_buf, 0, u4_size);
+    }
+    return (pv_buf);
 }
 
 /*!
@@ -629,7 +642,6 @@
             ps_sys_api->pv_cb_handle, "IHEVCE ERROR: Error in Plugin initialization\n");
         return (IHEVCE_EFAIL);
     }
-    memset(ps_ctxt, 0, sizeof(plugin_ctxt_t));
 
     /* initialise memory call backs */
     ps_ctxt->ihevce_mem_alloc = memory_alloc;
@@ -754,7 +766,6 @@
                 "IHEVCE ERROR: Error in Plugin HLE memory initialization\n");
             return (IHEVCE_EFAIL);
         }
-        memset(ps_interface_ctxt, 0, sizeof(ihevce_hle_ctxt_t));
         ps_interface_ctxt->i4_size = sizeof(ihevce_hle_ctxt_t);
 
         ps_ctxt->pv_hle_interface_ctxt = ps_interface_ctxt;