aboutsummaryrefslogtreecommitdiff
path: root/encoder/ihevce_had_satd.h
blob: 88034ae3c313450cd51576c63b0ef12b568df6a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
/******************************************************************************
 *
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *****************************************************************************
 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
/*!
******************************************************************************
* \file ihevce_had_satd.h
*
* \brief
*    This file contains function prototypes of HAD and SATD functions
*
* \date
*    18/09/2012
*
* \author
*    Ittiam
*
******************************************************************************
*/

#ifndef _IHEVCE_HAD_SATD_H_
#define _IHEVCE_HAD_SATD_H_

/*****************************************************************************/
/* Constant Macros                                                           */
/*****************************************************************************/

/*****************************************************************************/
/* Function Macros                                                           */
/*****************************************************************************/

/*****************************************************************************/
/* Typedefs                                                                  */
/*****************************************************************************/

/*****************************************************************************/
/* Enums                                                                     */
/*****************************************************************************/

/* @breif enum for hadamard transform block sizes supported : 4x4 to 32x32 */
typedef enum
{
    HAD_4x4 = 0,
    HAD_8x8 = 1,
    HAD_16x16 = 2,
    HAD_32x32 = 3,
    HAD_INVALID = 4
} HAD_SIZE_T;

/*****************************************************************************/
/* Structure                                                                 */
/*****************************************************************************/

/*****************************************************************************/
/* Extern Function Declarations                                              */
/*****************************************************************************/

UWORD32 ihevce_HAD_4x4_8bit(
    UWORD8 *pu1_origin,
    WORD32 src_strd,
    UWORD8 *pu1_pred_buf,
    WORD32 pred_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd);

UWORD32 ihevce_HAD_8x8_8bit(
    UWORD8 *pu1_origin,
    WORD32 src_strd,
    UWORD8 *pu1_pred_buf,
    WORD32 pred_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd);

UWORD32 ihevce_compute_ac_had_8x8_8bit(
    UWORD8 *pu1_origin,
    WORD32 src_strd,
    UWORD8 *pu1_pred_buf,
    WORD32 pred_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd);

UWORD32 ihevce_HAD_16x16_8bit(
    UWORD8 *pu1_origin,
    WORD32 src_strd,
    UWORD8 *pu1_pred_buf,
    WORD32 pred_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd);

UWORD32 ihevce_HAD_32x32_8bit(
    UWORD8 *pu1_origin,
    WORD32 src_strd,
    UWORD8 *pu1_pred_buf,
    WORD32 pred_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd);

typedef WORD32 FT_HAD_16X16_R(
    UWORD8 *pu1_src,
    WORD32 src_strd,
    UWORD8 *pu1_pred,
    WORD32 pred_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd,
    WORD32 **ppi4_hsad,
    WORD32 **ppi4_tu_split,
    WORD32 **ppi4_tu_early_cbf,
    WORD32 pos_x_y_4x4,
    WORD32 num_4x4_in_row,
    WORD32 lambda,
    WORD32 lambda_q_shift,
    WORD32 i4_frm_qstep,
    WORD32 i4_cur_depth,
    WORD32 i4_max_depth,
    WORD32 i4_max_tr_size,
    WORD32 *pi4_tu_split_cost,
    void *pv_func_sel);

typedef UWORD32 FT_HAD_32X32_USING_16X16(
    WORD16 *pi2_16x16_had,
    WORD32 had16_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd,
    WORD32 i4_frm_qstep,
    WORD32 *pi4_cbf);

typedef UWORD32 ihevce_compute_16x16HAD_using_8x8_ft(
    WORD16 *pi2_8x8_had,
    WORD32 had8_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd,
    WORD32 i4_frm_qstep,
    WORD32 *pi4_cbf);

typedef WORD32 FT_HAD_8X8_USING_4_4X4_R(
    UWORD8 *pu1_src,
    WORD32 src_strd,
    UWORD8 *pu1_pred,
    WORD32 pred_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd,
    WORD32 **ppi4_hsad,
    WORD32 **ppi4_tu_split,
    WORD32 **ppi4_tu_early_cbf,
    WORD32 pos_x_y_4x4,
    WORD32 num_4x4_in_row,
    WORD32 lambda,
    WORD32 lambda_q_shift,
    WORD32 i4_frm_qstep,
    WORD32 i4_cur_depth,
    WORD32 i4_max_depth,
    WORD32 i4_max_tr_size,
    WORD32 *pi4_tu_split_cost,
    void *pv_func_sel);

