Initialize i4_non_ref_frames_in_stream before encoding SPS/PPS

When header mode is enabled, the SPS is populated before this
field was initialized in ih264e_pic_init.

Change-Id: I7e38828e12bee15bd3a53562b4e4d0d65354326a
diff --git a/encoder/ih264e_encode.c b/encoder/ih264e_encode.c
index 041148b..c027321 100644
--- a/encoder/ih264e_encode.c
+++ b/encoder/ih264e_encode.c
@@ -304,6 +304,12 @@
     }
 #endif /*LOGO_EN*/
 
+    /* In case of alt ref and B pics we will have non reference frame in stream */
+    if (ps_codec->s_cfg.u4_enable_alt_ref || ps_codec->s_cfg.u4_num_bframes)
+    {
+        ps_codec->i4_non_ref_frames_in_stream = 1;
+    }
+
     if (ps_codec->i4_encode_api_call_cnt == 0)
     {
         /********************************************************************/
diff --git a/encoder/ih264e_utils.c b/encoder/ih264e_utils.c
index b8514a8..b339143 100644
--- a/encoder/ih264e_utils.c
+++ b/encoder/ih264e_utils.c
@@ -1360,12 +1360,6 @@
      *   a) Set up alt ref too
      **************************************************************************/
 
-    /* In case of alt ref and B pics we will have non reference frame in stream */
-    if (ps_codec->s_cfg.u4_enable_alt_ref || ps_codec->s_cfg.u4_num_bframes)
-    {
-        ps_codec->i4_non_ref_frames_in_stream = 1;
-    }
-
     /* Check and set if the current frame is reference or not */
     ps_codec->u4_is_curr_frm_ref = 0;