Check change in CTB size when decoding multiple SPS with same id

If an SPS is being overwritten, ensure CTB size remains same.
If not, return from decoder and reset the decoder state in the
subsequent decode call.

Bug: 140322595
Test: poc in bug

Change-Id: I5f1e52d3bd2b48874a088ab32054f5a89e62eeb5
diff --git a/decoder/ihevcd_parse_headers.c b/decoder/ihevcd_parse_headers.c
index 2d1f567..e16a9e6 100644
--- a/decoder/ihevcd_parse_headers.c
+++ b/decoder/ihevcd_parse_headers.c
@@ -1675,6 +1675,19 @@
     {
         return IHEVCD_INVALID_PARAMETER;
     }
+    /* Check if CTB size is different in case of multiple SPS with same ID */
+    {
+        sps_t *ps_sps_old = (ps_codec->s_parse.ps_sps_base + sps_id);
+        if(ps_sps_old->i1_sps_valid && ps_sps_old->i1_log2_ctb_size != ctb_log2_size_y)
+        {
+            if(0 == ps_codec->i4_first_pic_done)
+            {
+                return IHEVCD_INVALID_PARAMETER;
+            }
+            ps_codec->i4_reset_flag = 1;
+            return (IHEVCD_ERROR_T)IVD_RES_CHANGED;
+        }
+    }
     ps_sps->i1_log2_ctb_size = ctb_log2_size_y;
 
     UEV_PARSE("log2_min_transform_block_size_minus2", value, ps_bitstrm);