1/******************************************************************************
2 *
3 * Copyright (C) 2015 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *****************************************************************************
18 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19*/
20#ifndef  _IH264D_UTILS_H_
21#define  _IH264D_UTILS_H_
22/*!
23**************************************************************************
24* \file ih264d_utils.h
25*
26* \brief
27*    Contains declaration of routines
28*    that handle of start and end of pic processing
29*
30* \date
31*    19/12/2002
32*
33* \author  AI
34**************************************************************************
35*/
36#include "ih264d_defs.h"
37#include "ih264_typedefs.h"
38#include "ih264_macros.h"
39#include "ih264_platform_macros.h"
40#include "ih264d_structs.h"
41#include "ih264d_parse_cavlc.h"
42
43#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
44if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
45void pad_frm_buff_vert(dec_struct_t *ps_dec);
46
47UWORD8 ih264d_is_end_of_pic(UWORD16 u2_frame_num,
48                            UWORD8 u1_nal_ref_idc,
49                            pocstruct_t *ps_cur_poc,
50                            pocstruct_t *ps_prev_poc,
51                            dec_slice_params_t * ps_prev_slice,
52                            UWORD8 u1_pic_order_cnt_type,
53                            UWORD8 u1_nal_unit_type,
54                            UWORD32 u4_idr_pic_id,
55                            UWORD8 u1_field_pic_flag,
56                            UWORD8 u1_bottom_field_flag);
57
58WORD32 ih264d_end_of_pic_processing(dec_struct_t * ps_dec);
59
60WORD32 ih264d_init_pic(dec_struct_t *ps_dec,
61                       UWORD16 u2_frame_num,
62                       WORD32 i4_poc,
63                       dec_pic_params_t * ps_pps);
64
65WORD32 ih264d_end_of_pic_processing(dec_struct_t * ps_dec);
66WORD32 ih264d_decode_pic_order_cnt(UWORD8 u1_is_idr_slice,
67                                   UWORD32 u2_frame_num,
68                                   pocstruct_t *ps_prev_poc,
69                                   pocstruct_t *ps_cur_poc,
70                                   dec_slice_params_t *ps_cur_slice,
71                                   dec_pic_params_t * ps_pps,
72                                   UWORD8 u1_nal_ref_idc,
73                                   UWORD8 u1_bottom_field_flag,
74                                   UWORD8 u1_field_pic_flag,
75                                   WORD32 *pi4_poc);
76void ih264d_release_display_bufs(dec_struct_t *ps_dec);
77WORD32 ih264d_assign_display_seq(dec_struct_t *ps_dec);
78void ih264d_assign_pic_num(dec_struct_t *ps_dec);
79
80void ih264d_unpack_coeff4x4_dc_4x4blk(tu_sblk4x4_coeff_data_t *ps_tu_4x4,
81                                      WORD16 *pi2_out_coeff_data,
82                                      UWORD8 *pu1_inv_scan);
83
84WORD32 ih264d_update_qp(dec_struct_t * ps_dec, const WORD8 i1_qp);
85WORD32 ih264d_decode_gaps_in_frame_num(dec_struct_t *ps_dec,
86                                       UWORD16 u2_frame_num);
87
88WORD32 ih264d_get_next_display_field(dec_struct_t * ps_dec,
89                                  ivd_out_bufdesc_t *ps_out_buffer,
90                                  ivd_get_display_frame_op_t *pv_disp_op);
91
92void ih264d_release_display_field(dec_struct_t *ps_dec,
93                                  ivd_get_display_frame_op_t *pv_disp_op);
94void ih264d_close_video_decoder(iv_obj_t *iv_obj_t);
95WORD32 ih264d_get_dpb_size(dec_seq_params_t *ps_seq);
96WORD32 ih264d_get_next_nal_unit(UWORD8 *pu1_buf,
97                                UWORD32 u4_cur_pos,
98                                UWORD32 u4_max_ofst,
99                                UWORD32 *pu4_length_of_start_code);
100
101WORD16 ih264d_free_dynamic_bufs(dec_struct_t * ps_dec);
102#endif /* _IH264D_UTILS_H_ */
103