Fixed error concealment when no MBs are decoded in the current pic am: b926905ee2 am: ff54ee6115 am: 9fca73a55e am: 19080458ba
am: 9836aa04a9

Change-Id: Iccfd85fcf60aa708c08fdebe0dc1d4bd27141181
diff --git a/decoder/ih264d.h b/decoder/ih264d.h
index 63a5ce1..7c76296 100644
--- a/decoder/ih264d.h
+++ b/decoder/ih264d.h
@@ -429,6 +429,45 @@
     UWORD32                                     u4_buffer_ht[3];
 }ih264d_ctl_get_frame_dimensions_op_t;
 
+typedef struct
+{
+    UWORD32                                     u4_size;
+    IVD_API_COMMAND_TYPE_T                      e_cmd;
+    IVD_CONTROL_API_COMMAND_TYPE_T              e_sub_cmd;
+}ih264d_ctl_get_vui_params_ip_t;
+
+typedef struct
+{
+    UWORD32                                     u4_size;
+    UWORD32                                     u4_error_code;
+    UWORD8                                      u1_aspect_ratio_idc;
+    UWORD16                                     u2_sar_width;
+    UWORD16                                     u2_sar_height;
+    UWORD8                                      u1_overscan_appropriate_flag;
+    UWORD8                                      u1_video_format;
+    UWORD8                                      u1_video_full_range_flag;
+    UWORD8                                      u1_colour_primaries;
+    UWORD8                                      u1_tfr_chars;
+    UWORD8                                      u1_matrix_coeffs;
+    UWORD8                                      u1_cr_top_field;
+    UWORD8                                      u1_cr_bottom_field;
+    UWORD32                                     u4_num_units_in_tick;
+    UWORD32                                     u4_time_scale;
+    UWORD8                                      u1_fixed_frame_rate_flag;
+    UWORD8                                      u1_nal_hrd_params_present;
+    UWORD8                                      u1_vcl_hrd_params_present;
+    UWORD8                                      u1_low_delay_hrd_flag;
+    UWORD8                                      u1_pic_struct_present_flag;
+    UWORD8                                      u1_bitstream_restriction_flag;
+    UWORD8                                      u1_mv_over_pic_boundaries_flag;
+    UWORD32                                     u4_max_bytes_per_pic_denom;
+    UWORD32                                     u4_max_bits_per_mb_denom;
+    UWORD32                                     u4_log2_max_mv_length_horz;
+    UWORD32                                     u4_log2_max_mv_length_vert;
+    UWORD32                                     u4_num_reorder_frames;
+    UWORD32                                     u4_max_dec_frame_buffering;
+}ih264d_ctl_get_vui_params_op_t;
+
 #ifdef __cplusplus
 } /* closing brace for extern "C" */
 #endif
diff --git a/decoder/ih264d_api.c b/decoder/ih264d_api.c
index 6aa71f2..cf3be37 100644
--- a/decoder/ih264d_api.c
+++ b/decoder/ih264d_api.c
@@ -135,6 +135,10 @@
 WORD32 ih264d_get_frame_dimensions(iv_obj_t *dec_hdl,
                                    void *pv_api_ip,
                                    void *pv_api_op);
+WORD32 ih264d_get_vui_params(iv_obj_t *dec_hdl,
+                             void *pv_api_ip,
+                             void *pv_api_op);
+
 WORD32 ih264d_set_num_cores(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op);
 
 WORD32 ih264d_deblock_display(dec_struct_t *ps_dec);
@@ -743,7 +747,36 @@
 
                     break;
                 }
