/src/libavc/encoder/svc/isvce_deblk.c
Line | Count | Source (jump to first uncovered line) |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Copyright (C) 2022 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 | | ******************************************************************************* |
23 | | * @file |
24 | | * isvce_deblk.c |
25 | | * |
26 | | * @brief |
27 | | * This file contains functions that are associated with deblocking |
28 | | * |
29 | | * @author |
30 | | * ittiam |
31 | | * |
32 | | * @par List of Functions: |
33 | | * - isvce_fill_bs_1mv_1ref_non_mbaff |
34 | | * - isvce_compute_bs |
35 | | * - isvce_filter_top_edge |
36 | | * - isvce_filter_left_edge |
37 | | * - isvce_deblock_mb |
38 | | * |
39 | | * @remarks |
40 | | * None |
41 | | * |
42 | | ******************************************************************************* |
43 | | */ |
44 | | #include <stdio.h> |
45 | | #include <string.h> |
46 | | |
47 | | #include "ih264e_config.h" |
48 | | #include "ih264_typedefs.h" |
49 | | #include "iv2.h" |
50 | | #include "ive2.h" |
51 | | #include "isvc_macros.h" |
52 | | #include "isvc_defs.h" |
53 | | #include "isvc_structs.h" |
54 | | #include "ih264_trans_data.h" |
55 | | #include "isvc_trans_quant_itrans_iquant.h" |
56 | | #include "isvc_inter_pred_filters.h" |
57 | | #include "isvc_mem_fns.h" |
58 | | #include "ih264_padding.h" |
59 | | #include "ih264_intra_pred_filters.h" |
60 | | #include "ih264_deblk_edge_filters.h" |
61 | | #include "isvc_cabac_tables.h" |
62 | | #include "ih264_deblk_tables.h" |
63 | | #include "isvce_defs.h" |
64 | | #include "ih264e_error.h" |
65 | | #include "ih264e_bitstream.h" |
66 | | #include "ime_distortion_metrics.h" |
67 | | #include "ime_defs.h" |
68 | | #include "ime_structs.h" |
69 | | #include "irc_cntrl_param.h" |
70 | | #include "irc_frame_info_collector.h" |
71 | | #include "isvce_rate_control.h" |
72 | | #include "isvce_cabac_structs.h" |
73 | | #include "isvce_structs.h" |
74 | | #include "isvce_deblk.h" |
75 | | #include "isvce_globals.h" |
76 | | |
77 | | static const UWORD32 gau4_isvce_packed_bs2[(1 << MAX_TU_IN_MB_COL) * 2] = { |
78 | | /* BS TABLES FOR NORMAL EDGES */ |
79 | | 0x00000000, 0x02000000, 0x00020000, 0x02020000, 0x00000200, 0x02000200, 0x00020200, 0x02020200, |
80 | | 0x00000002, 0x02000002, 0x00020002, 0x02020002, 0x00000202, 0x02000202, 0x00020202, 0x02020202, |
81 | | |
82 | | /* BS TABLES FOR XTRA LEFT MB EDGES IN MBAFF CASE */ |
83 | | 0x01010101, 0x02010101, 0x01020101, 0x02020101, 0x01010201, 0x02010201, 0x01020201, 0x02020201, |
84 | | 0x01010102, 0x02010102, 0x01020102, 0x02020102, 0x01010202, 0x02010202, 0x01020202, 0x02020202}; |
85 | | |
86 | | static const UWORD16 gau2_isvce_4x4_v2h_reorder[(1 << MAX_TU_IN_MB_COL)] = { |
87 | | 0x0000, 0x0001, 0x0010, 0x0011, 0x0100, 0x0101, 0x0110, 0x0111, |
88 | | 0x1000, 0x1001, 0x1010, 0x1011, 0x1100, 0x1101, 0x1110, 0x1111}; |
89 | | |
90 | | static void isvce_fill_bs1_16x16mb_pslice(isvce_mb_info_t *ps_cur_mb, isvce_mb_info_t *ps_top_mb, |
91 | | isvce_mb_info_t *ps_left_mb, UWORD32 *pu4_bs_table, |
92 | | coordinates_t *ps_mb_pos) |
93 | 178k | { |
94 | 178k | WORD16 i2_q_mv0, i2_q_mv1; |
95 | 178k | WORD16 i2_p_mv0, i2_p_mv1; |
96 | 178k | UWORD32 i; |
97 | 178k | UWORD32 u4_bs_horz = pu4_bs_table[0]; |
98 | 178k | UWORD32 u4_bs_vert = pu4_bs_table[4]; |
99 | | |
100 | 178k | i2_q_mv0 = ps_cur_mb->as_pu->as_me_info[L0].s_mv.i2_mvx; |
101 | 178k | i2_q_mv1 = ps_cur_mb->as_pu->as_me_info[L0].s_mv.i2_mvy; |
102 | | |
103 | 178k | if(ps_mb_pos->i4_ordinate) |
104 | 110k | { |
105 | | /* Computing Bs for the top edge */ |
106 | 552k | for(i = 0; i < 4; i++) |
107 | 441k | { |
108 | 441k | UWORD32 u4_idx = 24 - (i << 3); |
109 | | |
110 | | /* check if Bs is already set */ |
111 | 441k | if(!((u4_bs_horz >> u4_idx) & 0xf)) |
112 | 251k | { |
113 | | /************************************************************/ |
114 | | /* If Bs is not set, use left edge and current edge mvs and */ |
115 | | /* reference pictures addresses to evaluate Bs==1 */ |
116 | | /************************************************************/ |
117 | 251k | UWORD32 u4_bs_temp1; |
118 | 251k | UWORD32 u4_bs; |
119 | | |
120 | | /*********************************************************/ |
121 | | /* If any motion vector component differs by more than 1 */ |
122 | | /* integer pel or if reference pictures are different Bs */ |
123 | | /* is set to 1. Note that this condition shall be met for*/ |
124 | | /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/ |
125 | | /*********************************************************/ |
126 | 251k | i2_p_mv0 = ps_top_mb->as_pu->as_me_info[L0].s_mv.i2_mvx; |
127 | 251k | i2_p_mv1 = ps_top_mb->as_pu->as_me_info[L0].s_mv.i2_mvy; |
128 | | |
129 | 251k | u4_bs_temp1 = |
130 | 251k | ((ABS((i2_p_mv0 - i2_q_mv0)) >= 4) || (ABS((i2_p_mv1 - i2_q_mv1)) >= 4)); |
131 | | |
132 | 251k | u4_bs = ((ps_cur_mb->as_pu->as_me_info[L0].i1_ref_idx != |
133 | 251k | ps_top_mb->as_pu->as_me_info[L0].i1_ref_idx) || |
134 | 251k | u4_bs_temp1); |
135 | | |
136 | 251k | u4_bs_horz |= (u4_bs << u4_idx); |
137 | 251k | } |
138 | 441k | } |
139 | | |
140 | 110k | pu4_bs_table[0] = u4_bs_horz; |
141 | 110k | } |
142 | | |
143 | 178k | if(ps_mb_pos->i4_abscissa) |
144 | 130k | { |
145 | | /* Computing Bs for the left edge */ |
146 | 653k | for(i = 0; i < 4; i++) |
147 | 523k | { |
148 | 523k | UWORD32 u4_idx = 24 - (i << 3); |
149 | | |
150 | | /* check if Bs is already set */ |
151 | 523k | if(!((u4_bs_vert >> u4_idx) & 0xf)) |
152 | 313k | { |
153 | | /* If Bs is not set, evalaute conditions for Bs=1 */ |
154 | 313k | UWORD32 u4_bs_temp1; |
155 | 313k | UWORD32 u4_bs; |
156 | | /*********************************************************/ |
157 | | /* If any motion vector component differs by more than 1 */ |
158 | | /* integer pel or if reference pictures are different Bs */ |
159 | | /* is set to 1. Note that this condition shall be met for*/ |
160 | | /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/ |
161 | | /*********************************************************/ |
162 | | |
163 | 313k | i2_p_mv0 = ps_left_mb->as_pu->as_me_info[L0].s_mv.i2_mvx; |
164 | 313k | i2_p_mv1 = ps_left_mb->as_pu->as_me_info[L0].s_mv.i2_mvy; |
165 | | |
166 | 313k | u4_bs_temp1 = |
167 | 313k | ((ABS((i2_p_mv0 - i2_q_mv0)) >= 4) | (ABS((i2_p_mv1 - i2_q_mv1)) >= 4)); |
168 | | |
169 | 313k | u4_bs = ((ps_cur_mb->as_pu->as_me_info[L0].i1_ref_idx != |
170 | 313k | ps_left_mb->as_pu->as_me_info[L0].i1_ref_idx) || |
171 | 313k | u4_bs_temp1); |
172 | | |
173 | 313k | u4_bs_vert |= (u4_bs << u4_idx); |
174 | 313k | } |
175 | 523k | } |
176 | | |
177 | 130k | pu4_bs_table[4] = u4_bs_vert; |
178 | 130k | } |
179 | 178k | } |
180 | | |
181 | | static void isvce_fill_bs1_16x16mb_bslice(isvce_mb_info_t *ps_cur_mb, isvce_mb_info_t *ps_top_mb, |
182 | | isvce_mb_info_t *ps_left_mb, UWORD32 *pu4_bs_table, |
183 | | coordinates_t *ps_mb_pos) |
184 | 0 | { |
185 | 0 | WORD16 i2_q_mv0, i2_q_mv1, i2_q_mv2, i2_q_mv3; |
186 | 0 | WORD16 i2_p_mv0, i2_p_mv1, i2_p_mv2, i2_p_mv3; |
187 | 0 | UWORD32 i; |
188 | 0 | UWORD32 u4_bs_horz = pu4_bs_table[0]; |
189 | 0 | UWORD32 u4_bs_vert = pu4_bs_table[4]; |
190 | |
|
191 | 0 | i2_q_mv0 = ps_cur_mb->as_pu->as_me_info[L0].s_mv.i2_mvx; |
192 | 0 | i2_q_mv1 = ps_cur_mb->as_pu->as_me_info[L0].s_mv.i2_mvy; |
193 | 0 | i2_q_mv2 = ps_cur_mb->as_pu->as_me_info[L1].s_mv.i2_mvx; |
194 | 0 | i2_q_mv3 = ps_cur_mb->as_pu->as_me_info[L1].s_mv.i2_mvy; |
195 | | |
196 | | /* Computing Bs for the top edge */ |
197 | 0 | if(ps_mb_pos->i4_ordinate) |
198 | 0 | { |
199 | 0 | for(i = 0; i < 4; i++) |
200 | 0 | { |
201 | 0 | UWORD32 u4_idx = 24 - (i << 3); |
202 | | |
203 | | /* check if Bs is already set */ |
204 | 0 | if(!((u4_bs_horz >> u4_idx) & 0xf)) |
205 | 0 | { |
206 | | /************************************************************/ |
207 | | /* If Bs is not set, use left edge and current edge mvs and */ |
208 | | /* reference pictures addresses to evaluate Bs==1 */ |
209 | | /************************************************************/ |
210 | 0 | UWORD32 u4_bs_temp1, u4_bs_temp2; |
211 | 0 | UWORD32 u4_bs; |
212 | | |
213 | | /*********************************************************/ |
214 | | /* If any motion vector component differs by more than 1 */ |
215 | | /* integer pel or if reference pictures are different Bs */ |
216 | | /* is set to 1. Note that this condition shall be met for*/ |
217 | | /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/ |
218 | | /*********************************************************/ |
219 | 0 | i2_p_mv0 = ps_top_mb->as_pu->as_me_info[L0].s_mv.i2_mvx; |
220 | 0 | i2_p_mv1 = ps_top_mb->as_pu->as_me_info[L0].s_mv.i2_mvy; |
221 | 0 | i2_p_mv2 = ps_top_mb->as_pu->as_me_info[L1].s_mv.i2_mvx; |
222 | 0 | i2_p_mv3 = ps_top_mb->as_pu->as_me_info[L1].s_mv.i2_mvy; |
223 | |
|
224 | 0 | u4_bs_temp1 = |
225 | 0 | ((ABS((i2_p_mv0 - i2_q_mv0)) >= 4) | (ABS((i2_p_mv1 - i2_q_mv1)) >= 4) | |
226 | 0 | (ABS((i2_p_mv2 - i2_q_mv2)) >= 4) | (ABS((i2_p_mv3 - i2_q_mv3)) >= 4)); |
227 | |
|
228 | 0 | u4_bs_temp2 = |
229 | 0 | ((ABS((i2_p_mv0 - i2_q_mv2)) >= 4) | (ABS((i2_p_mv1 - i2_q_mv3)) >= 4) | |
230 | 0 | (ABS((i2_p_mv2 - i2_q_mv0)) >= 4) | (ABS((i2_p_mv3 - i2_q_mv1)) >= 4)); |
231 | |
|
232 | 0 | u4_bs = ((ps_cur_mb->as_pu->as_me_info[L0].i1_ref_idx != |
233 | 0 | ps_top_mb->as_pu->as_me_info[L0].i1_ref_idx) || |
234 | 0 | (ps_cur_mb->as_pu->as_me_info[L1].i1_ref_idx != |
235 | 0 | ps_top_mb->as_pu->as_me_info[L1].i1_ref_idx) || |
236 | 0 | u4_bs_temp1) && |
237 | 0 | ((ps_cur_mb->as_pu->as_me_info[L0].i1_ref_idx != |
238 | 0 | ps_top_mb->as_pu->as_me_info[L1].i1_ref_idx) || |
239 | 0 | (ps_cur_mb->as_pu->as_me_info[L1].i1_ref_idx != |
240 | 0 | ps_top_mb->as_pu->as_me_info[L0].i1_ref_idx) || |
241 | 0 | u4_bs_temp2); |
242 | |
|
243 | 0 | u4_bs_horz |= (u4_bs << u4_idx); |
244 | 0 | } |
245 | 0 | } |
246 | |
|
247 | 0 | pu4_bs_table[0] = u4_bs_horz; |
248 | 0 | } |
249 | | |
250 | | /* Computing Bs for the left edge */ |
251 | 0 | if(ps_mb_pos->i4_abscissa) |
252 | 0 | { |
253 | 0 | for(i = 0; i < 4; i++) |
254 | 0 | { |
255 | 0 | UWORD32 u4_idx = 24 - (i << 3); |
256 | | |
257 | | /* check if Bs is already set */ |
258 | 0 | if(!((u4_bs_vert >> u4_idx) & 0xf)) |
259 | 0 | { |
260 | | /* If Bs is not set, evalaute conditions for Bs=1 */ |
261 | 0 | UWORD32 u4_bs_temp1, u4_bs_temp2; |
262 | 0 | UWORD32 u4_bs; |
263 | | /*********************************************************/ |
264 | | /* If any motion vector component differs by more than 1 */ |
265 | | /* integer pel or if reference pictures are different Bs */ |
266 | | /* is set to 1. Note that this condition shall be met for*/ |
267 | | /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/ |
268 | | /*********************************************************/ |
269 | |
|
270 | 0 | i2_p_mv0 = ps_left_mb->as_pu->as_me_info[L0].s_mv.i2_mvx; |
271 | 0 | i2_p_mv1 = ps_left_mb->as_pu->as_me_info[L0].s_mv.i2_mvy; |
272 | 0 | i2_p_mv2 = ps_left_mb->as_pu->as_me_info[L1].s_mv.i2_mvx; |
273 | 0 | i2_p_mv3 = ps_left_mb->as_pu->as_me_info[L1].s_mv.i2_mvy; |
274 | |
|
275 | 0 | u4_bs_temp1 = |
276 | 0 | ((ABS((i2_p_mv0 - i2_q_mv0)) >= 4) | (ABS((i2_p_mv1 - i2_q_mv1)) >= 4) | |
277 | 0 | (ABS((i2_p_mv2 - i2_q_mv2)) >= 4) | (ABS((i2_p_mv3 - i2_q_mv3)) >= 4)); |
278 | |
|
279 | 0 | u4_bs_temp2 = |
280 | 0 | ((ABS((i2_p_mv0 - i2_q_mv2)) >= 4) | (ABS((i2_p_mv1 - i2_q_mv3)) >= 4) | |
281 | 0 | (ABS((i2_p_mv2 - i2_q_mv0)) >= 4) | (ABS((i2_p_mv3 - i2_q_mv1)) >= 4)); |
282 | |
|
283 | 0 | u4_bs = ((ps_cur_mb->as_pu->as_me_info[L0].i1_ref_idx != |
284 | 0 | ps_left_mb->as_pu->as_me_info[L0].i1_ref_idx) || |
285 | 0 | (ps_cur_mb->as_pu->as_me_info[L1].i1_ref_idx != |
286 | 0 | ps_left_mb->as_pu->as_me_info[L1].i1_ref_idx) || |
287 | 0 | u4_bs_temp1) && |
288 | 0 | ((ps_cur_mb->as_pu->as_me_info[L0].i1_ref_idx != |
289 | 0 | ps_left_mb->as_pu->as_me_info[L1].i1_ref_idx) || |
290 | 0 | (ps_cur_mb->as_pu->as_me_info[L1].i1_ref_idx != |
291 | 0 | ps_left_mb->as_pu->as_me_info[L0].i1_ref_idx) || |
292 | 0 | u4_bs_temp2); |
293 | |
|
294 | 0 | u4_bs_vert |= (u4_bs << u4_idx); |
295 | 0 | } |
296 | 0 | } |
297 | |
|
298 | 0 | pu4_bs_table[4] = u4_bs_vert; |
299 | 0 | } |
300 | 0 | } |
301 | | |
302 | | static void isvce_fill_bs2_horz_vert(UWORD32 *pu4_bs, WORD32 u4_left_mb_csbp, WORD32 u4_top_mb_csbp, |
303 | | WORD32 u4_cur_mb_csbp, coordinates_t *ps_mb_pos, |
304 | | const UWORD32 *pu4_packed_bs2, |
305 | | const UWORD16 *pu2_4x4_v2h_reorder) |
306 | 178k | { |
307 | 178k | UWORD32 u4_nbr_horz_csbp, u4_nbr_vert_csbp; |
308 | 178k | UWORD32 u4_horz_bs2_dec, u4_vert_bs2_dec; |
309 | 178k | UWORD32 u4_left_mb_masked_csbp, u4_cur_mb_masked_csbp; |
310 | | |
311 | 178k | UWORD32 u4_reordered_vert_bs2_dec, u4_temp; |
312 | | |
313 | 178k | WORD32 u4_cur_mb_csbp_seq = 0; |
314 | 178k | WORD32 u4_top_mb_csbp_seq = 0; |
315 | 178k | WORD32 u4_left_mb_csbp_seq = 0; |
316 | | |
317 | | /* Convert the csbp packed data in sequential pattern from raster order */ |
318 | 178k | u4_cur_mb_csbp_seq |= u4_cur_mb_csbp & 3; // 0 1 |
319 | 178k | u4_cur_mb_csbp >>= 2; |
320 | 178k | u4_cur_mb_csbp_seq |= (u4_cur_mb_csbp & 3) << 4; // 4 5 |
321 | 178k | u4_cur_mb_csbp >>= 2; |
322 | 178k | u4_cur_mb_csbp_seq |= (u4_cur_mb_csbp & 3) << 2; // 2 3 |
323 | 178k | u4_cur_mb_csbp >>= 2; |
324 | 178k | u4_cur_mb_csbp_seq |= (u4_cur_mb_csbp & 3) << 6; // 6 7 |
325 | 178k | u4_cur_mb_csbp >>= 2; |
326 | 178k | u4_cur_mb_csbp_seq |= (u4_cur_mb_csbp & 3) << 8; // 8 9 |
327 | 178k | u4_cur_mb_csbp >>= 2; |
328 | 178k | u4_cur_mb_csbp_seq |= (u4_cur_mb_csbp & 3) << 12; // 12 13 |
329 | 178k | u4_cur_mb_csbp >>= 2; |
330 | 178k | u4_cur_mb_csbp_seq |= (u4_cur_mb_csbp & 3) << 10; // 10 11 |
331 | 178k | u4_cur_mb_csbp >>= 2; |
332 | 178k | u4_cur_mb_csbp_seq |= (u4_cur_mb_csbp & 3) << 14; // 14 15 |
333 | | |
334 | 178k | u4_left_mb_csbp_seq |= u4_left_mb_csbp & 3; // 0 1 |
335 | 178k | u4_left_mb_csbp >>= 2; |
336 | 178k | u4_left_mb_csbp_seq |= (u4_left_mb_csbp & 3) << 4; // 4 5 |
337 | 178k | u4_left_mb_csbp >>= 2; |
338 | 178k | u4_left_mb_csbp_seq |= (u4_left_mb_csbp & 3) << 2; // 2 3 |
339 | 178k | u4_left_mb_csbp >>= 2; |
340 | 178k | u4_left_mb_csbp_seq |= (u4_left_mb_csbp & 3) << 6; // 6 7 |
341 | 178k | u4_left_mb_csbp >>= 2; |
342 | 178k | u4_left_mb_csbp_seq |= (u4_left_mb_csbp & 3) << 8; // 8 9 |
343 | 178k | u4_left_mb_csbp >>= 2; |
344 | 178k | u4_left_mb_csbp_seq |= (u4_left_mb_csbp & 3) << 12; // 12 13 |
345 | 178k | u4_left_mb_csbp >>= 2; |
346 | 178k | u4_left_mb_csbp_seq |= (u4_left_mb_csbp & 3) << 10; // 10 11 |
347 | 178k | u4_left_mb_csbp >>= 2; |
348 | 178k | u4_left_mb_csbp_seq |= (u4_left_mb_csbp & 3) << 14; // 14 15 |
349 | | |
350 | | /* Required only the last row of top MB */ |
351 | 178k | u4_top_mb_csbp = u4_top_mb_csbp >> 10; // 12 13 |
352 | 178k | u4_top_mb_csbp_seq |= (u4_top_mb_csbp & 3); |
353 | 178k | u4_top_mb_csbp = u4_top_mb_csbp >> 4; // 14 15 |
354 | 178k | u4_top_mb_csbp_seq |= ((u4_top_mb_csbp & 3) << 2); |
355 | | |
356 | | /* u4_nbr_horz_csbp=11C|10C|9C|8C|7C|6C|5C|4C|3C|2C|1C|0C|15T|14T|13T|12T */ |
357 | 178k | u4_nbr_horz_csbp = (u4_cur_mb_csbp_seq << 4) | u4_top_mb_csbp_seq; |
358 | 178k | u4_horz_bs2_dec = u4_cur_mb_csbp_seq | u4_nbr_horz_csbp; |
359 | | |
360 | | /* u4_left_mb_masked_csbp = 15L|0|0|0|11L|0|0|0|7L|0|0|0|3L|0|0|0 */ |
361 | 178k | u4_left_mb_masked_csbp = u4_left_mb_csbp_seq & CSBP_RIGHT_BLOCK_MASK; |
362 | | |
363 | | /* u4_cur_mb_masked_csbp =14C|13C|12C|x|10C|9C|8C|x|6C|5C|4C|x|2C|1C|0C|x */ |
364 | 178k | u4_cur_mb_masked_csbp = (u4_cur_mb_csbp_seq << 1) & (~CSBP_LEFT_BLOCK_MASK); |
365 | | |
366 | | /* u4_nbr_vert_csbp=14C|13C|12C|15L|10C|9C|8C|11L|6C|5C|4C|7L|2C|1C|0C|3L */ |
367 | 178k | u4_nbr_vert_csbp = (u4_cur_mb_masked_csbp) | (u4_left_mb_masked_csbp >> 3); |
368 | | |
369 | 178k | u4_vert_bs2_dec = u4_cur_mb_csbp_seq | u4_nbr_vert_csbp; |
370 | | |
371 | | /* Fill horz edges (0,1,2,3) boundary strengths 2 using look up table */ |
372 | 178k | if(ps_mb_pos->i4_ordinate) |
373 | 110k | { |
374 | 110k | pu4_bs[0] = pu4_packed_bs2[u4_horz_bs2_dec & 0xF]; |
375 | 110k | } |
376 | | |
377 | 178k | pu4_bs[1] = pu4_packed_bs2[(u4_horz_bs2_dec >> 4) & 0xF]; |
378 | 178k | pu4_bs[2] = pu4_packed_bs2[(u4_horz_bs2_dec >> 8) & 0xF]; |
379 | 178k | pu4_bs[3] = pu4_packed_bs2[(u4_horz_bs2_dec >> 12) & 0xF]; |
380 | | |
381 | | /* Do 4x4 tranpose of u4_vert_bs2_dec by using look up table for reorder */ |
382 | 178k | u4_reordered_vert_bs2_dec = pu2_4x4_v2h_reorder[u4_vert_bs2_dec & 0xF]; |
383 | 178k | u4_temp = pu2_4x4_v2h_reorder[(u4_vert_bs2_dec >> 4) & 0xF]; |
384 | 178k | u4_reordered_vert_bs2_dec |= (u4_temp << 1); |
385 | 178k | u4_temp = pu2_4x4_v2h_reorder[(u4_vert_bs2_dec >> 8) & 0xF]; |
386 | 178k | u4_reordered_vert_bs2_dec |= (u4_temp << 2); |
387 | 178k | u4_temp = pu2_4x4_v2h_reorder[(u4_vert_bs2_dec >> 12) & 0xF]; |
388 | 178k | u4_reordered_vert_bs2_dec |= (u4_temp << 3); |
389 | | |
390 | | /* Fill vert edges (4,5,6,7) boundary strengths 2 using look up table */ |
391 | 178k | if(ps_mb_pos->i4_abscissa) |
392 | 130k | { |
393 | 130k | pu4_bs[4] = pu4_packed_bs2[u4_reordered_vert_bs2_dec & 0xF]; |
394 | 130k | } |
395 | | |
396 | 178k | pu4_bs[5] = pu4_packed_bs2[(u4_reordered_vert_bs2_dec >> 4) & 0xF]; |
397 | 178k | pu4_bs[6] = pu4_packed_bs2[(u4_reordered_vert_bs2_dec >> 8) & 0xF]; |
398 | 178k | pu4_bs[7] = pu4_packed_bs2[(u4_reordered_vert_bs2_dec >> 12) & 0xF]; |
399 | 178k | } |
400 | | |
401 | | /* brief Fills the BS for edges falling on a IBL boundary */ |
402 | | static void isvce_fill_bs_ibl(isvce_mb_info_t *ps_cur_mb, isvce_mb_info_t *ps_top_mb, |
403 | | isvce_mb_info_t *ps_left_mb, UWORD32 *pu4_bs_table) |
404 | 2.07M | { |
405 | | /*! Flow of the module is as follows */ |
406 | | /*! 1. checks if MB edge is falling on IBL boundary */ |
407 | | /*! 2. if only Mb edge then it fills the BS based on INTRA or INTER |
408 | | stauts */ |
409 | | /*! 3. if the current MB is IBL and neighbours are also neighbours |
410 | | then it uses the current layer t_coeff flag to decide the |
411 | | BS of a particular edge */ |
412 | | /*! 4. fills the BS for all the edges in curretn MB if IBL */ |
413 | | |
414 | 2.07M | UWORD16 u2_top_horz_nnz; |
415 | 2.07M | UWORD8 u1_top_mb_ibl, u1_left_mb_ibl; |
416 | 2.07M | UWORD32 i4_i, i4_edge; |
417 | 2.07M | UWORD8 u1_bs; |
418 | 2.07M | UWORD8 u1_cnd; |
419 | 2.07M | UWORD8 u1_top_intra; |
420 | 2.07M | UWORD8 u1_left_intra; |
421 | 2.07M | UWORD8 u1_p_nnz, u1_q_nnz; |
422 | 2.07M | UWORD8 u1_curr_mb_ibl; |
423 | 2.07M | UWORD16 u2_curr_nnz; |
424 | 2.07M | UWORD8 u1_left_mb_nnz = 0, u1_left_nnz; |
425 | 2.07M | WORD32 i4_horz_start = 0; |
426 | 2.07M | WORD32 i4_vertical_start = 0; |
427 | | |
428 | 2.07M | u1_top_mb_ibl = ps_top_mb ? (ps_top_mb->u1_base_mode_flag && ps_top_mb->u1_is_intra) : 0; |
429 | 2.07M | u1_left_mb_ibl = ps_left_mb ? (ps_left_mb->u1_base_mode_flag && ps_left_mb->u1_is_intra) : 0; |
430 | | |
431 | 2.07M | u1_curr_mb_ibl = ps_cur_mb ? (ps_cur_mb->u1_base_mode_flag && ps_cur_mb->u1_is_intra) : 0; |
432 | | |
433 | 2.07M | u1_top_intra = ps_top_mb ? ps_top_mb->u1_is_intra : 0; |
434 | 2.07M | u1_left_intra = ps_left_mb ? ps_left_mb->u1_is_intra : 0; |
435 | | |
436 | | /* return if none of the current top and left is IBL */ |
437 | 2.07M | if((0 == u1_curr_mb_ibl) && (0 == u1_top_mb_ibl) && (0 == u1_left_mb_ibl)) |
438 | 178k | { |
439 | 178k | return; |
440 | 178k | } |
441 | | |
442 | | /* set up the vertical and horz MB edge skip flags */ |
443 | 1.89M | if(0 != u1_curr_mb_ibl) |
444 | 1.89M | { |
445 | | /* if top is not IBL */ |
446 | 1.89M | if(0 == u1_top_mb_ibl) |
447 | 136k | { |
448 | 136k | i4_horz_start = 1; |
449 | 136k | } |
450 | | |
451 | | /* if left in not IBL */ |
452 | 1.89M | if(0 == u1_left_mb_ibl) |
453 | 135k | { |
454 | 135k | i4_vertical_start = 1; |
455 | 135k | } |
456 | 1.89M | } |
457 | | |
458 | | /* Fill BS for mb egdex assuming non IBL case */ |
459 | | |
460 | | /* only the MB edges fall across IBL boundary */ |
461 | 1.89M | if((0 != u1_curr_mb_ibl) || (0 != u1_top_mb_ibl) || (0 != u1_left_mb_ibl)) |
462 | 1.89M | { |
463 | 1.89M | UWORD16 u2_temp, u2_i, u1_i; |
464 | 1.89M | u2_temp = ps_left_mb ? ps_left_mb->u4_res_csbp : 0; |
465 | 9.48M | for(u2_i = 0; u2_i < MAX_TU_IN_MB_COL; u2_i++) |
466 | 7.58M | { |
467 | 7.58M | UWORD8 u1_zscan_idx = gau1_raster_to_zscan_map[u2_i * 4 + MAX_TU_IN_MB_ROW - 1]; |
468 | 7.58M | u1_left_mb_nnz |= ((u2_temp & (1 << u1_zscan_idx)) ? 1 << u2_i : 0); |
469 | 7.58M | } |
470 | | |
471 | 1.89M | u2_curr_nnz = ps_cur_mb->u4_res_csbp; |
472 | | |
473 | 1.89M | u2_top_horz_nnz = 0; |
474 | 1.89M | if(ps_top_mb) |
475 | 1.84M | { |
476 | | /* last row of top MB */ |
477 | 9.22M | for(u1_i = 12; u1_i < 16; u1_i++) |
478 | 7.38M | { |
479 | 7.38M | UWORD8 u1_zscan_idx = gau1_raster_to_zscan_map[u1_i]; |
480 | 7.38M | u2_top_horz_nnz |= |
481 | 7.38M | ((ps_top_mb->u4_res_csbp & (1 << u1_zscan_idx)) ? 1 << (u1_i - 12) : 0); |
482 | 7.38M | } |
483 | 1.84M | } |
484 | 52.5k | else |
485 | 52.5k | { |
486 | 52.5k | u2_top_horz_nnz = 0; |
487 | 52.5k | } |
488 | | |
489 | | /* top is intra and not ibl */ |
490 | 1.89M | if(0 != u1_top_intra) |
491 | 1.84M | { |
492 | 1.84M | pu4_bs_table[0] = 0x04040404; |
493 | 1.84M | } |
494 | | /* left is intra and not ibl */ |
495 | 1.89M | if(0 != u1_left_intra) |
496 | 1.85M | { |
497 | 1.85M | pu4_bs_table[4] = 0x04040404; |
498 | 1.85M | } |
499 | | |
500 | | /* assume neighbours are inter and update bs */ |
501 | | /* Edge = 0 means Vert Edges and Edge = 1 means Horz edges */ |
502 | 5.66M | for(i4_edge = 0; i4_edge < 2; i4_edge++) |
503 | 3.76M | { |
504 | 3.76M | UWORD8 u1_p_nnz = 0, u1_q_nnz = 0; |
505 | 3.76M | UWORD32 u4_bs_edge = 0; |
506 | 3.76M | WORD32 i4_bit_mask; |
507 | 3.76M | WORD32 i4_curr_intra_flag; |
508 | 3.76M | WORD32 i4_neibor_intra_flag; |
509 | | |
510 | 3.76M | if(((1 == i4_horz_start) && (i4_edge == 1))) continue; |
511 | 3.63M | if(((1 == i4_vertical_start) && (i4_edge == 0))) continue; |
512 | | |
513 | 3.49M | i4_curr_intra_flag = (0 != u1_curr_mb_ibl); |
514 | | |
515 | 3.49M | if(0 != i4_edge) |
516 | 1.75M | { |
517 | | /* initialize for the TOP edge */ |
518 | 1.75M | u1_p_nnz = (UWORD8) u2_top_horz_nnz; |
519 | 8.77M | for(i4_i = 0; i4_i < MAX_TU_IN_MB_ROW; i4_i++) |
520 | 7.02M | { |
521 | 7.02M | UWORD8 u1_zscan_idx = gau1_raster_to_zscan_map[i4_i]; |
522 | 7.02M | u1_q_nnz |= ((u2_curr_nnz & (1 << u1_zscan_idx)) ? (1 << i4_i) : 0); |
523 | 7.02M | } |
524 | | |
525 | 1.75M | i4_neibor_intra_flag = (u1_top_mb_ibl || u1_top_intra); |
526 | 1.75M | } |
527 | 1.74M | else |
528 | 1.74M | { |
529 | 1.74M | u1_p_nnz = u1_left_mb_nnz; |
530 | 8.77M | for(u2_i = 0; u2_i < MAX_TU_IN_MB_COL; u2_i++) |
531 | 7.03M | { |
532 | 7.03M | UWORD8 u1_zscan_idx = gau1_raster_to_zscan_map[u2_i * 4]; |
533 | 7.03M | u1_q_nnz |= ((u2_curr_nnz & (1 << u1_zscan_idx)) ? 1 << u2_i : 0); |
534 | 7.03M | } |
535 | | |
536 | 1.74M | i4_neibor_intra_flag = (u1_left_mb_ibl || u1_left_intra); |
537 | 1.74M | } |
538 | | |
539 | 3.49M | i4_bit_mask = 1; |
540 | | /* find bs of 4 edges */ |
541 | 17.4M | for(i4_i = 0; i4_i < 4; i4_i++) |
542 | 13.9M | { |
543 | 13.9M | UWORD8 u1_p_nnz_temp, u1_q_nnz_temp; |
544 | | |
545 | 13.9M | u1_p_nnz_temp = (u1_p_nnz & i4_bit_mask); |
546 | 13.9M | u1_q_nnz_temp = (u1_q_nnz & i4_bit_mask); |
547 | | |
548 | 13.9M | u1_cnd = ((u1_p_nnz_temp && (!i4_neibor_intra_flag)) || |
549 | 13.9M | (u1_q_nnz_temp && (!i4_curr_intra_flag))); |
550 | | |
551 | 13.9M | u1_bs = u1_cnd ? 2 : 1; |
552 | | |
553 | | /* update the bs of the edge */ |
554 | 13.9M | u4_bs_edge = (u4_bs_edge << 8) + u1_bs; |
555 | 13.9M | i4_bit_mask <<= 1; |
556 | | |
557 | 13.9M | } /* end of loop over blk edges */ |
558 | | |
559 | | /* update the bs of edges */ |
560 | 3.49M | if(i4_edge && !u1_top_intra) |
561 | 0 | { |
562 | 0 | pu4_bs_table[0] = u4_bs_edge; |
563 | 0 | } |
564 | 3.49M | else if(!i4_edge && !u1_left_intra) |
565 | 0 | { |
566 | 0 | pu4_bs_table[4] = u4_bs_edge; |
567 | 0 | } |
568 | 3.49M | } /* end of loop over v1 vetical and horizontal edge */ |
569 | 1.89M | } |
570 | | |
571 | | /* current MB is IBL */ |
572 | 1.89M | if(0 != u1_curr_mb_ibl) |
573 | 1.89M | { |
574 | 1.89M | WORD32 i4_bit_mask_edge = 1; |
575 | 1.89M | UWORD16 u2_temp, u2_i, u1_i; |
576 | | |
577 | 1.89M | u1_left_mb_nnz = 0; |
578 | 1.89M | u2_temp = ps_left_mb ? ps_left_mb->u4_csbp : 0; |
579 | 9.45M | for(u2_i = 0; u2_i < MAX_TU_IN_MB_COL; u2_i++) |
580 | 7.56M | { |
581 | 7.56M | UWORD8 u1_zscan_idx = gau1_raster_to_zscan_map[u2_i * 4 + MAX_TU_IN_MB_ROW - 1]; |
582 | 7.56M | u1_left_mb_nnz |= ((u2_temp & (1 << u1_zscan_idx)) ? 1 << u2_i : 0); |
583 | 7.56M | } |
584 | | |
585 | 1.89M | u2_curr_nnz = ps_cur_mb->u4_csbp; |
586 | | |
587 | 1.89M | u2_top_horz_nnz = 0; |
588 | 1.89M | if(ps_top_mb) |
589 | 1.84M | { |
590 | 9.20M | for(u1_i = 12; u1_i < 16; u1_i++) |
591 | 7.36M | { |
592 | 7.36M | UWORD8 u1_zscan_idx = gau1_raster_to_zscan_map[u1_i]; |
593 | 7.36M | u2_top_horz_nnz |= |
594 | 7.36M | ((ps_top_mb->u4_csbp & (1 << u1_zscan_idx)) ? 1 << (u1_i - 12) : 0); |
595 | 7.36M | } |
596 | 1.84M | } |
597 | 51.0k | else |
598 | 51.0k | { |
599 | 51.0k | u2_top_horz_nnz = 0; |
600 | 51.0k | } |
601 | | |
602 | | /* all are IBL edges then use only t_coeff of current layer */ |
603 | | /* loop over all edges */ |
604 | 9.43M | for(i4_edge = 0; i4_edge < 4; i4_edge++) |
605 | 7.54M | { |
606 | 7.54M | UWORD16 u2_curr_horz_nnz = 0; |
607 | 7.54M | WORD32 i4_bit_mask = 1; |
608 | | |
609 | 7.54M | u1_left_nnz = (u1_left_mb_nnz & i4_bit_mask_edge); |
610 | | |
611 | 37.5M | for(i4_i = 0; i4_i < 4; i4_i++) |
612 | 30.0M | { |
613 | 30.0M | UWORD8 u1_curr_nnz, u1_top_nnz; |
614 | 30.0M | UWORD8 u1_zscan_idx = gau1_raster_to_zscan_map[(4 * i4_edge) + i4_i]; |
615 | | |
616 | 30.0M | u2_curr_horz_nnz |= ((ps_cur_mb->u4_csbp & (1 << u1_zscan_idx)) ? (1 << i4_i) : 0); |
617 | 30.0M | u1_curr_nnz = (u2_curr_horz_nnz & i4_bit_mask); |
618 | 30.0M | u1_top_nnz = (u2_top_horz_nnz & i4_bit_mask); |
619 | | |
620 | | /* update bs horizontal */ |
621 | 30.0M | if(!((1 == i4_horz_start) && (0 == i4_edge))) |
622 | 29.5M | { |
623 | 29.5M | u1_p_nnz = u1_top_nnz; |
624 | 29.5M | u1_q_nnz = u1_curr_nnz; |
625 | 29.5M | u1_cnd = !(u1_p_nnz || u1_q_nnz); |
626 | 29.5M | u1_bs = u1_cnd ? 0 : 1; |
627 | 29.5M | pu4_bs_table[i4_edge] = (pu4_bs_table[i4_edge] << 8) + u1_bs; |
628 | 29.5M | } |
629 | | |
630 | | /* update bs vertical */ |
631 | 30.0M | if(!((1 == i4_vertical_start) && (0 == i4_i))) |
632 | 29.5M | { |
633 | 29.5M | u1_p_nnz = u1_left_nnz; |
634 | 29.5M | u1_q_nnz = u1_curr_nnz; |
635 | 29.5M | u1_cnd = !(u1_p_nnz || u1_q_nnz); |
636 | 29.5M | u1_bs = u1_cnd ? 0 : 1; |
637 | 29.5M | pu4_bs_table[i4_i + 4] = (pu4_bs_table[i4_i + 4] << 8) + u1_bs; |
638 | 29.5M | } |
639 | | /* store the current nnz to left nnz */ |
640 | 30.0M | u1_left_nnz = u1_curr_nnz; |
641 | 30.0M | i4_bit_mask <<= 1; |
642 | 30.0M | } |
643 | | /* store the current row nnz to top row nnz */ |
644 | 7.54M | u2_top_horz_nnz = u2_curr_horz_nnz; |
645 | 7.54M | i4_bit_mask_edge <<= 1; |
646 | 7.54M | } |
647 | 1.89M | } |
648 | 1.89M | } |
649 | | |
650 | | void isvce_compute_bs(isvce_process_ctxt_t *ps_proc, UWORD8 u1_inter_layer_deblk_flag) |
651 | 6.14M | { |
652 | 6.14M | coordinates_t s_mb_pos; |
653 | | |
654 | 6.14M | UWORD32 *pu4_pic_vert_bs; |
655 | 6.14M | UWORD32 *pu4_pic_horz_bs; |
656 | | |
657 | 6.14M | isvce_bs_ctxt_t *ps_bs = &(ps_proc->s_deblk_ctxt.s_bs_ctxt); |
658 | 6.14M | block_neighbors_t *ps_ngbr_avbl = ps_proc->ps_ngbr_avbl; |
659 | 6.14M | nbr_info_t *ps_nbr_info = &ps_proc->s_nbr_info; |
660 | 6.14M | isvce_mb_info_t *ps_left_mb = ps_ngbr_avbl->u1_mb_a ? ps_nbr_info->ps_left_mb_info : NULL; |
661 | 6.14M | isvce_mb_info_t *ps_top_mb = |
662 | 6.14M | ps_ngbr_avbl->u1_mb_b ? &ps_nbr_info->ps_top_row_mb_info[ps_bs->i4_mb_x] : NULL; |
663 | 6.14M | isvce_mb_info_t *ps_cur_mb = ps_proc->ps_mb_info; |
664 | | |
665 | 6.14M | UWORD32 u1_left_mb_intra, u1_left_mb_ibl; |
666 | | |
667 | 6.14M | UWORD16 u2_left_csbp, u2_top_csbp, u2_cur_csbp; |
668 | | |
669 | 6.14M | UWORD32 u4_cur_mb_intra, u1_top_mb_intra, u4_cur_mb_fld; |
670 | 6.14M | UWORD32 u4_cur_mb_ibl, u1_top_mb_ibl; |
671 | 6.14M | UWORD32 au4_bs_table[8]; |
672 | 6.14M | UWORD32 *pu4_bs_table; |
673 | | |
674 | 6.14M | u4_cur_mb_intra = ps_cur_mb->u1_is_intra; |
675 | 6.14M | u4_cur_mb_ibl = ps_cur_mb->u1_base_mode_flag && ps_cur_mb->u1_is_intra; |
676 | 6.14M | u4_cur_mb_fld = 0; |
677 | | |
678 | 6.14M | u1_top_mb_intra = ps_top_mb ? ps_top_mb->u1_is_intra : 0; |
679 | 6.14M | u1_top_mb_ibl = ps_top_mb ? (ps_top_mb->u1_base_mode_flag && ps_top_mb->u1_is_intra) : 0; |
680 | | |
681 | 6.14M | u1_left_mb_intra = ps_left_mb ? ps_left_mb->u1_is_intra : 0; |
682 | 6.14M | u1_left_mb_ibl = ps_left_mb ? (ps_left_mb->u1_base_mode_flag && ps_left_mb->u1_is_intra) : 0; |
683 | | |
684 | 6.14M | pu4_bs_table = au4_bs_table; |
685 | 6.14M | memset(pu4_bs_table, 0, sizeof(pu4_bs_table[0]) * NUM_EDGES_IN_MB * 2); |
686 | | |
687 | 6.14M | s_mb_pos.i4_abscissa = ps_bs->i4_mb_x; |
688 | 6.14M | s_mb_pos.i4_ordinate = ps_bs->i4_mb_y; |
689 | | |
690 | 6.14M | if(!u1_inter_layer_deblk_flag) |
691 | 6.14M | { |
692 | 6.14M | pu4_pic_vert_bs = |
693 | 6.14M | ps_bs->pu4_pic_vert_bs + |
694 | 6.14M | ((s_mb_pos.i4_ordinate * ps_proc->i4_wd_mbs) + s_mb_pos.i4_abscissa) * NUM_EDGES_IN_MB; |
695 | 6.14M | pu4_pic_horz_bs = |
696 | 6.14M | ps_bs->pu4_pic_horz_bs + |
697 | 6.14M | ((s_mb_pos.i4_ordinate * ps_proc->i4_wd_mbs) + s_mb_pos.i4_abscissa) * NUM_EDGES_IN_MB; |
698 | 6.14M | } |
699 | 18.4E | else |
700 | 18.4E | { |
701 | 18.4E | pu4_pic_vert_bs = |
702 | 18.4E | ps_bs->pu4_intra_base_vert_bs + |
703 | 18.4E | ((s_mb_pos.i4_ordinate * ps_proc->i4_wd_mbs) + s_mb_pos.i4_abscissa) * NUM_EDGES_IN_MB; |
704 | 18.4E | pu4_pic_horz_bs = |
705 | 18.4E | ps_bs->pu4_intra_base_horz_bs + |
706 | 18.4E | ((s_mb_pos.i4_ordinate * ps_proc->i4_wd_mbs) + s_mb_pos.i4_abscissa) * NUM_EDGES_IN_MB; |
707 | 18.4E | } |
708 | | |
709 | 6.14M | if(u4_cur_mb_intra && !(u4_cur_mb_ibl)) |
710 | 4.06M | { |
711 | 4.06M | pu4_bs_table[4] = ps_bs->i4_mb_x ? 0x04040404 : 0; |
712 | 4.06M | pu4_bs_table[0] = ps_bs->i4_mb_y ? 0x04040404 : 0; |
713 | 4.06M | pu4_bs_table[1] = 0x03030303; |
714 | 4.06M | pu4_bs_table[2] = 0x03030303; |
715 | 4.06M | pu4_bs_table[3] = 0x03030303; |
716 | 4.06M | pu4_bs_table[5] = 0x03030303; |
717 | 4.06M | pu4_bs_table[6] = 0x03030303; |
718 | 4.06M | pu4_bs_table[7] = 0x03030303; |
719 | 4.06M | } |
720 | 2.07M | else |
721 | 2.07M | { |
722 | 2.07M | isvce_fill_bs_ibl(ps_cur_mb, ps_top_mb, ps_left_mb, pu4_bs_table); |
723 | | |
724 | 2.07M | if(!u4_cur_mb_ibl) |
725 | 178k | { |
726 | 178k | UWORD32 u4_bs_0, u4_bs_4; |
727 | | |
728 | 178k | UWORD32 u4_is_b = (ps_proc->i4_slice_type == BSLICE); |
729 | | |
730 | 178k | u2_cur_csbp = ps_cur_mb->u4_csbp; |
731 | 178k | u2_left_csbp = ps_left_mb ? ps_left_mb->u4_csbp : 0; |
732 | 178k | u2_top_csbp = ps_top_mb ? ps_top_mb->u4_csbp : 0; |
733 | | |
734 | 178k | u2_cur_csbp |= (ps_cur_mb->u4_res_csbp); |
735 | 178k | u2_left_csbp |= ps_left_mb ? ps_left_mb->u4_res_csbp : 0; |
736 | 178k | u2_top_csbp |= ps_top_mb ? ps_top_mb->u4_res_csbp : 0; |
737 | | |
738 | 178k | u4_bs_0 = pu4_bs_table[0]; |
739 | 178k | u4_bs_4 = pu4_bs_table[4]; |
740 | | |
741 | 178k | isvce_fill_bs2_horz_vert(pu4_bs_table, u2_left_csbp, u2_top_csbp, u2_cur_csbp, |
742 | 178k | &s_mb_pos, (gau4_isvce_packed_bs2), |
743 | 178k | (gau2_isvce_4x4_v2h_reorder)); |
744 | | |
745 | 178k | if(u1_left_mb_intra) |
746 | 19.7k | { |
747 | 19.7k | pu4_bs_table[4] = 0x04040404; |
748 | 19.7k | } |
749 | 158k | else if(u1_left_mb_ibl) |
750 | 0 | { |
751 | 0 | pu4_bs_table[4] = u4_bs_4; |
752 | 0 | } |
753 | | |
754 | 178k | if(u1_top_mb_intra) |
755 | 15.8k | { |
756 | 15.8k | pu4_bs_table[0] = u4_cur_mb_fld ? 0x03030303 : 0x04040404; |
757 | 15.8k | } |
758 | 162k | else if(u1_top_mb_ibl) |
759 | 0 | { |
760 | 0 | pu4_bs_table[0] = u4_bs_0; |
761 | 0 | } |
762 | | |
763 | 178k | if(!u4_is_b) |
764 | 178k | { |
765 | 178k | isvce_fill_bs1_16x16mb_pslice(ps_cur_mb, ps_top_mb, ps_left_mb, pu4_bs_table, |
766 | 178k | &s_mb_pos); |
767 | 178k | } |
768 | 9 | else |
769 | 9 | { |
770 | 9 | isvce_fill_bs1_16x16mb_bslice(ps_cur_mb, ps_top_mb, ps_left_mb, pu4_bs_table, |
771 | 9 | &s_mb_pos); |
772 | 9 | } |
773 | 178k | } |
774 | 2.07M | } |
775 | | |
776 | 6.14M | pu4_pic_horz_bs[0] = pu4_bs_table[0]; |
777 | 6.14M | pu4_pic_horz_bs[1] = pu4_bs_table[1]; |
778 | 6.14M | pu4_pic_horz_bs[2] = pu4_bs_table[2]; |
779 | 6.14M | pu4_pic_horz_bs[3] = pu4_bs_table[3]; |
780 | | |
781 | 6.14M | pu4_pic_vert_bs[0] = pu4_bs_table[4]; |
782 | 6.14M | pu4_pic_vert_bs[1] = pu4_bs_table[5]; |
783 | 6.14M | pu4_pic_vert_bs[2] = pu4_bs_table[6]; |
784 | 6.14M | pu4_pic_vert_bs[3] = pu4_bs_table[7]; |
785 | 6.14M | } |
786 | | |
787 | | /** |
788 | | ******************************************************************************* |
789 | | * |
790 | | * @brief This function performs deblocking of top horizontal edge |
791 | | * |
792 | | * @par Description: |
793 | | * This function performs deblocking of top horizontal edge |
794 | | * |
795 | | * @param[in] ps_codec |
796 | | * pointer to codec context |
797 | | * |
798 | | * @param[in] ps_proc |
799 | | * pointer to proc context |
800 | | * |
801 | | * @param[in] pu1_mb_qp |
802 | | * pointer to mb quantization param |
803 | | * |
804 | | * @param[in] pu1_cur_pic_luma |
805 | | * pointer to recon buffer luma |
806 | | * |
807 | | * @param[in] pu1_cur_pic_chroma |
808 | | * pointer to recon buffer chroma |
809 | | * |
810 | | * @param[in] pu4_pic_horz_bs |
811 | | * pointer to horizontal blocking strength |
812 | | * |
813 | | * @returns none |
814 | | * |
815 | | * @remarks none |
816 | | * |
817 | | ******************************************************************************* |
818 | | */ |
819 | | static void isvce_filter_top_edge(isvce_codec_t *ps_codec, UWORD8 u1_qp_p, UWORD8 u1_qp_q, |
820 | | UWORD8 *pu1_cur_pic_luma, WORD32 i4_luma_stride, |
821 | | UWORD8 *pu1_cur_pic_chroma, WORD32 i4_chroma_stride, |
822 | | UWORD32 *pu4_pic_horz_bs) |
823 | 5.87M | { |
824 | 5.87M | UWORD32 u4_alpha_luma, u4_beta_luma, u4_qp_luma, u4_idx_A_luma, u4_idx_B_luma; |
825 | 5.87M | UWORD32 u4_alpha_chroma, u4_beta_chroma, u4_qp_chroma, u4_idx_A_chroma, u4_idx_B_chroma; |
826 | | |
827 | | /********/ |
828 | | /* luma */ |
829 | | /********/ |
830 | 5.87M | u4_qp_luma = (u1_qp_p + u1_qp_q + 1) >> 1; |
831 | | |
832 | | /* filter offset A and filter offset B have to be received from slice header |
833 | | */ |
834 | | /* TODO : for now lets set these offsets as zero */ |
835 | | |
836 | 5.87M | u4_idx_A_luma = MIN(51, u4_qp_luma + 0); |
837 | 5.87M | u4_idx_B_luma = MIN(51, u4_qp_luma + 0); |
838 | | |
839 | | /* alpha, beta computation */ |
840 | 5.87M | u4_alpha_luma = gu1_ih264_alpha_table[u4_idx_A_luma]; |
841 | 5.87M | u4_beta_luma = gu1_ih264_beta_table[u4_idx_B_luma]; |
842 | | |
843 | | /**********/ |
844 | | /* chroma */ |
845 | | /**********/ |
846 | 5.87M | u4_qp_chroma = (gu1_qpc_fqpi[u1_qp_p] + gu1_qpc_fqpi[u1_qp_q] + 1) >> 1; |
847 | | |
848 | | /* filter offset A and filter offset B have to be received from slice header |
849 | | */ |
850 | | /* TODO : for now lets set these offsets as zero */ |
851 | | |
852 | 5.87M | u4_idx_A_chroma = MIN(51, u4_qp_chroma + 0); |
853 | 5.87M | u4_idx_B_chroma = MIN(51, u4_qp_chroma + 0); |
854 | | |
855 | | /* alpha, beta computation */ |
856 | 5.87M | u4_alpha_chroma = gu1_ih264_alpha_table[u4_idx_A_chroma]; |
857 | 5.87M | u4_beta_chroma = gu1_ih264_beta_table[u4_idx_B_chroma]; |
858 | | |
859 | | /* deblk edge */ |
860 | | /* top Horizontal edge - allowed to be deblocked ? */ |
861 | 5.87M | if(pu4_pic_horz_bs[0] == 0x04040404) |
862 | 4.01M | { |
863 | | /* strong filter */ |
864 | 4.01M | ps_codec->pf_deblk_luma_horz_bs4(pu1_cur_pic_luma, i4_luma_stride, u4_alpha_luma, |
865 | 4.01M | u4_beta_luma); |
866 | 4.01M | ps_codec->pf_deblk_chroma_horz_bs4(pu1_cur_pic_chroma, i4_chroma_stride, u4_alpha_chroma, |
867 | 4.01M | u4_beta_chroma, u4_alpha_chroma, u4_beta_chroma); |
868 | 4.01M | } |
869 | 1.86M | else |
870 | 1.86M | { |
871 | | /* normal filter */ |
872 | 1.86M | ps_codec->pf_deblk_luma_horz_bslt4(pu1_cur_pic_luma, i4_luma_stride, u4_alpha_luma, |
873 | 1.86M | u4_beta_luma, pu4_pic_horz_bs[0], |
874 | 1.86M | gu1_ih264_clip_table[u4_idx_A_luma]); |
875 | | |
876 | 1.86M | ps_codec->pf_deblk_chroma_horz_bslt4( |
877 | 1.86M | pu1_cur_pic_chroma, i4_chroma_stride, u4_alpha_chroma, u4_beta_chroma, u4_alpha_chroma, |
878 | 1.86M | u4_beta_chroma, pu4_pic_horz_bs[0], gu1_ih264_clip_table[u4_idx_A_chroma], |
879 | 1.86M | gu1_ih264_clip_table[u4_idx_A_chroma]); |
880 | 1.86M | } |
881 | 5.87M | } |
882 | | |
883 | | /** |
884 | | ******************************************************************************* |
885 | | * |
886 | | * @brief This function performs deblocking of left vertical edge |
887 | | * |
888 | | * @par Description: |
889 | | * This function performs deblocking of top horizontal edge |
890 | | * |
891 | | * @param[in] ps_codec |
892 | | * pointer to codec context |
893 | | * |
894 | | * @param[in] ps_proc |
895 | | * pointer to proc context |
896 | | * |
897 | | * @param[in] pu1_mb_qp |
898 | | * pointer to mb quantization param |
899 | | * |
900 | | * @param[in] pu1_cur_pic_luma |
901 | | * pointer to recon buffer luma |
902 | | * |
903 | | * @param[in] pu1_cur_pic_chroma |
904 | | * pointer to recon buffer chroma |
905 | | * |
906 | | * @param[in] pu4_pic_vert_bs |
907 | | * pointer to vertical blocking strength |
908 | | * |
909 | | * @returns none |
910 | | * |
911 | | * @remarks none |
912 | | * |
913 | | ******************************************************************************* |
914 | | */ |
915 | | static void isvce_filter_left_edge(isvce_codec_t *ps_codec, UWORD8 u1_qp_p, UWORD8 u1_qp_q, |
916 | | UWORD8 *pu1_cur_pic_luma, WORD32 i4_luma_stride, |
917 | | UWORD8 *pu1_cur_pic_chroma, WORD32 i4_chroma_stride, |
918 | | UWORD32 *pu4_pic_vert_bs) |
919 | 5.93M | { |
920 | 5.93M | UWORD32 u4_alpha_luma, u4_beta_luma, u4_qp_luma, u4_idx_A_luma, u4_idx_B_luma; |
921 | 5.93M | UWORD32 u4_alpha_chroma, u4_beta_chroma, u4_qp_chroma, u4_idx_A_chroma, u4_idx_B_chroma; |
922 | | |
923 | | /********/ |
924 | | /* luma */ |
925 | | /********/ |
926 | 5.93M | u4_qp_luma = (u1_qp_p + u1_qp_q + 1) >> 1; |
927 | | |
928 | | /* filter offset A and filter offset B have to be received from slice header |
929 | | */ |
930 | | /* TODO : for now lets set these offsets as zero */ |
931 | | |
932 | 5.93M | u4_idx_A_luma = MIN(51, u4_qp_luma + 0); |
933 | 5.93M | u4_idx_B_luma = MIN(51, u4_qp_luma + 0); |
934 | | |
935 | | /* alpha, beta computation */ |
936 | 5.93M | u4_alpha_luma = gu1_ih264_alpha_table[u4_idx_A_luma]; |
937 | 5.93M | u4_beta_luma = gu1_ih264_beta_table[u4_idx_B_luma]; |
938 | | |
939 | | /**********/ |
940 | | /* chroma */ |
941 | | /**********/ |
942 | 5.93M | u4_qp_chroma = (gu1_qpc_fqpi[u1_qp_p] + gu1_qpc_fqpi[u1_qp_q] + 1) >> 1; |
943 | | |
944 | | /* filter offset A and filter offset B have to be received from slice header |
945 | | */ |
946 | | /* TODO : for now lets set these offsets as zero */ |
947 | | |
948 | 5.93M | u4_idx_A_chroma = MIN(51, u4_qp_chroma + 0); |
949 | 5.93M | u4_idx_B_chroma = MIN(51, u4_qp_chroma + 0); |
950 | | |
951 | | /* alpha, beta computation */ |
952 | 5.93M | u4_alpha_chroma = gu1_ih264_alpha_table[u4_idx_A_chroma]; |
953 | 5.93M | u4_beta_chroma = gu1_ih264_beta_table[u4_idx_B_chroma]; |
954 | | |
955 | | /* deblk edge */ |
956 | 5.93M | if(pu4_pic_vert_bs[0] == 0x04040404) |
957 | 4.05M | { |
958 | | /* strong filter */ |
959 | 4.05M | ps_codec->pf_deblk_luma_vert_bs4(pu1_cur_pic_luma, i4_luma_stride, u4_alpha_luma, |
960 | 4.05M | u4_beta_luma); |
961 | 4.05M | ps_codec->pf_deblk_chroma_vert_bs4(pu1_cur_pic_chroma, i4_chroma_stride, u4_alpha_chroma, |
962 | 4.05M | u4_beta_chroma, u4_alpha_chroma, u4_beta_chroma); |
963 | 4.05M | } |
964 | 1.87M | else |
965 | 1.87M | { |
966 | | /* normal filter */ |
967 | 1.87M | ps_codec->pf_deblk_luma_vert_bslt4(pu1_cur_pic_luma, i4_luma_stride, u4_alpha_luma, |
968 | 1.87M | u4_beta_luma, pu4_pic_vert_bs[0], |
969 | 1.87M | gu1_ih264_clip_table[u4_idx_A_luma]); |
970 | | |
971 | 1.87M | ps_codec->pf_deblk_chroma_vert_bslt4( |
972 | 1.87M | pu1_cur_pic_chroma, i4_chroma_stride, u4_alpha_chroma, u4_beta_chroma, u4_alpha_chroma, |
973 | 1.87M | u4_beta_chroma, pu4_pic_vert_bs[0], gu1_ih264_clip_table[u4_idx_A_chroma], |
974 | 1.87M | gu1_ih264_clip_table[u4_idx_A_chroma]); |
975 | 1.87M | } |
976 | 5.93M | } |
977 | | |
978 | | static UWORD8 isvce_get_deblk_mb_qp(isvce_process_ctxt_t *ps_proc, coordinates_t *ps_mb_pos) |
979 | 17.9M | { |
980 | 17.9M | UWORD8 u1_mb_qp; |
981 | | |
982 | 17.9M | isvce_deblk_ctxt_t *ps_deblk = &ps_proc->s_deblk_ctxt; |
983 | 17.9M | isvce_bs_ctxt_t *ps_bs_ctxt = &ps_deblk->s_bs_ctxt; |
984 | 17.9M | coordinates_t s_cur_mb_pos = {ps_deblk->i4_mb_x, ps_deblk->i4_mb_y}; |
985 | | |
986 | 17.9M | UWORD32 u4_mb_idx = ps_mb_pos->i4_abscissa + ps_mb_pos->i4_ordinate * ps_proc->i4_wd_mbs; |
987 | | |
988 | 17.9M | if((s_cur_mb_pos.i4_abscissa != ps_mb_pos->i4_abscissa) || |
989 | 17.9M | (s_cur_mb_pos.i4_ordinate != ps_mb_pos->i4_ordinate)) |
990 | 11.8M | { |
991 | 11.8M | u1_mb_qp = ps_bs_ctxt->pu1_pic_qp[u4_mb_idx]; |
992 | 11.8M | } |
993 | 6.15M | else |
994 | 6.15M | { |
995 | 6.15M | isvce_mb_info_t *ps_mb_info = |
996 | 6.15M | ps_proc->ps_cur_mv_buf->ps_svc_layer_data[ps_proc->u1_spatial_layer_id].ps_mb_info + |
997 | 6.15M | u4_mb_idx; |
998 | | |
999 | 6.15M | if((0 == ps_mb_pos->i4_abscissa) && (0 == ps_mb_pos->i4_ordinate)) |
1000 | 41.9k | { |
1001 | 41.9k | u1_mb_qp = ps_mb_info->u1_mb_qp; |
1002 | 41.9k | } |
1003 | 6.10M | else |
1004 | 6.10M | { |
1005 | 6.10M | if((ps_mb_info->u4_cbp > 0) || (I16x16 == ps_mb_info->u2_mb_type)) |
1006 | 4.15M | { |
1007 | 4.15M | u1_mb_qp = ps_mb_info->u1_mb_qp; |
1008 | 4.15M | } |
1009 | 1.95M | else |
1010 | 1.95M | { |
1011 | 1.95M | u1_mb_qp = ps_bs_ctxt->pu1_pic_qp[u4_mb_idx - 1]; |
1012 | 1.95M | } |
1013 | 6.10M | } |
1014 | 6.15M | } |
1015 | | |
1016 | 17.9M | return u1_mb_qp; |
1017 | 17.9M | } |
1018 | | |
1019 | | /** |
1020 | | ******************************************************************************* |
1021 | | * |
1022 | | * @brief This function performs deblocking on an mb |
1023 | | * |
1024 | | * @par Description: |
1025 | | * This function performs deblocking on an mb |
1026 | | * |
1027 | | * @param[in] ps_proc |
1028 | | * process context corresponding to the job |
1029 | | * |
1030 | | * @param[in] ps_deblk |
1031 | | * pointer to deblock context |
1032 | | * |
1033 | | * @returns none |
1034 | | * |
1035 | | * @remarks none |
1036 | | * |
1037 | | ******************************************************************************* |
1038 | | */ |
1039 | | void isvce_deblock_mb(isvce_process_ctxt_t *ps_proc, isvce_deblk_ctxt_t *ps_deblk, |
1040 | | UWORD8 u1_inter_layer_deblk_flag) |
1041 | 6.15M | { |
1042 | 6.15M | UWORD8 u1_mb_a, u1_mb_b; |
1043 | 6.15M | UWORD32 *pu4_pic_vert_bs; |
1044 | 6.15M | UWORD32 *pu4_pic_horz_bs; |
1045 | 6.15M | UWORD8 u1_cur_mb_qp; |
1046 | 6.15M | UWORD8 u1_left_mb_qp; |
1047 | 6.15M | UWORD8 u1_top_mb_qp; |
1048 | 6.15M | UWORD32 u4_alpha_luma, u4_beta_luma, u4_idx_A_luma, u4_idx_B_luma; |
1049 | 6.15M | UWORD32 u4_alpha_chroma, u4_beta_chroma, u4_qp_chroma, u4_idx_A_chroma, u4_idx_B_chroma; |
1050 | | |
1051 | 6.15M | isvce_codec_t *ps_codec = ps_proc->ps_codec; |
1052 | 6.15M | coordinates_t s_cur_mb_pos = {ps_deblk->i4_mb_x, ps_deblk->i4_mb_y}; |
1053 | 6.15M | coordinates_t s_left_mb_pos = {ps_deblk->i4_mb_x - 1, ps_deblk->i4_mb_y}; |
1054 | 6.15M | coordinates_t s_top_mb_pos = {ps_deblk->i4_mb_x, ps_deblk->i4_mb_y - 1}; |
1055 | | |
1056 | 6.15M | WORD32 i4_mb_x = ps_deblk->i4_mb_x, i4_mb_y = ps_deblk->i4_mb_y; |
1057 | 6.15M | WORD32 i4_luma_stride = ps_deblk->s_rec_pic_buf_props.as_component_bufs[0].i4_data_stride; |
1058 | 6.15M | UWORD8 *pu1_cur_pic_luma = |
1059 | 6.15M | (UWORD8 *) (ps_deblk->s_rec_pic_buf_props.as_component_bufs[0].pv_data) + |
1060 | 6.15M | (i4_mb_x * MB_SIZE) + ((i4_mb_y * MB_SIZE) * i4_luma_stride); |
1061 | 6.15M | WORD32 i4_chroma_stride = ps_deblk->s_rec_pic_buf_props.as_component_bufs[1].i4_data_stride; |
1062 | 6.15M | UWORD8 *pu1_cur_pic_chroma = |
1063 | 6.15M | (UWORD8 *) (ps_deblk->s_rec_pic_buf_props.as_component_bufs[1].pv_data) + |
1064 | 6.15M | (i4_mb_x * MB_SIZE) + (i4_mb_y * (MB_SIZE / 2) * i4_chroma_stride); |
1065 | 6.15M | UWORD32 push_ptr = (i4_mb_y * ps_proc->i4_wd_mbs) + i4_mb_x; |
1066 | | |
1067 | 6.15M | if(!u1_inter_layer_deblk_flag) |
1068 | 6.15M | { |
1069 | 6.15M | pu4_pic_vert_bs = ps_deblk->s_bs_ctxt.pu4_pic_vert_bs; |
1070 | 6.15M | pu4_pic_horz_bs = ps_deblk->s_bs_ctxt.pu4_pic_horz_bs; |
1071 | 6.15M | } |
1072 | 0 | else |
1073 | 0 | { |
1074 | 0 | pu4_pic_vert_bs = ps_deblk->s_bs_ctxt.pu4_intra_base_vert_bs; |
1075 | 0 | pu4_pic_horz_bs = ps_deblk->s_bs_ctxt.pu4_intra_base_horz_bs; |
1076 | 0 | } |
1077 | | |
1078 | | /* derive neighbor availability */ |
1079 | | /* In slice mode the edges of mbs that lie on the slice boundary are not |
1080 | | * deblocked */ |
1081 | | /* deblocking filter idc '2' */ |
1082 | 6.15M | if(ps_codec->s_cfg.e_slice_mode != IVE_SLICE_MODE_NONE) |
1083 | 0 | { |
1084 | | /* slice index */ |
1085 | 0 | UWORD8 *pu1_slice_idx = ps_deblk->pu1_slice_idx; |
1086 | |
|
1087 | 0 | pu1_slice_idx += (i4_mb_y * ps_proc->i4_wd_mbs); |
1088 | | /* left macroblock availability */ |
1089 | 0 | u1_mb_a = (i4_mb_x == 0 || (pu1_slice_idx[i4_mb_x - 1] != pu1_slice_idx[i4_mb_x])) ? 0 : 1; |
1090 | | /* top macroblock availability */ |
1091 | 0 | u1_mb_b = (i4_mb_y == 0 || |
1092 | 0 | (pu1_slice_idx[i4_mb_x - ps_proc->i4_wd_mbs] != pu1_slice_idx[i4_mb_x])) |
1093 | 0 | ? 0 |
1094 | 0 | : 1; |
1095 | 0 | } |
1096 | 6.15M | else |
1097 | 6.15M | { |
1098 | | /* left macroblock availability */ |
1099 | 6.15M | u1_mb_a = (i4_mb_x == 0) ? 0 : 1; |
1100 | | /* top macroblock availability */ |
1101 | 6.15M | u1_mb_b = (i4_mb_y == 0) ? 0 : 1; |
1102 | 6.15M | } |
1103 | | |
1104 | 6.15M | pu4_pic_vert_bs += push_ptr * NUM_EDGES_IN_MB; |
1105 | 6.15M | pu4_pic_horz_bs += push_ptr * NUM_EDGES_IN_MB; |
1106 | | |
1107 | | /********/ |
1108 | | /* luma */ |
1109 | | /********/ |
1110 | 6.15M | u1_cur_mb_qp = isvce_get_deblk_mb_qp(ps_proc, &s_cur_mb_pos); |
1111 | 6.15M | ps_deblk->s_bs_ctxt.pu1_pic_qp[push_ptr] = u1_cur_mb_qp; |
1112 | | |
1113 | | /* filter offset A and filter offset B have to be received from slice header |
1114 | | */ |
1115 | | /* TODO : for now lets set these offsets as zero */ |
1116 | | |
1117 | 6.15M | u4_idx_A_luma = MIN(51, u1_cur_mb_qp + 0); |
1118 | 6.15M | u4_idx_B_luma = MIN(51, u1_cur_mb_qp + 0); |
1119 | | |
1120 | | /* alpha, beta computation */ |
1121 | 6.15M | u4_alpha_luma = gu1_ih264_alpha_table[u4_idx_A_luma]; |
1122 | 6.15M | u4_beta_luma = gu1_ih264_beta_table[u4_idx_B_luma]; |
1123 | | |
1124 | | /**********/ |
1125 | | /* chroma */ |
1126 | | /**********/ |
1127 | 6.15M | u4_qp_chroma = gu1_qpc_fqpi[u1_cur_mb_qp]; |
1128 | | |
1129 | | /* filter offset A and filter offset B have to be received from slice header |
1130 | | */ |
1131 | | /* TODO : for now lets set these offsets as zero */ |
1132 | | |
1133 | 6.15M | u4_idx_A_chroma = MIN(51, u4_qp_chroma + 0); |
1134 | 6.15M | u4_idx_B_chroma = MIN(51, u4_qp_chroma + 0); |
1135 | | |
1136 | | /* alpha, beta computation */ |
1137 | 6.15M | u4_alpha_chroma = gu1_ih264_alpha_table[u4_idx_A_chroma]; |
1138 | 6.15M | u4_beta_chroma = gu1_ih264_beta_table[u4_idx_B_chroma]; |
1139 | | |
1140 | | /* Deblock vertical edges */ |
1141 | | /* left vertical edge 0 - allowed to be deblocked ? */ |
1142 | 6.15M | if(u1_mb_a) |
1143 | 5.93M | { |
1144 | 5.93M | u1_left_mb_qp = isvce_get_deblk_mb_qp(ps_proc, &s_left_mb_pos); |
1145 | | |
1146 | 5.93M | isvce_filter_left_edge(ps_codec, u1_left_mb_qp, u1_cur_mb_qp, pu1_cur_pic_luma, |
1147 | 5.93M | i4_luma_stride, pu1_cur_pic_chroma, i4_chroma_stride, |
1148 | 5.93M | pu4_pic_vert_bs); |
1149 | 5.93M | } |
1150 | | |
1151 | | /* vertical edge 1 */ |
1152 | 6.15M | if(pu4_pic_vert_bs[1] == 0x04040404) |
1153 | 0 | { |
1154 | | /* strong filter */ |
1155 | 0 | ps_codec->pf_deblk_luma_vert_bs4(pu1_cur_pic_luma + 4, i4_luma_stride, u4_alpha_luma, |
1156 | 0 | u4_beta_luma); |
1157 | 0 | } |
1158 | 6.15M | else |
1159 | 6.15M | { |
1160 | | /* normal filter */ |
1161 | 6.15M | ps_codec->pf_deblk_luma_vert_bslt4(pu1_cur_pic_luma + 4, i4_luma_stride, u4_alpha_luma, |
1162 | 6.15M | u4_beta_luma, pu4_pic_vert_bs[1], |
1163 | 6.15M | gu1_ih264_clip_table[u4_idx_A_luma]); |
1164 | 6.15M | } |
1165 | | |
1166 | | /* vertical edge 2 */ |
1167 | 6.15M | if(pu4_pic_vert_bs[2] == 0x04040404) |
1168 | 0 | { |
1169 | | /* strong filter */ |
1170 | 0 | ps_codec->pf_deblk_luma_vert_bs4(pu1_cur_pic_luma + 8, i4_luma_stride, u4_alpha_luma, |
1171 | 0 | u4_beta_luma); |
1172 | 0 | ps_codec->pf_deblk_chroma_vert_bs4(pu1_cur_pic_chroma + 8, i4_chroma_stride, |
1173 | 0 | u4_alpha_chroma, u4_beta_chroma, u4_alpha_chroma, |
1174 | 0 | u4_beta_chroma); |
1175 | 0 | } |
1176 | 6.15M | else |
1177 | 6.15M | { |
1178 | | /* normal filter */ |
1179 | 6.15M | ps_codec->pf_deblk_luma_vert_bslt4(pu1_cur_pic_luma + 8, i4_luma_stride, u4_alpha_luma, |
1180 | 6.15M | u4_beta_luma, pu4_pic_vert_bs[2], |
1181 | 6.15M | gu1_ih264_clip_table[u4_idx_A_luma]); |
1182 | | |
1183 | 6.15M | ps_codec->pf_deblk_chroma_vert_bslt4( |
1184 | 6.15M | pu1_cur_pic_chroma + 8, i4_chroma_stride, u4_alpha_chroma, u4_beta_chroma, |
1185 | 6.15M | u4_alpha_chroma, u4_beta_chroma, pu4_pic_vert_bs[2], |
1186 | 6.15M | gu1_ih264_clip_table[u4_idx_A_chroma], gu1_ih264_clip_table[u4_idx_A_chroma]); |
1187 | 6.15M | } |
1188 | | |
1189 | | /* vertical edge 3 */ |
1190 | 6.15M | if(pu4_pic_vert_bs[3] == 0x04040404) |
1191 | 0 | { |
1192 | | /* strong filter */ |
1193 | 0 | ps_codec->pf_deblk_luma_vert_bs4(pu1_cur_pic_luma + 12, i4_luma_stride, u4_alpha_luma, |
1194 | 0 | u4_beta_luma); |
1195 | 0 | } |
1196 | 6.15M | else |
1197 | 6.15M | { |
1198 | | /* normal filter */ |
1199 | 6.15M | ps_codec->pf_deblk_luma_vert_bslt4(pu1_cur_pic_luma + 12, i4_luma_stride, u4_alpha_luma, |
1200 | 6.15M | u4_beta_luma, pu4_pic_vert_bs[3], |
1201 | 6.15M | gu1_ih264_clip_table[u4_idx_A_luma]); |
1202 | 6.15M | } |
1203 | | |
1204 | | /* Deblock Horizontal edges */ |
1205 | | /* Horizontal edge 0 */ |
1206 | 6.15M | if(u1_mb_b) |
1207 | 5.87M | { |
1208 | 5.87M | u1_top_mb_qp = isvce_get_deblk_mb_qp(ps_proc, &s_top_mb_pos); |
1209 | | |
1210 | 5.87M | isvce_filter_top_edge(ps_codec, u1_top_mb_qp, u1_cur_mb_qp, pu1_cur_pic_luma, |
1211 | 5.87M | i4_luma_stride, pu1_cur_pic_chroma, i4_chroma_stride, |
1212 | 5.87M | pu4_pic_horz_bs); |
1213 | 5.87M | } |
1214 | | |
1215 | | /* horizontal edge 1 */ |
1216 | 6.15M | if(pu4_pic_horz_bs[1] == 0x04040404) |
1217 | 0 | { |
1218 | | /* strong filter */ |
1219 | 0 | ps_codec->pf_deblk_luma_horz_bs4(pu1_cur_pic_luma + 4 * i4_luma_stride, i4_luma_stride, |
1220 | 0 | u4_alpha_luma, u4_beta_luma); |
1221 | 0 | } |
1222 | 6.15M | else |
1223 | 6.15M | { |
1224 | | /* normal filter */ |
1225 | 6.15M | ps_codec->pf_deblk_luma_horz_bslt4(pu1_cur_pic_luma + 4 * i4_luma_stride, i4_luma_stride, |
1226 | 6.15M | u4_alpha_luma, u4_beta_luma, pu4_pic_horz_bs[1], |
1227 | 6.15M | gu1_ih264_clip_table[u4_idx_A_luma]); |
1228 | 6.15M | } |
1229 | | |
1230 | | /* horizontal edge 2 */ |
1231 | 6.15M | if(pu4_pic_horz_bs[2] == 0x04040404) |
1232 | 0 | { |
1233 | | /* strong filter */ |
1234 | 0 | ps_codec->pf_deblk_luma_horz_bs4(pu1_cur_pic_luma + 8 * i4_luma_stride, i4_luma_stride, |
1235 | 0 | u4_alpha_luma, u4_beta_luma); |
1236 | 0 | ps_codec->pf_deblk_chroma_horz_bs4(pu1_cur_pic_chroma + 4 * i4_chroma_stride, |
1237 | 0 | i4_chroma_stride, u4_alpha_chroma, u4_beta_chroma, |
1238 | 0 | u4_alpha_chroma, u4_beta_chroma); |
1239 | 0 | } |
1240 | 6.15M | else |
1241 | 6.15M | { |
1242 | | /* normal filter */ |
1243 | 6.15M | ps_codec->pf_deblk_luma_horz_bslt4(pu1_cur_pic_luma + 8 * i4_luma_stride, i4_luma_stride, |
1244 | 6.15M | u4_alpha_luma, u4_beta_luma, pu4_pic_horz_bs[2], |
1245 | 6.15M | gu1_ih264_clip_table[u4_idx_A_luma]); |
1246 | | |
1247 | 6.15M | ps_codec->pf_deblk_chroma_horz_bslt4( |
1248 | 6.15M | pu1_cur_pic_chroma + 4 * i4_chroma_stride, i4_chroma_stride, u4_alpha_chroma, |
1249 | 6.15M | u4_beta_chroma, u4_alpha_chroma, u4_beta_chroma, pu4_pic_horz_bs[2], |
1250 | 6.15M | gu1_ih264_clip_table[u4_idx_A_chroma], gu1_ih264_clip_table[u4_idx_A_chroma]); |
1251 | 6.15M | } |
1252 | | |
1253 | | /* horizontal edge 3 */ |
1254 | 6.15M | if(pu4_pic_horz_bs[3] == 0x04040404) |
1255 | 0 | { |
1256 | | /* strong filter */ |
1257 | 0 | ps_codec->pf_deblk_luma_horz_bs4(pu1_cur_pic_luma + 12 * i4_luma_stride, i4_luma_stride, |
1258 | 0 | u4_alpha_luma, u4_beta_luma); |
1259 | 0 | } |
1260 | 6.15M | else |
1261 | 6.15M | { |
1262 | | /* normal filter */ |
1263 | 6.15M | ps_codec->pf_deblk_luma_horz_bslt4(pu1_cur_pic_luma + 12 * i4_luma_stride, i4_luma_stride, |
1264 | 6.15M | u4_alpha_luma, u4_beta_luma, pu4_pic_horz_bs[3], |
1265 | 6.15M | gu1_ih264_clip_table[u4_idx_A_luma]); |
1266 | 6.15M | } |
1267 | 6.15M | } |