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 /**
21  *******************************************************************************
22  * @file
23  *  ih264_trans_quant.h
24  *
25  * @brief
26  *  Contains declarations for forward and inverse transform paths for H264
27  *
28  * @author
29  *  Ittiam
30  *
31  * @remarks
32  *
33  *******************************************************************************
34  */
35 
36 #ifndef IH264_TRANS_QUANT_H_
37 #define IH264_TRANS_QUANT_H_
38 
39 /*****************************************************************************/
40 /* Extern Function Declarations                                              */
41 /*****************************************************************************/
42 
43 
44 typedef void ih264_resi_trans_dctrans_quant_ft(UWORD8*pu1_src,
45                                        UWORD8 *pu1_pred,
46                                        WORD16 *pi2_out,
47                                        WORD32 src_strd,
48                                        WORD32 pred_strd,
49                                        WORD32 dst_strd,
50                                        const UWORD16 *pu2_scale_mat,
51                                        const UWORD16 *pu2_thresh_mat,
52                                        UWORD32 u4_qbit,
53                                        UWORD32 u4_round_fact,
54                                        UWORD8 *pu1_nnz);
55 
56 typedef void ih264_idctrans_iquant_itrans_recon_ft(WORD16 *pi2_src,
57                                           UWORD8 *pu1_pred,
58                                           UWORD8 *pu1_out,
59                                           WORD32 src_strd,
60                                           WORD32 pred_strd,
61                                           WORD32 out_strd,
62                                           const UWORD16 *pu2_iscale_mat,
63                                           const UWORD16 *pu2_weigh_mat,
64                                           UWORD32 qp_div,
65                                           UWORD32 pi4_cntrl,
66                                           WORD32 *pi4_tmp);
67 
68 
69 /*Function prototype declarations*/
70 typedef void ih264_resi_trans_quant_ft(UWORD8*pu1_src,
71                                        UWORD8 *pu1_pred,
72                                        WORD16 *pi2_out,
73                                        WORD32 src_strd,
74                                        WORD32 pred_strd,
75                                        const UWORD16 *pu2_scale_mat,
76                                        const UWORD16 *pu2_thresh_mat,
77                                        UWORD32 u4_qbit,
78                                        UWORD32 u4_round_fact,
79                                        UWORD8 *pu1_nnz,
80                                        WORD16 *pi2_alt_dc_addr);
81 
82 typedef void ih264_luma_16x16_resi_trans_dctrans_quant_ft(UWORD8 *pu1_src,
83                                                           UWORD8 *pu1_pred,
84                                                           WORD16 *pi2_out,
85                                                           WORD32 src_strd,
86                                                           WORD32 pred_strd,
87                                                           WORD32 dst_strd,
88                                                           const UWORD16 *pu2_scale_matrix,
89                                                           const UWORD16 *pu2_threshold_matrix,
90                                                           UWORD32 u4_qbits,
91                                                           UWORD32 u4_round_factor,
92                                                           UWORD8 *pu1_nnz,
93                                                           UWORD32 u4_dc_flag);
94 
95 typedef void ih264_chroma_8x8_resi_trans_dctrans_quant_ft(UWORD8 *pu1_src,
96                                                           UWORD8 *pu1_pred,
97                                                           WORD16 *pi2_out,
98                                                           WORD32 src_strd,
99                                                           WORD32 pred_strd,
100                                                           WORD32 dst_strd,
101                                                           const UWORD16 *pu2_scale_matrix,
102                                                           const UWORD16 *pu2_threshold_matrix,
103                                                           UWORD32 u4_qbits,
104                                                           UWORD32 u4_round_factor,
105                                                           UWORD8 *pu1_nnz);
106 
107 typedef void ih264_iquant_itrans_recon_ft(WORD16 *pi2_src,
108                                           UWORD8 *pu1_pred,
109                                           UWORD8 *pu1_out,
110                                           WORD32 pred_strd,
111                                           WORD32 out_strd,
112                                           const UWORD16 *pu2_iscale_mat,
113                                           const UWORD16 *pu2_weigh_mat,
114                                           UWORD32 qp_div,
115                                           WORD16 *pi2_tmp,
116                                           WORD32 iq_start_idx,
117                                           WORD16 *pi2_dc_ld_addr);
118 
119 
120 typedef void ih264_iquant_itrans_recon_chroma_ft(WORD16 *pi2_src,
121                                                  UWORD8 *pu1_pred,
122                                                  UWORD8 *pu1_out,
123                                                  WORD32 pred_strd,
124                                                  WORD32 out_strd,
125                                                  const UWORD16 *pu2_iscal_mat,
126                                                  const UWORD16 *pu2_weigh_mat,
127                                                  UWORD32 u4_qp_div_6,
128                                                  WORD16 *pi2_tmp,
129                                                  WORD16 *pi2_dc_src);
130 
131 
132 typedef void ih264_luma_16x16_idctrans_iquant_itrans_recon_ft(WORD16 *pi2_src,
133                                                               UWORD8 *pu1_pred,
134                                                               UWORD8 *pu1_out,
135                                                               WORD32 src_strd,
136                                                               WORD32 pred_strd,
137                                                               WORD32 out_strd,
138                                                               const UWORD16 *pu2_iscale_mat,
139                                                               const UWORD16 *pu2_weigh_mat,
140                                                               UWORD32 qp_div,
141                                                               UWORD32 pi4_cntrl,
142                                                               UWORD32 u4_dc_trans_flag,
143                                                               WORD32 *pi4_tmp);
144 
145 typedef void ih264_chroma_8x8_idctrans_iquant_itrans_recon_ft(WORD16 *pi2_src,
146                                                               UWORD8 *pu1_pred,
147                                                               UWORD8 *pu1_out,
148                                                               WORD32 src_strd,
149                                                               WORD32 pred_strd,
150                                                               WORD32 out_strd,
151                                                               const UWORD16 *pu2_iscale_mat,
152                                                               const UWORD16 *pu2_weigh_mat,
153                                                               UWORD32 qp_div,
154                                                               UWORD32 pi4_cntrl,
155                                                               WORD32 *pi4_tmp);
156 
157 typedef void ih264_ihadamard_scaling_ft(WORD16* pi2_src,
158                                         WORD16* pi2_out,
159                                         const UWORD16 *pu2_iscal_mat,
160                                         const UWORD16 *pu2_weigh_mat,
161                                         UWORD32 u4_qp_div_6,
162                                         WORD32* pi4_tmp);
163 
164 typedef void ih264_hadamard_quant_ft(WORD16 *pi2_src, WORD16 *pi2_dst,
165                                     const UWORD16 *pu2_scale_matrix,
166                                     const UWORD16 *pu2_threshold_matrix, UWORD32 u4_qbits,
167                                     UWORD32 u4_round_factor,UWORD8  *pu1_nnz);
168 
169 ih264_resi_trans_quant_ft ih264_resi_trans_quant_4x4;
170 ih264_resi_trans_quant_ft ih264_resi_trans_quant_chroma_4x4;
171 ih264_resi_trans_quant_ft ih264_resi_trans_quant_8x8;
172 ih264_iquant_itrans_recon_ft ih264_iquant_itrans_recon_4x4;
173 ih264_iquant_itrans_recon_ft ih264_iquant_itrans_recon_8x8;
174 ih264_iquant_itrans_recon_ft ih264_iquant_itrans_recon_4x4_dc;
175 ih264_iquant_itrans_recon_ft ih264_iquant_itrans_recon_8x8_dc;
176 ih264_iquant_itrans_recon_chroma_ft ih264_iquant_itrans_recon_chroma_4x4;
177 ih264_iquant_itrans_recon_chroma_ft ih264_iquant_itrans_recon_chroma_4x4_dc;
178 ih264_ihadamard_scaling_ft ih264_ihadamard_scaling_4x4;
179 ih264_ihadamard_scaling_ft ih264_ihadamard_scaling_2x2_uv;
180 ih264_hadamard_quant_ft ih264_hadamard_quant_4x4;
181 ih264_hadamard_quant_ft ih264_hadamard_quant_2x2_uv;
182 
183 /*A9 Declarations*/
184 ih264_resi_trans_quant_ft ih264_resi_trans_quant_4x4_a9;
185 ih264_resi_trans_quant_ft ih264_resi_trans_quant_chroma_4x4_a9;
186 ih264_iquant_itrans_recon_ft ih264_iquant_itrans_recon_4x4_a9;
187 ih264_iquant_itrans_recon_ft ih264_iquant_itrans_recon_8x8_a9;
188 ih264_iquant_itrans_recon_ft ih264_iquant_itrans_recon_4x4_dc_a9;
189 ih264_iquant_itrans_recon_ft ih264_iquant_itrans_recon_8x8_dc_a9;
190 ih264_iquant_itrans_recon_chroma_ft ih264_iquant_itrans_recon_chroma_4x4_a9;
191 ih264_iquant_itrans_recon_chroma_ft ih264_iquant_itrans_recon_chroma_4x4_dc_a9;
192 ih264_luma_16x16_resi_trans_dctrans_quant_ft ih264_luma_16x16_resi_trans_dctrans_quant_a9;
193 ih264_chroma_8x8_resi_trans_dctrans_quant_ft ih264_chroma_8x8_resi_trans_dctrans_quant_a9;
194 ih264_luma_16x16_idctrans_iquant_itrans_recon_ft ih264_luma_16x16_idctrans_iquant_itrans_recon_a9;
195 ih264_chroma_8x8_idctrans_iquant_itrans_recon_ft ih264_chroma_8x8_idctrans_iquant_itrans_recon_a9;
196 ih264_ihadamard_scaling_ft ih264_ihadamard_scaling_4x4_a9;
197 ih264_ihadamard_scaling_ft ih264_ihadamard_scaling_2x2_uv_a9;
198 ih264_hadamard_quant_ft ih264_hadamard_quant_4x4_a9;
199 ih264_hadamard_quant_ft ih264_hadamard_quant_2x2_uv_a9;
200 
201 /*Av8 Declarations*/
202 ih264_resi_trans_quant_ft ih264_resi_trans_quant_4x4_av8;
203 ih264_resi_trans_quant_ft ih264_resi_trans_quant_chroma_4x4_av8;
204 ih264_iquant_itrans_recon_ft ih264_iquant_itrans_recon_4x4_av8;
205 ih264_iquant_itrans_recon_ft ih264_iquant_itrans_recon_8x8_av8;
206 ih264_iquant_itrans_recon_ft ih264_iquant_itrans_recon_4x4_dc_av8;
207 ih264_iquant_itrans_recon_ft ih264_iquant_itrans_recon_8x8_dc_av8;
208 ih264_iquant_itrans_recon_chroma_ft ih264_iquant_itrans_recon_chroma_4x4_av8;
209 ih264_iquant_itrans_recon_chroma_ft ih264_iquant_itrans_recon_chroma_4x4_dc_av8;
210 ih264_ihadamard_scaling_ft ih264_ihadamard_scaling_4x4_av8;
211 ih264_ihadamard_scaling_ft ih264_ihadamard_scaling_2x2_uv_av8;
212 ih264_hadamard_quant_ft ih264_hadamard_quant_4x4_av8;
213 ih264_hadamard_quant_ft ih264_hadamard_quant_2x2_uv_av8;
214 
215 /*SSSE3 Declarations*/
216 ih264_iquant_itrans_recon_ft ih264_iquant_itrans_recon_4x4_ssse3;
217 ih264_iquant_itrans_recon_ft ih264_iquant_itrans_recon_8x8_ssse3;
218 ih264_iquant_itrans_recon_ft ih264_iquant_itrans_recon_4x4_dc_ssse3;
219 ih264_iquant_itrans_recon_ft ih264_iquant_itrans_recon_8x8_dc_ssse3;
220 ih264_iquant_itrans_recon_chroma_ft ih264_iquant_itrans_recon_chroma_4x4_dc_ssse3;
221 ih264_ihadamard_scaling_ft ih264_ihadamard_scaling_4x4_ssse3;
222 ih264_ihadamard_scaling_ft ih264_ihadamard_scaling_2x2_uv_ssse3;
223 /*SSSE42 Declarations*/
224 ih264_resi_trans_quant_ft ih264_resi_trans_quant_4x4_sse42;
225 ih264_resi_trans_quant_ft ih264_resi_trans_quant_chroma_4x4_sse42;
226 ih264_iquant_itrans_recon_ft ih264_iquant_itrans_recon_4x4_sse42;
227 ih264_iquant_itrans_recon_chroma_ft ih264_iquant_itrans_recon_chroma_4x4_sse42;
228 ih264_ihadamard_scaling_ft ih264_ihadamard_scaling_4x4_sse42;
229 ih264_hadamard_quant_ft ih264_hadamard_quant_4x4_sse42;
230 ih264_hadamard_quant_ft ih264_hadamard_quant_2x2_uv_sse42;
231 
232 #endif /* IH264_TRANS_QUANT_H_ */
233