+                case IH264D_CMD_CTL_GET_VUI_PARAMS:
+                {
+                    ih264d_ctl_get_vui_params_ip_t *ps_ip;
+                    ih264d_ctl_get_vui_params_op_t *ps_op;
 
+                    ps_ip =
+                                    (ih264d_ctl_get_vui_params_ip_t *)pv_api_ip;
+                    ps_op =
+                                    (ih264d_ctl_get_vui_params_op_t *)pv_api_op;
+
+                    if(ps_ip->u4_size
+                                    != sizeof(ih264d_ctl_get_vui_params_ip_t))
+                    {
+                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
+                        ps_op->u4_error_code |=
+                                        IVD_IP_API_STRUCT_SIZE_INCORRECT;
+                        return IV_FAIL;
+                    }
+
+                    if(ps_op->u4_size
+                                    != sizeof(ih264d_ctl_get_vui_params_op_t))
+                    {
+                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
+                        ps_op->u4_error_code |=
+                                        IVD_OP_API_STRUCT_SIZE_INCORRECT;
+                        return IV_FAIL;
+                    }
+
+                    break;
+                }
                 case IH264D_CMD_CTL_SET_NUM_CORES:
                 {
                     ih264d_ctl_set_num_cores_ip_t *ps_ip;
@@ -2971,40 +3004,30 @@
         }
     }
 
-    if((0 != ps_dec->u4_app_disp_width)
-                    && (ps_ctl_ip->u4_disp_wd
-                                    != ps_dec->u4_app_disp_width))
+    if(ps_ctl_ip->u4_disp_wd >= ps_dec->u2_pic_wd)
     {
+        ps_dec->u4_app_disp_width = ps_ctl_ip->u4_disp_wd;
+    }
+    else if(0 == ps_dec->i4_header_decoded)
+    {
+        ps_dec->u4_app_disp_width = ps_ctl_ip->u4_disp_wd;
+    }
+    else if(ps_ctl_ip->u4_disp_wd == 0)
+    {
+        ps_dec->u4_app_disp_width = 0;
+    }
+    else
+    {
+        /*
+         * Set the display width to zero. This will ensure that the wrong value we had stored (0xFFFFFFFF)
+         * does not propogate.
+         */
+        ps_dec->u4_app_disp_width = 0;
         ps_ctl_op->u4_error_code |= (1 << IVD_UNSUPPORTEDPARAM);
         ps_ctl_op->u4_error_code |= ERROR_DISP_WIDTH_INVALID;
         ret = IV_FAIL;
     }
-    else
-    {
-        if(ps_ctl_ip->u4_disp_wd >= ps_dec->u2_pic_wd)
-        {
-            ps_dec->u4_app_disp_width = ps_ctl_ip->u4_disp_wd;
-        }
-        else if(0 == ps_dec->i4_header_decoded)
-        {
-            ps_dec->u4_app_disp_width = ps_ctl_ip->u4_disp_wd;
-        }
-        else if(ps_ctl_ip->u4_disp_wd == 0)
-        {
-            ps_dec->u4_app_disp_width = 0;
-        }
-        else
-        {
-            /*
-             * Set the display width to zero. This will ensure that the wrong value we had stored (0xFFFFFFFF)
-             * does not propogate.
-             */
-            ps_dec->u4_app_disp_width = 0;
-            ps_ctl_op->u4_error_code |= (1 << IVD_UNSUPPORTEDPARAM);
-            ps_ctl_op->u4_error_code |= ERROR_DISP_WIDTH_INVALID;
-            ret = IV_FAIL;
-        }
-    }
+
     if(ps_ctl_ip->e_vid_dec_mode == IVD_DECODE_FRAME)
         ps_dec->i4_decode_header = 0;
     else if(ps_ctl_ip->e_vid_dec_mode == IVD_DECODE_HEADER)
@@ -3231,6 +3254,11 @@
             ret = ih264d_get_frame_dimensions(dec_hdl, (void *)pv_api_ip,
                                               (void *)pv_api_op);
             break;
+        case IH264D_CMD_CTL_GET_VUI_PARAMS:
+            ret = ih264d_get_vui_params(dec_hdl, (void *)pv_api_ip,
+                                        (void *)pv_api_op);
+            break;
+
         case IH264D_CMD_CTL_SET_PROCESSOR:
             ret = ih264d_set_processor(dec_hdl, (void *)pv_api_ip,
                                        (void *)pv_api_op);
@@ -3458,6 +3486,72 @@
 
 }
 
