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_DEBLOCKING_H_
21#define  _IH264D_DEBLOCKING_H_
22/*!
23 **************************************************************************
24 * \file ih264d_deblocking.h
25 *
26 * \brief
27 *    Declarations of deblocking functions
28 *
29 * \date
30 *    23/11/2002
31 *
32 * \author  AI
33 **************************************************************************
34 */
35#include "ih264_typedefs.h"
36#include "ih264_macros.h"
37#include "ih264_platform_macros.h"
38#include "ih264d_structs.h"
39
40WORD8 ih264d_set_deblocking_parameters(deblk_mb_t * ps_cur_deblk_mb,
41                                       dec_slice_params_t * ps_slice,
42                                       UWORD8 u1_mb_ngbr_availablity,
43                                       UWORD8 u1_mb_field_decoding_flag);
44
45void ih264d_copy_intra_pred_line(dec_struct_t *ps_dec,
46                                 dec_mb_info_t *ps_cur_mb_info,
47                                 UWORD32 nmb_index);
48
49void FilterBoundaryLeft(tfr_ctxt_t * const ps_tfr_cxt,
50                        const WORD8 i1_cb_qp_idx_ofst,
51                        const WORD8 i1_cr_qp_idx_ofst,
52                        deblk_mb_t * const ps_cur_mb,
53                        UWORD16 u2_strd_y,
54                        UWORD16 u2_strd_uv,
55                        deblk_mb_t * const ps_left_mb,
56                        const UWORD32 pu4_bs_tab[],
57                        const UWORD8 u1_cur_fld);
58void FilterBoundaryTop(tfr_ctxt_t * const ps_tfr_cxt,
59                       const WORD8 i1_cb_qp_idx_ofst,
60                       const WORD8 i1_cr_qp_idx_ofst,
61                       deblk_mb_t * const ps_cur_mb,
62                       const UWORD16 u2_strd_y,
63                       const UWORD16 u2_strd_uv,
64                       deblk_mb_t * const ps_top_mb,
65                       const UWORD32 u4_bs);
66void deblock_mb(tfr_ctxt_t * const ps_tfr_cxt,
67                const WORD8 i1_cb_qp_idx_ofst,
68                const WORD8 i1_cr_qp_idx_ofst,
69                deblk_mb_t * const ps_cur_mb,
70                WORD32 i4_strd_y,
71                WORD32 i4_strd_uv,
72                deblk_mb_t * const ps_top_mb,
73                deblk_mb_t * const ps_left_mb,
74                const UWORD8 u1_cur_fld,
75                const UWORD8 u1_extra_top_edge);
76void ih264d_deblock_mb_mbaff(dec_struct_t *ps_dec,
77                             tfr_ctxt_t * const ps_tfr_cxt,
78                             const WORD8 i1_cb_qp_idx_ofst,
79                             const WORD8 i1_cr_qp_idx_ofst,
80                             deblk_mb_t * const ps_cur_mb,
81                             WORD32 i4_strd_y,
82                             WORD32 i4_strd_uv,
83                             deblk_mb_t * const ps_top_mb,
84                             deblk_mb_t * const ps_left_mb,
85                             const UWORD8 u1_cur_fld,
86                             const UWORD8 u1_extra_top_edge);
87
88void ih264d_deblock_picture_mbaff(dec_struct_t * const ps_dec);
89
90void ih264d_deblock_picture_non_mbaff(dec_struct_t * const ps_dec);
91
92void ih264d_deblock_picture_progressive(dec_struct_t * const ps_dec);
93
94void ih264d_compute_bs_mbaff(dec_struct_t * ps_dec,
95                             dec_mb_info_t * ps_cur_mb_info,
96                             const UWORD16 u2_mbxn_mb);
97void ih264d_compute_bs_non_mbaff(dec_struct_t * ps_dec,
98                                 dec_mb_info_t * ps_cur_mb_info,
99                                 const UWORD16 u2_mbxn_mb);
100
101void ih264d_fill_bs_mbedge_2(dec_struct_t * ps_dec,
102                             dec_mb_info_t * ps_cur_mb_info,
103                             const UWORD16 u2_mbxn_mb);
104
105void ih264d_fill_bs_mbedge_4(dec_struct_t * ps_dec,
106                             dec_mb_info_t * ps_cur_mb_info,
107                             const UWORD16 u2_mbxn_mb);
108
109void ih264d_fill_bs1_16x16mb_pslice(mv_pred_t *ps_cur_mv_pred,
110                                    mv_pred_t *ps_top_mv_pred,
111                                    void **ppv_map_ref_idx_to_poc,
112                                    UWORD32 *pu4_bs_table,
113                                    mv_pred_t *ps_leftmost_mv_pred,
114                                    neighbouradd_t *ps_left_addr,
115                                    void **u4_pic_addrress,
116                                    WORD32 i4_ver_mvlimit);
117
118void ih264d_fill_bs1_non16x16mb_pslice(mv_pred_t *ps_cur_mv_pred,
119                                       mv_pred_t *ps_top_mv_pred,
120                                       void **ppv_map_ref_idx_to_poc,
121                                       UWORD32 *pu4_bs_table,
122                                       mv_pred_t *ps_leftmost_mv_pred,
123                                       neighbouradd_t *ps_left_addr,
124                                       void **u4_pic_addrress,
125                                       WORD32 i4_ver_mvlimit);
126
127void ih264d_fill_bs1_16x16mb_bslice(mv_pred_t *ps_cur_mv_pred,
128                                    mv_pred_t *ps_top_mv_pred,
129                                    void **ppv_map_ref_idx_to_poc,
130                                    UWORD32 *pu4_bs_table,
131                                    mv_pred_t *ps_leftmost_mv_pred,
132                                    neighbouradd_t *ps_left_addr,
133                                    void **u4_pic_addrress,
134                                    WORD32 i4_ver_mvlimit);
135
136void ih264d_fill_bs1_non16x16mb_bslice(mv_pred_t *ps_cur_mv_pred,
137                                       mv_pred_t *ps_top_mv_pred,
138                                       void **ppv_map_ref_idx_to_poc,
139                                       UWORD32 *pu4_bs_table,
140                                       mv_pred_t *ps_leftmost_mv_pred,
141                                       neighbouradd_t *ps_left_addr,
142                                       void **u4_pic_addrress,
143                                       WORD32 i4_ver_mvlimit);
144
145void ih264d_fill_bs_xtra_left_edge_cur_fld(UWORD32 *pu4_bs,
146                                           WORD32 u4_left_mb_t_csbp,
147                                           WORD32 u4_left_mb_b_csbp,
148                                           WORD32 u4_cur_mb_csbp,
149                                           UWORD32 u4_cur_mb_top);
150
151void ih264d_fill_bs_xtra_left_edge_cur_frm(UWORD32 *pu4_bs,
152                                           WORD32 u4_left_mb_t_csbp,
153                                           WORD32 u4_left_mb_b_csbp,
154                                           WORD32 u4_cur_mb_csbp,
155                                           UWORD32 u4_cur_mb_top);
156
157void ih264d_deblock_mb_nonmbaff(dec_struct_t *ps_dec,
158                                tfr_ctxt_t * const ps_tfr_cxt,
159                                const WORD8 i1_cb_qp_idx_ofst,
160                                const WORD8 i1_cr_qp_idx_ofst,
161                                WORD32 i4_strd_y,
162                                WORD32 i4_strd_uv);
163
164void ih264d_init_deblk_tfr_ctxt(dec_struct_t * ps_dec,
165                                pad_mgr_t *ps_pad_mgr,
166                                tfr_ctxt_t *ps_tfr_cxt,
167                                UWORD16 u2_image_wd_mb,
168                                UWORD8 u1_mbaff);
169
170void ih264d_deblock_mb_level(dec_struct_t *ps_dec,
171                             dec_mb_info_t *ps_cur_mb_info,
172                             UWORD32 nmb_index);
173
174#endif /* _IH264D_DEBLOCKING_H_ */
175