WORD32 ihevce_had_16x16_r_noise_detect(
    UWORD8 *pu1_src,
    WORD32 src_strd,
    UWORD8 *pu1_pred,
    WORD32 pred_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd,
    WORD32 pos_x_y_4x4,
    WORD32 num_4x4_in_row,
    WORD32 scaling_for_pred);

UWORD32 ihevce_compute_8x8HAD_using_4x4_noise_detect(
    WORD16 *pi2_4x4_had,
    WORD32 had4_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd,
    WORD32 i4_frm_qstep,
    WORD32 *pi4_cbf);
void ihevce_had4_4x4_noise_detect(
    UWORD8 *pu1_src,
    WORD32 src_strd,
    UWORD8 *pu1_pred,
    WORD32 pred_strd,
    WORD16 *pi2_dst4x4,
    WORD16 *pi2_residue,
    WORD32 dst_strd,
    WORD32 scaling_for_pred);

void ihevce_had_8x8_using_4_4x4_noise_detect(
    UWORD8 *pu1_src,
    WORD32 src_strd,
    UWORD8 *pu1_pred,
    WORD32 pred_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd,
    WORD32 pos_x_y_4x4,
    WORD32 num_4x4_in_row,
    WORD32 scaling_for_pred);

void ihevce_had_8x8_using_4_4x4(
    UWORD8 *pu1_src,
    WORD32 src_strd,
    UWORD8 *pu1_pred,
    WORD32 pred_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd,
    WORD32 **ppi4_hsad,
    WORD32 pos_x_y_4x4,
    WORD32 num_4x4_in_row);

typedef void ihevce_had_nxn_r_ft(
    UWORD8 *pu1_src,
    WORD32 src_strd,
    UWORD8 *pu1_pred,
    WORD32 pred_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd,
    WORD32 **ppi4_hsad,
    WORD32 **ppi4_tu_split,
    WORD32 **ppi4_tu_early_cbf,
    WORD32 pos_x_y_4x4,
    WORD32 num_4x4_in_row,
    WORD32 lambda,
    WORD32 lambda_q_shift,
    WORD32 i4_frm_qstep,
    WORD32 i4_cur_depth,
    WORD32 i4_max_depth,
    WORD32 i4_max_tr_size,
    WORD32 *pi4_tu_split_cost,
    void *pv_func_sel);

UWORD32 ihevce_mat_add_shift_satd_16bit(
    WORD16 *pi2_buf1,
    WORD32 buf1_strd,
    WORD16 *pi2_buf2,
    WORD32 buf2_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd,
    WORD32 size,
    WORD32 shift,
    WORD32 threshold,
    WORD32 *pi4_cbf);

UWORD32 ihevce_mat_sub_shift_satd_16bit(
    WORD16 *pi2_buf1,
    WORD32 buf1_strd,
    WORD16 *pi2_buf2,
    WORD32 buf2_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd,
    WORD32 size,
    WORD32 shift,
    WORD32 threshold,
    WORD32 *pi4_cbf);

void ihevce_mat_add_16bit(
    WORD16 *pi2_buf1,
    WORD32 buf1_strd,
    WORD16 *pi2_buf2,
    WORD32 buf2_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd,
    WORD32 size,
    WORD32 threshold);

void ihevce_mat_sub_16bit(
    WORD16 *pi2_buf1,
    WORD32 buf1_strd,
    WORD16 *pi2_buf2,
    WORD32 buf2_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd,
    WORD32 size,
    WORD32 threshold);

UWORD32 ihevce_compute_16x16HAD_using_8x8_noise_detect(
    WORD16 *pi2_8x8_had,
    WORD32 had8_strd,
    WORD16 *pi2_dst,
    WORD32 dst_strd,
    WORD32 i4_frm_qstep,
    WORD32 *pi4_cbf);

/******* C declarations ****************/
FT_HAD_8X8_USING_4_4X4_R ihevce_had_8x8_using_4_4x4_r;
FT_HAD_16X16_R ihevce_had_16x16_r;
FT_HAD_32X32_USING_16X16 ihevce_compute_32x32HAD_using_16x16;

/******** A9Q declarations **********/
FT_HAD_8X8_USING_4_4X4_R ihevce_had_8x8_using_4_4x4_r_neon;
FT_HAD_16X16_R ihevce_had_16x16_r_neon;
FT_HAD_32X32_USING_16X16 ihevce_compute_32x32HAD_using_16x16_neon;

#endif /* _IHEVCE_HAD_SATD_H_ */