+WORD32 ih264d_get_vui_params(iv_obj_t *dec_hdl,
+                             void *pv_api_ip,
+                             void *pv_api_op)
+{
+    ih264d_ctl_get_vui_params_ip_t *ps_ip;
+    ih264d_ctl_get_vui_params_op_t *ps_op;
+    dec_struct_t *ps_dec = dec_hdl->pv_codec_handle;
+    dec_seq_params_t *ps_sps;
+    vui_t *ps_vui;
+    WORD32 i;
+    UWORD32 u4_size;
+
+    ps_ip = (ih264d_ctl_get_vui_params_ip_t *)pv_api_ip;
+    ps_op = (ih264d_ctl_get_vui_params_op_t *)pv_api_op;
+    UNUSED(ps_ip);
+
+    u4_size = ps_op->u4_size;
+    memset(ps_op, 0, sizeof(ih264d_ctl_get_vui_params_op_t));
+    ps_op->u4_size = u4_size;
+
+    if(NULL == ps_dec->ps_cur_sps)
+    {
+        ps_op->u4_error_code = ERROR_VUI_PARAMS_NOT_FOUND;
+        return IV_FAIL;
+    }
+
+    ps_sps = ps_dec->ps_cur_sps;
+    if((0 == ps_sps->u1_is_valid)
+                    || (0 == ps_sps->u1_vui_parameters_present_flag))
+    {
+        ps_op->u4_error_code = ERROR_VUI_PARAMS_NOT_FOUND;
+        return IV_FAIL;
+    }
+
+    ps_vui = &ps_sps->s_vui;
+
+    ps_op->u1_aspect_ratio_idc              = ps_vui->u1_aspect_ratio_idc;
+    ps_op->u2_sar_width                     = ps_vui->u2_sar_width;
+    ps_op->u2_sar_height                    = ps_vui->u2_sar_height;
+    ps_op->u1_overscan_appropriate_flag     = ps_vui->u1_overscan_appropriate_flag;
+    ps_op->u1_video_format                  = ps_vui->u1_video_format;
+    ps_op->u1_video_full_range_flag         = ps_vui->u1_video_full_range_flag;
+    ps_op->u1_colour_primaries              = ps_vui->u1_colour_primaries;
+    ps_op->u1_tfr_chars                     = ps_vui->u1_tfr_chars;
+    ps_op->u1_matrix_coeffs                 = ps_vui->u1_matrix_coeffs;
+    ps_op->u1_cr_top_field                  = ps_vui->u1_cr_top_field;
+    ps_op->u1_cr_bottom_field               = ps_vui->u1_cr_bottom_field;
+    ps_op->u4_num_units_in_tick             = ps_vui->u4_num_units_in_tick;
+    ps_op->u4_time_scale                    = ps_vui->u4_time_scale;
+    ps_op->u1_fixed_frame_rate_flag         = ps_vui->u1_fixed_frame_rate_flag;
+    ps_op->u1_nal_hrd_params_present        = ps_vui->u1_nal_hrd_params_present;
+    ps_op->u1_vcl_hrd_params_present        = ps_vui->u1_vcl_hrd_params_present;
+    ps_op->u1_low_delay_hrd_flag            = ps_vui->u1_low_delay_hrd_flag;
+    ps_op->u1_pic_struct_present_flag       = ps_vui->u1_pic_struct_present_flag;
+    ps_op->u1_bitstream_restriction_flag    = ps_vui->u1_bitstream_restriction_flag;
+    ps_op->u1_mv_over_pic_boundaries_flag   = ps_vui->u1_mv_over_pic_boundaries_flag;
+    ps_op->u4_max_bytes_per_pic_denom       = ps_vui->u4_max_bytes_per_pic_denom;
+    ps_op->u4_max_bits_per_mb_denom         = ps_vui->u4_max_bits_per_mb_denom;
+    ps_op->u4_log2_max_mv_length_horz       = ps_vui->u4_log2_max_mv_length_horz;
+    ps_op->u4_log2_max_mv_length_vert       = ps_vui->u4_log2_max_mv_length_vert;
+    ps_op->u4_num_reorder_frames            = ps_vui->u4_num_reorder_frames;
+    ps_op->u4_max_dec_frame_buffering       = ps_vui->u4_max_dec_frame_buffering;
+
+    return IV_SUCCESS;
+}
+
 WORD32 ih264d_set_num_cores(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
 {
     ih264d_ctl_set_num_cores_ip_t *ps_ip;
diff --git a/decoder/ih264d_dpb_mgr.c b/decoder/ih264d_dpb_mgr.c
index 7c4305b..6261986 100644
--- a/decoder/ih264d_dpb_mgr.c
+++ b/decoder/ih264d_dpb_mgr.c
@@ -17,9 +17,10 @@
  *****************************************************************************
  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
 */
+#ifdef __ANDROID__
 #include "log/log.h"
 #include <cutils/log.h>
-
+#endif
 #include "ih264_typedefs.h"
 #include "ih264_macros.h"
 #include "ih264_platform_macros.h"
@@ -374,7 +375,16 @@
         {
             /* Can occur only for field bottom pictures */
             ps_dpb_info[i].s_bot_field.u1_reference_info = IS_SHORT_TERM;
-            return 0;
+
+            /*signal an error in the case of frame pic*/
+            if(ps_dpb_info[i].ps_pic_buf->u1_pic_type == FRM_PIC)
+            {
+                return ERROR_DBP_MANAGER_T;
+            }
+            else
+            {
+                return OK;
+            }
         }
 
         if((ps_dpb_info[i].u1_used_as_ref == UNUSED_FOR_REF)
@@ -877,8 +887,10 @@
                 {
                     if (j >= MAX_REF_BUFS)
                     {
+#ifdef __ANDROID__
                         ALOGE("b/25818142");
                         android_errorWriteLog(0x534e4554, "25818142");
+#endif
                         ps_dpb_cmds->u1_num_of_commands = 0;
                         return -1;
                     }
diff --git a/decoder/ih264d_error_handler.h b/decoder/ih264d_error_handler.h
index 5b1bc84..586fe8a 100644
--- a/decoder/ih264d_error_handler.h
+++ b/decoder/ih264d_error_handler.h
@@ -112,7 +112,8 @@
     ERROR_PIC_NUM_IS_REPEATED = 0x92,
     ERROR_IN_LAST_SLICE_OF_PIC = 0x93,
     ERROR_NEW_FRAME_EXPECTED = 0x94,
-    ERROR_INCOMPLETE_FRAME = 0x95
+    ERROR_INCOMPLETE_FRAME = 0x95,
+    ERROR_VUI_PARAMS_NOT_FOUND = 0x96
 
 } h264_decoder_error_code_t;
 
diff --git a/decoder/ih264d_parse_slice.c b/decoder/ih264d_parse_slice.c
index 911b11d..22a7d0b 100644
--- a/decoder/ih264d_parse_slice.c
+++ b/decoder/ih264d_parse_slice.c
@@ -1258,8 +1258,11 @@
     /*--------------------------------------------------------------------*/
     /* Check if the slice is part of new picture                          */
     /*--------------------------------------------------------------------*/
-    i1_is_end_of_poc = 0;
-    if(!ps_dec->u1_first_slice_in_stream)
+    /* First slice of a picture is always considered as part of new picture */
+    i1_is_end_of_poc = 1;
+    ps_dec->ps_dec_err_status->u1_err_flag &= MASK_REJECT_CUR_PIC;
+
+    if(ps_dec->u4_first_slice_in_pic != 2)
     {
         i1_is_end_of_poc = ih264d_is_end_of_pic(u2_frame_num, u1_nal_ref_idc,
                                             &s_tmp_poc, &ps_dec->s_cur_pic_poc,
@@ -1267,23 +1270,6 @@
                                             u1_nal_unit_type, u4_idr_pic_id,
                                             u1_field_pic_flag,
                                             u1_bottom_field_flag);
-
-        /* since we support only Full frame decode, every new process should
-         * process a new pic
-         */
-        if((ps_dec->u4_first_slice_in_pic == 2) && (i1_is_end_of_poc == 0))
-        {
-            /* if it is the first slice is process call ,it should be a new frame. If it is not
-             * reject current pic and dont add it to dpb
-             */
-            ps_dec->ps_dec_err_status->u1_err_flag |= REJECT_CUR_PIC;
-            i1_is_end_of_poc = 1;
-        }
-        else
-        {
-            /* reset REJECT_CUR_PIC */
-            ps_dec->ps_dec_err_status->u1_err_flag &= MASK_REJECT_CUR_PIC;
-        }
     }
 
     /*--------------------------------------------------------------------*/
diff --git a/decoder/ih264d_process_intra_mb.c b/decoder/ih264d_process_intra_mb.c
index 279ff87..211d796 100644
--- a/decoder/ih264d_process_intra_mb.c
+++ b/decoder/ih264d_process_intra_mb.c
@@ -930,7 +930,9 @@
             }
         }
         {
-            UWORD8 au1_ngbr_pels[33];
+            /* Align the size to multiple of 8, so that SIMD functions
+               can read 64 bits at a time. Only 33 bytes are actaully used */
+            UWORD8 au1_ngbr_pels[40];
             /* Get neighbour pixels */
             /* left pels */
             if(u2_use_left_mb)
@@ -1175,7 +1177,9 @@
         /* Scan the sub-blocks in Raster Scan Order */
         for(u1_sub_mb_num = 0; u1_sub_mb_num < 16; u1_sub_mb_num++)
         {
-            UWORD8 au1_ngbr_pels[13];
+            /* Align the size to multiple of 8, so that SIMD functions
+               can read 64 bits at a time. Only 13 bytes are actaully used */
+            UWORD8 au1_ngbr_pels[16];
 
             u1_sub_blk_x = u1_sub_mb_num & 0x3;
             u1_sub_blk_y = u1_sub_mb_num >> 2;
@@ -1664,7 +1668,9 @@
             }
 
             {
-                UWORD8 au1_ngbr_pels[25];
+                /* Align the size to multiple of 8, so that SIMD functions
+                can read 64 bits at a time. Only 25 bytes are actaully used */
+                UWORD8 au1_ngbr_pels[32];
                 WORD32 ngbr_avail;
                 ngbr_avail = u1_is_left_sub_block << 0;
                 ngbr_avail |= u1_is_top_sub_block << 2;
diff --git a/decoder/ih264d_tables.c b/decoder/ih264d_tables.c
index d49de14..c45525a 100644
--- a/decoder/ih264d_tables.c
+++ b/decoder/ih264d_tables.c
@@ -855,7 +855,8 @@
     { 0, 0 /* Junk */, /* 16x16 */
       0, 8, /* 16x8 */
       0, 2, /* 8x16 */
-      0, 2, 8, 10 /* 8x8 */
+      0, 2, 8, 10 /* 8x8 */,
+      0 /* One extra entry is read at the end of loop, but not used */
     };
 
 /*!
diff --git a/decoder/ih264d_utils.c b/decoder/ih264d_utils.c
index acca990..feda8b0 100644
--- a/decoder/ih264d_utils.c
+++ b/decoder/ih264d_utils.c
@@ -451,7 +451,6 @@
 {
     UWORD8 u1_pic_type, u1_nal_ref_idc;
     dec_slice_params_t *ps_cur_slice = ps_dec->ps_cur_slice;
-    WORD32 ret;
 
     /* If nal_ref_idc is equal to 0 for one slice or slice data partition NAL
      unit of a particular picture, it shall be equal to 0 for all slice and
@@ -475,34 +474,29 @@
             if(ps_dec->ps_dpb_cmds->u1_long_term_reference_flag == 0)
             {
                 ih264d_reset_ref_bufs(ps_dec->ps_dpb_mgr);
-
-                {
-                    ret = ih264d_insert_st_node(ps_dec->ps_dpb_mgr,
-                                          ps_dec->ps_cur_pic,
-                                          ps_dec->u1_pic_buf_id,
-                                          ps_cur_slice->u2_frame_num);
-                    if(ret != OK)
-                        return ret;
-                }
+                /* ignore DPB errors */
+                ih264d_insert_st_node(ps_dec->ps_dpb_mgr,
+                                      ps_dec->ps_cur_pic,
+                                      ps_dec->u1_pic_buf_id,
+                                      ps_cur_slice->u2_frame_num);
             }
             else
             {
                 /* Equivalent of inserting a pic directly as longterm Pic */
 
                 {
-                    ret = ih264d_insert_st_node(ps_dec->ps_dpb_mgr,
+                    /* ignore DPB errors */
+                    ih264d_insert_st_node(ps_dec->ps_dpb_mgr,
                                           ps_dec->ps_cur_pic,
                                           ps_dec->u1_pic_buf_id,
                                           ps_cur_slice->u2_frame_num);
-                    if(ret != OK)
-                        return ret;
+
                     /* Set longTermIdx = 0, MaxLongTermFrameIdx = 0 */
-                    ret = ih264d_delete_st_node_or_make_lt(
+                    ih264d_delete_st_node_or_make_lt(
                                     ps_dec->ps_dpb_mgr,
                                     ps_cur_slice->u2_frame_num, 0,
                                     ps_cur_slice->u1_field_pic_flag);
-                    if(ret != OK)
-                        return ret;
+
                     ps_dec->ps_dpb_mgr->u1_max_lt_pic_idx_plus1 = 1;
                 }
             }
@@ -513,19 +507,16 @@
             {
                 UWORD16 u2_pic_num = ps_cur_slice->u2_frame_num;
 
+                /* ignore DPB errors */
+                ih264d_do_mmco_buffer(ps_dec->ps_dpb_cmds, ps_dec->ps_dpb_mgr,
+                              ps_dec->ps_cur_sps->u1_num_ref_frames, u2_pic_num,
+                              (ps_dec->ps_cur_sps->u2_u4_max_pic_num_minus1),
+                              ps_dec->u1_nal_unit_type, ps_dec->ps_cur_pic,
+                              ps_dec->u1_pic_buf_id,
+                              ps_cur_slice->u1_field_pic_flag,
+                              ps_dec->e_dec_status);
 
 
-                ret = ih264d_do_mmco_buffer(
-                                ps_dec->ps_dpb_cmds, ps_dec->ps_dpb_mgr,
-                                ps_dec->ps_cur_sps->u1_num_ref_frames,
-                                u2_pic_num,
-                                (ps_dec->ps_cur_sps->u2_u4_max_pic_num_minus1),
-                                ps_dec->u1_nal_unit_type, ps_dec->ps_cur_pic,
-                                ps_dec->u1_pic_buf_id,
-                                ps_cur_slice->u1_field_pic_flag,
-                                ps_dec->e_dec_status);
-                if(ret != OK)
-                    return ret;
             }
         }
         ih264d_update_default_index_list(ps_dec->ps_dpb_mgr);
@@ -1906,6 +1897,10 @@
     RETURN_IF((NULL == pv_buf), IV_FAIL);
     ps_dec->p_ctxt_inc_mb_map = pv_buf;
 
+    /* 0th entry of CtxtIncMbMap will be always be containing default values
+     for CABAC context representing MB not available */
+    ps_dec->p_ctxt_inc_mb_map += 1;
+
     size = (sizeof(mv_pred_t) * ps_dec->u1_recon_mb_grp
                         * 16);
     pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
@@ -2088,9 +2083,6 @@
     RETURN_IF((NULL == pv_buf), IV_FAIL);
     ps_dec->pu1_pic_buf_base = pv_buf;
 
-    /* 0th entry of CtxtIncMbMap will be always be containing default values
-     for CABAC context representing MB not available */
-    ps_dec->p_ctxt_inc_mb_map += 1;
     /* Post allocation Increment Actions */
 
     /***************************************************************************/
diff --git a/decoder/ih264d_vui.c b/decoder/ih264d_vui.c
index 97b40c2..15bc37d 100644
--- a/decoder/ih264d_vui.c
+++ b/decoder/ih264d_vui.c
@@ -149,6 +149,14 @@
                         ps_bitstrm, 1);
     }
     u4_bits = ih264d_get_bits_h264(ps_bitstrm, 1);
+    /* Initialize to unspecified (5 for video_format and
+       2 for colour_primaries, tfr_chars, matrix_coeffs  */
+    ps_vu4->u1_video_format = 5;
+    ps_vu4->u1_video_full_range_flag = 0;
+    ps_vu4->u1_colour_primaries = 2;
+    ps_vu4->u1_tfr_chars = 2;
+    ps_vu4->u1_matrix_coeffs = 2;
+
     if(u4_bits)
     {
         ps_vu4->u1_video_format = ih264d_get_bits_h264(ps_bitstrm, 3);
diff --git a/test/decoder.mk b/test/decoder.mk
index 1a49a92..0dda948 100644
--- a/test/decoder.mk
+++ b/test/decoder.mk
@@ -9,5 +9,5 @@
 LOCAL_C_INCLUDES += $(LOCAL_PATH)/../decoder $(LOCAL_PATH)/../common $(LOCAL_PATH)/decoder/
 LOCAL_SRC_FILES := decoder/main.c
 LOCAL_STATIC_LIBRARIES := libavcdec
-
+LOCAL_SHARED_LIBRARIES := liblog
 include $(BUILD_EXECUTABLE)
diff --git a/test/decoder/dec.cfg b/test/decoder/dec.cfg
new file mode 100644
index 0000000..f452ea1
--- /dev/null
+++ b/test/decoder/dec.cfg
@@ -0,0 +1,12 @@
+--input input.h264
+--save_output 0
+--num_frames -1
+--output out.yuv
+--chroma_format YUV_420P
+--share_display_buf 0
+--num_cores 3
+--loopback 0
+--display 0
+--fps 59.94
+--arch ARM_A9Q
+--soc GENERIC
diff --git a/test/decoder/main.c b/test/decoder/main.c
index 875ed3d..ea7fca3 100644
--- a/test/decoder/main.c
+++ b/test/decoder/main.c
@@ -2607,7 +2607,30 @@
 */
     }
 
+    /*************************************************************************/
+    /* Get VUI parameters                                                    */
+    /*************************************************************************/
+    {
 
+        ih264d_ctl_get_vui_params_ip_t s_ctl_get_vui_params_ip;
+        ih264d_ctl_get_vui_params_op_t s_ctl_get_vui_params_op;
+
+        s_ctl_get_vui_params_ip.e_cmd = IVD_CMD_VIDEO_CTL;
+        s_ctl_get_vui_params_ip.e_sub_cmd =
+                        (IVD_CONTROL_API_COMMAND_TYPE_T)IH264D_CMD_CTL_GET_VUI_PARAMS;
+        s_ctl_get_vui_params_ip.u4_size =
+                        sizeof(ih264d_ctl_get_vui_params_ip_t);
+        s_ctl_get_vui_params_op.u4_size =
+                        sizeof(ih264d_ctl_get_vui_params_op_t);
+
+        ret = ivd_api_function((iv_obj_t *)codec_obj, (void *)&s_ctl_get_vui_params_ip,
+                             (void *)&s_ctl_get_vui_params_op);
+        if(IV_SUCCESS != ret)
+        {
+            sprintf(ac_error_str, "Error in Get VUI params");
+            //codec_exit(ac_error_str);
+        }
+    }
 
     /*************************************************************************/
     /* Set the decoder in frame decode mode. It was set in header decode     */
diff --git a/test/encoder/enc.cfg b/test/encoder/enc.cfg
new file mode 100644
index 0000000..ba62199
--- /dev/null
+++ b/test/encoder/enc.cfg
@@ -0,0 +1,47 @@
+--input input_qvga.yuv
+--output output.264
+--recon recon.yuv
+--chksum chksum.md5
+--chksum_enable 0
+--recon_enable 0
+--input_chroma_format YUV_420P
+--recon_chroma_format YUV_420P
+--qp_i 24
+--qp_p 27
+--qp_b 29
+--qp_i_min 4
+--qp_i_max 49
+--qp_p_min 4
+--qp_p_max 49
+--qp_b_min 4
+--qp_b_max 49
+--max_wd 1920
+--max_ht 1080
+--psnr 0
+--slice 0
+--slice_param 0
+--num_frames -1
+--search_range_x 16
+--search_range_y 16
+--width 320
+--height 240
+--src_framerate 30
+--tgt_framerate 30
+--num_cores 4
+--rc 2
+--bitrate 256000
+--vbv_delay 1000
+--disable_deblock_level 0
+--intra_4x4_enable 1
+--i_interval 1000
+--me_speed 100
+--hpel 1
+--fast_sad 0
+--speed NORMAL
+--max_level 41
+--idr_interval 1000
+--entropy 0
+--bframes 0
+--adaptive_intra_refresh 0
+--air_refresh_period 30
+