/src/libavc/encoder/ih264e_deblk.c
Line | Count | Source (jump to first uncovered line) |
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 | | ******************************************************************************* |
23 | | * @file |
24 | | * ih264e_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 | | * - ih264e_fill_bs_1mv_1ref_non_mbaff |
34 | | * - ih264e_calculate_csbp |
35 | | * - ih264e_compute_bs |
36 | | * - ih264e_filter_top_edge |
37 | | * - ih264e_filter_left_edge |
38 | | * - ih264e_deblock_mb |
39 | | * |
40 | | * @remarks |
41 | | * none |
42 | | * |
43 | | ******************************************************************************* |
44 | | */ |
45 | | |
46 | | /*****************************************************************************/ |
47 | | /* File Includes */ |
48 | | /*****************************************************************************/ |
49 | | |
50 | | /* System Include Files */ |
51 | | #include <stdio.h> |
52 | | #include <string.h> |
53 | | #include <assert.h> |
54 | | |
55 | | /* User Include Files */ |
56 | | #include "ih264e_config.h" |
57 | | #include "ih264_typedefs.h" |
58 | | #include "iv2.h" |
59 | | #include "ive2.h" |
60 | | |
61 | | #include "ih264_macros.h" |
62 | | #include "ih264_defs.h" |
63 | | #include "ih264_mem_fns.h" |
64 | | #include "ih264_padding.h" |
65 | | #include "ih264_structs.h" |
66 | | #include "ih264_trans_quant_itrans_iquant.h" |
67 | | #include "ih264_inter_pred_filters.h" |
68 | | #include "ih264_intra_pred_filters.h" |
69 | | #include "ih264_deblk_edge_filters.h" |
70 | | #include "ih264_trans_data.h" |
71 | | #include "ih264_cabac_tables.h" |
72 | | #include "ih264_deblk_tables.h" |
73 | | |
74 | | #include "ime_defs.h" |
75 | | #include "ime_distortion_metrics.h" |
76 | | #include "ime_structs.h" |
77 | | |
78 | | #include "irc_cntrl_param.h" |
79 | | #include "irc_frame_info_collector.h" |
80 | | |
81 | | #include "ih264e_error.h" |
82 | | #include "ih264e_defs.h" |
83 | | #include "ih264e_rate_control.h" |
84 | | #include "ih264e_bitstream.h" |
85 | | #include "ih264e_cabac_structs.h" |
86 | | #include "ih264e_structs.h" |
87 | | #include "ih264e_deblk.h" |
88 | | |
89 | | |
90 | | /*****************************************************************************/ |
91 | | /* global definitions */ |
92 | | /*****************************************************************************/ |
93 | | |
94 | | /** |
95 | | ****************************************************************************** |
96 | | * @brief BS Table Lookup |
97 | | * input : |
98 | | * output : |
99 | | * @remarks none |
100 | | ****************************************************************************** |
101 | | */ |
102 | | static const UWORD32 gu4_bs_table[][16] = |
103 | | { |
104 | | { |
105 | | 0x00000000, 0x02000000, 0x00020000, 0x02020000, |
106 | | 0x00000200, 0x02000200, 0x00020200, 0x02020200, |
107 | | 0x00000002, 0x02000002, 0x00020002, 0x02020002, |
108 | | 0x00000202, 0x02000202, 0x00020202, 0x02020202 |
109 | | }, |
110 | | { |
111 | | 0x01010101, 0x02010101, 0x01020101, 0x02020101, |
112 | | 0x01010201, 0x02010201, 0x01020201, 0x02020201, |
113 | | 0x01010102, 0x02010102, 0x01020102, 0x02020102, |
114 | | 0x01010202, 0x02010202, 0x01020202, 0x02020202 |
115 | | } |
116 | | }; |
117 | | |
118 | | /** |
119 | | ****************************************************************************** |
120 | | * @brief Transpose Matrix used in BS |
121 | | * input : |
122 | | * output : |
123 | | * @remarks none |
124 | | ****************************************************************************** |
125 | | */ |
126 | | static const UWORD16 ih264e_gu2_4x4_v2h_reorder[16] = |
127 | | { |
128 | | 0x0000, 0x0001, 0x0010, 0x0011, |
129 | | 0x0100, 0x0101, 0x0110, 0x0111, |
130 | | 0x1000, 0x1001, 0x1010, 0x1011, |
131 | | 0x1100, 0x1101, 0x1110, 0x1111 |
132 | | }; |
133 | | |
134 | | |
135 | | /*****************************************************************************/ |
136 | | /* Function Definitions */ |
137 | | /*****************************************************************************/ |
138 | | |
139 | | /** |
140 | | ******************************************************************************* |
141 | | * |
142 | | * @brief Fill BS value for all the edges of an mb |
143 | | * |
144 | | * @par Description: |
145 | | * Fill BS value for all the edges of an mb |
146 | | * |
147 | | * @param[in] pu4_horz_bs |
148 | | * Base pointer of horizontal BS table |
149 | | * |
150 | | * @param[in] pu4_vert_bs |
151 | | * Base pointer of vertical BS table |
152 | | * |
153 | | * @param[in] u4_left_mb_csbp |
154 | | * coded sub block pattern of left mb |
155 | | * |
156 | | * @param[in] u4_left_mb_csbp |
157 | | * coded sub block pattern of top mb |
158 | | * |
159 | | * @param[in] ps_left_pu |
160 | | * PU for left MB |
161 | | * |
162 | | * @param[in] ps_top_pu |
163 | | * PU for top MB |
164 | | * |
165 | | * @param[in] ps_curr_pu |
166 | | * PU for current MB |
167 | | * |
168 | | * @returns none |
169 | | * |
170 | | * @remarks none |
171 | | * |
172 | | ******************************************************************************* |
173 | | */ |
174 | | static void ih264e_fill_bs_1mv_1ref_non_mbaff(UWORD32 *pu4_horz_bs, |
175 | | UWORD32 *pu4_vert_bs, |
176 | | UWORD32 u4_left_mb_csbp, |
177 | | UWORD32 u4_top_mb_csbp, |
178 | | UWORD32 u4_cur_mb_csbp, |
179 | | enc_pu_t *ps_left_pu, |
180 | | enc_pu_t *ps_top_pu, |
181 | | enc_pu_t *ps_curr_pu) |
182 | 41.3k | { |
183 | | /* motion vectors of blks p & q */ |
184 | 41.3k | WORD16 i16_qMvl0_x, i16_qMvl0_y, i16_pMvl0_x, i16_pMvl0_y; |
185 | 41.3k | WORD16 i16_qMvl1_x, i16_qMvl1_y, i16_pMvl1_x, i16_pMvl1_y; |
186 | | |
187 | | /* temp var */ |
188 | 41.3k | UWORD32 u4_left_flag, u4_top_flag; |
189 | 41.3k | const UWORD32 *bs_map; |
190 | 41.3k | UWORD32 u4_reordered_vert_bs_enc, u4_temp; |
191 | | |
192 | | /* Coded Pattern for Horizontal Edge */ |
193 | | /*-----------------------------------------------------------------------*/ |
194 | | /*u4_nbr_horz_csbp=11C|10C|9C|8C|7C|6C|5C|4C|3C|2C|1C|0C|15T|14T|13T|12T */ |
195 | | /*-----------------------------------------------------------------------*/ |
196 | 41.3k | UWORD32 u4_nbr_horz_csbp = (u4_cur_mb_csbp << 4) | (u4_top_mb_csbp >> 12); |
197 | 41.3k | UWORD32 u4_horz_bs_enc = u4_cur_mb_csbp | u4_nbr_horz_csbp; |
198 | | |
199 | | /* Coded Pattern for Vertical Edge */ |
200 | | /*-----------------------------------------------------------------------*/ |
201 | | /*u4_left_mb_masked_csbp = 15L|0|0|0|11L|0|0|0|7L|0|0|0|3L|0|0|0 */ |
202 | | /*-----------------------------------------------------------------------*/ |
203 | 41.3k | UWORD32 u4_left_mb_masked_csbp = u4_left_mb_csbp & CSBP_RIGHT_BLOCK_MASK; |
204 | | |
205 | | /*-----------------------------------------------------------------------*/ |
206 | | /*u4_cur_mb_masked_csbp =14C|13C|12C|x|10C|9C|8C|x|6C|5C|4C|x|2C|1C|0C|x */ |
207 | | /*-----------------------------------------------------------------------*/ |
208 | 41.3k | UWORD32 u4_cur_mb_masked_csbp = (u4_cur_mb_csbp << 1) |
209 | 41.3k | & (~CSBP_LEFT_BLOCK_MASK); |
210 | | |
211 | | /*-----------------------------------------------------------------------*/ |
212 | | /*u4_nbr_vert_csbp=14C|13C|12C|15L|10C|9C|8C|11L|6C|5C|4C|7L|2C|1C|0C|3L */ |
213 | | /*-----------------------------------------------------------------------*/ |
214 | 41.3k | UWORD32 u4_nbr_vert_csbp = (u4_cur_mb_masked_csbp) |
215 | 41.3k | | (u4_left_mb_masked_csbp >> 3); |
216 | 41.3k | UWORD32 u4_vert_bs_enc = u4_cur_mb_csbp | u4_nbr_vert_csbp; |
217 | | |
218 | | /* BS Calculation for MB Boundary Edges */ |
219 | | |
220 | | /* BS calculation for 1 2 3 horizontal boundary */ |
221 | 41.3k | bs_map = gu4_bs_table[0]; |
222 | 41.3k | pu4_horz_bs[1] = bs_map[(u4_horz_bs_enc >> 4) & 0xF]; |
223 | 41.3k | pu4_horz_bs[2] = bs_map[(u4_horz_bs_enc >> 8) & 0xF]; |
224 | 41.3k | pu4_horz_bs[3] = bs_map[(u4_horz_bs_enc >> 12) & 0xF]; |
225 | | |
226 | | /* BS calculation for 5 6 7 vertical boundary */ |
227 | | /* Do 4x4 tranpose of u4_vert_bs_enc by using look up table for reorder */ |
228 | 41.3k | u4_reordered_vert_bs_enc = ih264e_gu2_4x4_v2h_reorder[u4_vert_bs_enc & 0xF]; |
229 | | |
230 | 41.3k | u4_temp = ih264e_gu2_4x4_v2h_reorder[(u4_vert_bs_enc >> 4) & 0xF]; |
231 | 41.3k | u4_reordered_vert_bs_enc |= (u4_temp << 1); |
232 | | |
233 | 41.3k | u4_temp = ih264e_gu2_4x4_v2h_reorder[(u4_vert_bs_enc >> 8) & 0xF]; |
234 | 41.3k | u4_reordered_vert_bs_enc |= (u4_temp << 2); |
235 | | |
236 | 41.3k | u4_temp = ih264e_gu2_4x4_v2h_reorder[(u4_vert_bs_enc >> 12) & 0xF]; |
237 | 41.3k | u4_reordered_vert_bs_enc |= (u4_temp << 3); |
238 | | |
239 | 41.3k | pu4_vert_bs[1] = bs_map[(u4_reordered_vert_bs_enc >> 4) & 0xF]; |
240 | 41.3k | pu4_vert_bs[2] = bs_map[(u4_reordered_vert_bs_enc >> 8) & 0xF]; |
241 | 41.3k | pu4_vert_bs[3] = bs_map[(u4_reordered_vert_bs_enc >> 12) & 0xF]; |
242 | | |
243 | | |
244 | | /* BS Calculation for MB Boundary Edges */ |
245 | 41.3k | if (ps_top_pu->b1_intra_flag) |
246 | 3.51k | { |
247 | 3.51k | pu4_horz_bs[0] = 0x04040404; |
248 | 3.51k | } |
249 | 37.8k | else |
250 | 37.8k | { |
251 | 37.8k | if (ps_curr_pu->b2_pred_mode != ps_top_pu->b2_pred_mode) |
252 | 0 | { |
253 | 0 | u4_top_flag = 1; |
254 | 0 | } |
255 | 37.8k | else if(ps_curr_pu->b2_pred_mode != 2) |
256 | 37.8k | { |
257 | 37.8k | i16_pMvl0_x = ps_top_pu->s_me_info[ps_top_pu->b2_pred_mode].s_mv.i2_mvx; |
258 | 37.8k | i16_pMvl0_y = ps_top_pu->s_me_info[ps_top_pu->b2_pred_mode].s_mv.i2_mvy; |
259 | | |
260 | 37.8k | i16_qMvl0_x = ps_curr_pu->s_me_info[ps_curr_pu->b2_pred_mode].s_mv.i2_mvx; |
261 | 37.8k | i16_qMvl0_y = ps_curr_pu->s_me_info[ps_curr_pu->b2_pred_mode].s_mv.i2_mvy; |
262 | | |
263 | | |
264 | 37.8k | u4_top_flag = (ABS((i16_pMvl0_x - i16_qMvl0_x)) >= 4) |
265 | 37.8k | | (ABS((i16_pMvl0_y - i16_qMvl0_y)) >= 4); |
266 | 37.8k | } |
267 | 18.4E | else |
268 | 18.4E | { |
269 | | |
270 | 18.4E | i16_pMvl0_x = ps_top_pu->s_me_info[PRED_L0].s_mv.i2_mvx; |
271 | 18.4E | i16_pMvl0_y = ps_top_pu->s_me_info[PRED_L0].s_mv.i2_mvy; |
272 | 18.4E | i16_pMvl1_x = ps_top_pu->s_me_info[PRED_L1].s_mv.i2_mvx; |
273 | 18.4E | i16_pMvl1_y = ps_top_pu->s_me_info[PRED_L1].s_mv.i2_mvy; |
274 | | |
275 | 18.4E | i16_qMvl0_x = ps_curr_pu->s_me_info[PRED_L0].s_mv.i2_mvx; |
276 | 18.4E | i16_qMvl0_y = ps_curr_pu->s_me_info[PRED_L0].s_mv.i2_mvy; |
277 | 18.4E | i16_qMvl1_x = ps_curr_pu->s_me_info[PRED_L1].s_mv.i2_mvx; |
278 | 18.4E | i16_qMvl1_y = ps_curr_pu->s_me_info[PRED_L1].s_mv.i2_mvy; |
279 | | |
280 | | |
281 | 18.4E | u4_top_flag = (ABS((i16_pMvl0_x - i16_qMvl0_x)) >= 4) |
282 | 18.4E | | (ABS((i16_pMvl0_y - i16_qMvl0_y)) >= 4) |
283 | 18.4E | | (ABS((i16_pMvl1_x - i16_qMvl1_x)) >= 4) |
284 | 18.4E | | (ABS((i16_pMvl1_y - i16_qMvl1_y)) >= 4); |
285 | 18.4E | } |
286 | | |
287 | 37.8k | bs_map = gu4_bs_table[!!u4_top_flag]; |
288 | 37.8k | pu4_horz_bs[0] = bs_map[u4_horz_bs_enc & 0xF]; |
289 | 37.8k | } |
290 | | |
291 | | |
292 | 41.3k | if (ps_left_pu->b1_intra_flag) |
293 | 1.98k | { |
294 | 1.98k | pu4_vert_bs[0] = 0x04040404; |
295 | 1.98k | } |
296 | 39.3k | else |
297 | 39.3k | { |
298 | 39.3k | if (ps_curr_pu->b2_pred_mode != ps_left_pu->b2_pred_mode) |
299 | 0 | { |
300 | 0 | u4_left_flag = 1; |
301 | 0 | } |
302 | 39.3k | else if (ps_curr_pu->b2_pred_mode != 2)/* Not bipred */ |
303 | 39.3k | { |
304 | 39.3k | i16_pMvl0_x = ps_left_pu->s_me_info[ps_left_pu->b2_pred_mode].s_mv.i2_mvx; |
305 | 39.3k | i16_pMvl0_y = ps_left_pu->s_me_info[ps_left_pu->b2_pred_mode].s_mv.i2_mvy; |
306 | | |
307 | 39.3k | i16_qMvl0_x = ps_curr_pu->s_me_info[ps_curr_pu->b2_pred_mode].s_mv.i2_mvx; |
308 | 39.3k | i16_qMvl0_y = ps_curr_pu->s_me_info[ps_curr_pu->b2_pred_mode].s_mv.i2_mvy; |
309 | | |
310 | | |
311 | 39.3k | u4_left_flag = (ABS((i16_pMvl0_x - i16_qMvl0_x)) >= 4) |
312 | 39.3k | | (ABS((i16_pMvl0_y - i16_qMvl0_y)) >= 4); |
313 | 39.3k | } |
314 | 18.4E | else |
315 | 18.4E | { |
316 | 18.4E | i16_pMvl0_x = ps_left_pu->s_me_info[PRED_L0].s_mv.i2_mvx; |
317 | 18.4E | i16_pMvl0_y = ps_left_pu->s_me_info[PRED_L0].s_mv.i2_mvy; |
318 | 18.4E | i16_pMvl1_x = ps_left_pu->s_me_info[PRED_L1].s_mv.i2_mvx; |
319 | 18.4E | i16_pMvl1_y = ps_left_pu->s_me_info[PRED_L1].s_mv.i2_mvy; |
320 | | |
321 | 18.4E | i16_qMvl0_x = ps_curr_pu->s_me_info[PRED_L0].s_mv.i2_mvx; |
322 | 18.4E | i16_qMvl0_y = ps_curr_pu->s_me_info[PRED_L0].s_mv.i2_mvy; |
323 | 18.4E | i16_qMvl1_x = ps_curr_pu->s_me_info[PRED_L1].s_mv.i2_mvx; |
324 | 18.4E | i16_qMvl1_y = ps_curr_pu->s_me_info[PRED_L1].s_mv.i2_mvy; |
325 | | |
326 | | |
327 | 18.4E | u4_left_flag = (ABS((i16_pMvl0_x - i16_qMvl0_x)) >= 4) |
328 | 18.4E | | (ABS((i16_pMvl0_y - i16_qMvl0_y)) >= 4) |
329 | 18.4E | | (ABS((i16_pMvl1_x - i16_qMvl1_x)) >= 4) |
330 | 18.4E | | (ABS((i16_pMvl1_y - i16_qMvl1_y)) >= 4); |
331 | 18.4E | } |
332 | | |
333 | 39.3k | bs_map = gu4_bs_table[!!u4_left_flag]; |
334 | 39.3k | pu4_vert_bs[0] = bs_map[u4_reordered_vert_bs_enc & 0xF]; |
335 | 39.3k | } |
336 | 41.3k | } |
337 | | |
338 | | /** |
339 | | ******************************************************************************* |
340 | | * |
341 | | * @brief calculate coded subblock pattern from nnz |
342 | | * |
343 | | * @par Description: |
344 | | * calculate coded subblock pattern from nnz |
345 | | * |
346 | | * @param[in] ps_proc |
347 | | * process context |
348 | | * |
349 | | * @returns csbp |
350 | | * |
351 | | * @remarks none |
352 | | * |
353 | | ******************************************************************************* |
354 | | */ |
355 | | static UWORD32 ih264e_calculate_csbp(process_ctxt_t *ps_proc) |
356 | 41.3k | { |
357 | | /* number of non zeros for each tx blk */ |
358 | 41.3k | UWORD8 *pu1_curr_nnz = (UWORD8 *)ps_proc->au4_nnz; |
359 | | |
360 | | /* csbp */ |
361 | 41.3k | UWORD32 u4_csbp = 0; |
362 | | |
363 | | /* temp var */ |
364 | 41.3k | WORD32 i4_i; |
365 | | |
366 | 41.3k | pu1_curr_nnz += 1; |
367 | | |
368 | | /* Creating Subblock pattern for current MB */ |
369 | | /* 15C|14C|13C|12C|11C|10C|9C|8C|7C|6C|5C|4C|3C|2C|1C|0C */ |
370 | 703k | for (i4_i = 0; i4_i < 16; i4_i++ ) |
371 | 661k | { |
372 | 661k | u4_csbp |= ((!!*(pu1_curr_nnz + i4_i))<< i4_i); |
373 | 661k | } |
374 | | |
375 | 41.3k | return u4_csbp; |
376 | 41.3k | } |
377 | | |
378 | | /** |
379 | | ******************************************************************************* |
380 | | * |
381 | | * @brief This function computes blocking strength for an mb |
382 | | * |
383 | | * @par Description: |
384 | | * This function computes blocking strength for an mb |
385 | | * |
386 | | * @param[in] ps_proc |
387 | | * process context |
388 | | * |
389 | | * @returns none |
390 | | * |
391 | | * @remarks |
392 | | * |
393 | | ******************************************************************************* |
394 | | */ |
395 | | void ih264e_compute_bs(process_ctxt_t * ps_proc) |
396 | 5.33M | { |
397 | | /* deblk bs context */ |
398 | 5.33M | bs_ctxt_t *ps_bs = &(ps_proc->s_deblk_ctxt.s_bs_ctxt); |
399 | | |
400 | | /* vertical blocking strength */ |
401 | 5.33M | UWORD32 *pu4_pic_vert_bs; |
402 | | |
403 | | /* horizontal blocking strength */ |
404 | 5.33M | UWORD32 *pu4_pic_horz_bs; |
405 | | |
406 | | /* mb indices */ |
407 | 5.33M | WORD32 i4_mb_x, i4_mb_y; |
408 | | |
409 | | /* is intra */ |
410 | 5.33M | WORD32 i4_intra; |
411 | | |
412 | | /* temp var */ |
413 | 5.33M | WORD32 i4_wd_mbs = ps_proc->i4_wd_mbs; |
414 | | |
415 | | /* init indices */ |
416 | 5.33M | i4_mb_x = ps_bs->i4_mb_x; |
417 | 5.33M | i4_mb_y = ps_bs->i4_mb_y; |
418 | | |
419 | | /* init pointers */ |
420 | 5.33M | pu4_pic_vert_bs = ps_bs->pu4_pic_vert_bs + ((i4_mb_y * i4_wd_mbs) + i4_mb_x) * 4; |
421 | 5.33M | pu4_pic_horz_bs = ps_bs->pu4_pic_horz_bs + ((i4_mb_y * i4_wd_mbs) + i4_mb_x) * 4; |
422 | | |
423 | | /* is intra? */ |
424 | 5.33M | i4_intra = ps_proc->u4_is_intra; |
425 | | |
426 | | /* compute blocking strength */ |
427 | 5.33M | if (i4_intra) |
428 | 5.29M | { |
429 | 5.29M | pu4_pic_vert_bs[0] = 0x04040404; |
430 | 5.29M | pu4_pic_vert_bs[1] = pu4_pic_vert_bs[2] = pu4_pic_vert_bs[3] = 0x03030303; |
431 | | |
432 | 5.29M | pu4_pic_horz_bs[0] = 0x04040404; |
433 | 5.29M | pu4_pic_horz_bs[1] = pu4_pic_horz_bs[2] = pu4_pic_horz_bs[3] = 0x03030303; |
434 | 5.29M | } |
435 | 41.4k | else |
436 | 41.4k | { |
437 | | /* left mb syntax info */ |
438 | 41.4k | mb_info_t *ps_left_mb_syntax_ele = &ps_proc->s_left_mb_syntax_ele; |
439 | | |
440 | | /* top mb syntax info */ |
441 | 41.4k | mb_info_t *ps_top_mb_syntax_ele = ps_proc->ps_top_row_mb_syntax_ele + i4_mb_x; |
442 | | |
443 | | /* top row motion vector info */ |
444 | 41.4k | enc_pu_t *ps_top_row_pu = ps_proc->ps_top_row_pu + i4_mb_x; |
445 | | |
446 | | /* csbp for curr mb */ |
447 | 41.4k | ps_proc->u4_csbp = ih264e_calculate_csbp(ps_proc); |
448 | | |
449 | | /* csbp for ngbrs */ |
450 | 41.4k | if (i4_mb_x == 0) |
451 | 15.1k | { |
452 | 15.1k | ps_left_mb_syntax_ele->u4_csbp = 0; |
453 | 15.1k | ps_proc->s_left_mb_pu.b1_intra_flag = 0; |
454 | 15.1k | ps_proc->s_left_mb_pu.b2_pred_mode = ps_proc->ps_pu->b2_pred_mode; |
455 | 15.1k | ps_proc->s_left_mb_pu.s_me_info[0].s_mv = ps_proc->ps_pu->s_me_info[0].s_mv; |
456 | 15.1k | ps_proc->s_left_mb_pu.s_me_info[1].s_mv = ps_proc->ps_pu->s_me_info[1].s_mv; |
457 | 15.1k | } |
458 | 41.4k | if (i4_mb_y == 0) |
459 | 16.0k | { |
460 | 16.0k | ps_top_mb_syntax_ele->u4_csbp = 0; |
461 | 16.0k | ps_top_row_pu->b1_intra_flag = 0; |
462 | 16.0k | ps_top_row_pu->b2_pred_mode = ps_proc->ps_pu->b2_pred_mode; |
463 | 16.0k | ps_top_row_pu->s_me_info[0].s_mv = ps_proc->ps_pu->s_me_info[0].s_mv; |
464 | 16.0k | ps_top_row_pu->s_me_info[1].s_mv = ps_proc->ps_pu->s_me_info[1].s_mv; |
465 | 16.0k | } |
466 | | |
467 | 41.4k | ih264e_fill_bs_1mv_1ref_non_mbaff(pu4_pic_horz_bs, |
468 | 41.4k | pu4_pic_vert_bs, |
469 | 41.4k | ps_left_mb_syntax_ele->u4_csbp, |
470 | 41.4k | ps_top_mb_syntax_ele->u4_csbp, |
471 | 41.4k | ps_proc->u4_csbp, |
472 | 41.4k | &ps_proc->s_left_mb_pu, |
473 | 41.4k | ps_top_row_pu, |
474 | 41.4k | ps_proc->ps_pu); |
475 | 41.4k | } |
476 | | |
477 | 5.33M | return ; |
478 | 5.33M | } |
479 | | |
480 | | /** |
481 | | ******************************************************************************* |
482 | | * |
483 | | * @brief This function performs deblocking of top horizontal edge |
484 | | * |
485 | | * @par Description: |
486 | | * This function performs deblocking of top horizontal edge |
487 | | * |
488 | | * @param[in] ps_codec |
489 | | * pointer to codec context |
490 | | * |
491 | | * @param[in] ps_proc |
492 | | * pointer to proc context |
493 | | * |
494 | | * @param[in] pu1_mb_qp |
495 | | * pointer to mb quantization param |
496 | | * |
497 | | * @param[in] pu1_cur_pic_luma |
498 | | * pointer to recon buffer luma |
499 | | * |
500 | | * @param[in] pu1_cur_pic_chroma |
501 | | * pointer to recon buffer chroma |
502 | | * |
503 | | * @param[in] pu4_pic_horz_bs |
504 | | * pointer to horizontal blocking strength |
505 | | * |
506 | | * @returns none |
507 | | * |
508 | | * @remarks none |
509 | | * |
510 | | ******************************************************************************* |
511 | | */ |
512 | | static void ih264e_filter_top_edge(codec_t *ps_codec, |
513 | | process_ctxt_t *ps_proc, |
514 | | UWORD8 *pu1_mb_qp, |
515 | | UWORD8 *pu1_cur_pic_luma, |
516 | | UWORD8 *pu1_cur_pic_chroma, |
517 | | UWORD32 *pu4_pic_horz_bs) |
518 | 5.23M | { |
519 | | /* strd */ |
520 | 5.23M | WORD32 i4_rec_strd = ps_proc->i4_rec_strd; |
521 | | |
522 | | /* deblk params */ |
523 | 5.23M | UWORD32 u4_alpha_luma, u4_beta_luma, u4_qp_luma, u4_idx_A_luma, u4_idx_B_luma, u4_qp_p, u4_qp_q; |
524 | 5.23M | UWORD32 u4_alpha_chroma, u4_beta_chroma, u4_qp_chroma, u4_idx_A_chroma, u4_idx_B_chroma; |
525 | | |
526 | | /* collect qp of left & top mb */ |
527 | 5.23M | u4_qp_p = pu1_mb_qp[-ps_proc->i4_wd_mbs]; |
528 | 5.23M | u4_qp_q = pu1_mb_qp[0]; |
529 | | |
530 | | /********/ |
531 | | /* luma */ |
532 | | /********/ |
533 | 5.23M | u4_qp_luma = (u4_qp_p + u4_qp_q + 1) >> 1; |
534 | | |
535 | | /* filter offset A and filter offset B have to be received from slice header */ |
536 | | /* TODO : for now lets set these offsets as zero */ |
537 | | |
538 | | |
539 | 5.23M | u4_idx_A_luma = MIN(51, u4_qp_luma + 0); |
540 | 5.23M | u4_idx_B_luma = MIN(51, u4_qp_luma + 0); |
541 | | |
542 | | /* alpha, beta computation */ |
543 | 5.23M | u4_alpha_luma = gu1_ih264_alpha_table[u4_idx_A_luma]; |
544 | 5.23M | u4_beta_luma = gu1_ih264_beta_table[u4_idx_B_luma]; |
545 | | |
546 | | /**********/ |
547 | | /* chroma */ |
548 | | /**********/ |
549 | 5.23M | u4_qp_chroma = (gu1_qpc_fqpi[u4_qp_p] + gu1_qpc_fqpi[u4_qp_q] + 1) >> 1; |
550 | | |
551 | | /* filter offset A and filter offset B have to be received from slice header */ |
552 | | /* TODO : for now lets set these offsets as zero */ |
553 | | |
554 | | |
555 | 5.23M | u4_idx_A_chroma = MIN(51, u4_qp_chroma + 0); |
556 | 5.23M | u4_idx_B_chroma = MIN(51, u4_qp_chroma + 0); |
557 | | |
558 | | /* alpha, beta computation */ |
559 | 5.23M | u4_alpha_chroma = gu1_ih264_alpha_table[u4_idx_A_chroma]; |
560 | 5.23M | u4_beta_chroma = gu1_ih264_beta_table[u4_idx_B_chroma]; |
561 | | |
562 | | /* deblk edge */ |
563 | | /* top Horizontal edge - allowed to be deblocked ? */ |
564 | 5.23M | if (pu4_pic_horz_bs[0] == 0x04040404) |
565 | 5.21M | { |
566 | | /* strong filter */ |
567 | 5.21M | ps_codec->pf_deblk_luma_horz_bs4(pu1_cur_pic_luma, i4_rec_strd, u4_alpha_luma, u4_beta_luma); |
568 | 5.21M | ps_codec->pf_deblk_chroma_horz_bs4(pu1_cur_pic_chroma, i4_rec_strd, u4_alpha_chroma, u4_beta_chroma, u4_alpha_chroma, u4_beta_chroma); |
569 | 5.21M | } |
570 | 21.7k | else |
571 | 21.7k | { |
572 | | /* normal filter */ |
573 | 21.7k | ps_codec->pf_deblk_luma_horz_bslt4(pu1_cur_pic_luma, i4_rec_strd, u4_alpha_luma, |
574 | 21.7k | u4_beta_luma, pu4_pic_horz_bs[0], |
575 | 21.7k | gu1_ih264_clip_table[u4_idx_A_luma]); |
576 | | |
577 | 21.7k | ps_codec->pf_deblk_chroma_horz_bslt4(pu1_cur_pic_chroma, i4_rec_strd, u4_alpha_chroma, |
578 | 21.7k | u4_beta_chroma, u4_alpha_chroma, u4_beta_chroma, pu4_pic_horz_bs[0], |
579 | 21.7k | gu1_ih264_clip_table[u4_idx_A_chroma], gu1_ih264_clip_table[u4_idx_A_chroma]); |
580 | 21.7k | } |
581 | 5.23M | } |
582 | | |
583 | | /** |
584 | | ******************************************************************************* |
585 | | * |
586 | | * @brief This function performs deblocking of left vertical edge |
587 | | * |
588 | | * @par Description: |
589 | | * This function performs deblocking of top horizontal edge |
590 | | * |
591 | | * @param[in] ps_codec |
592 | | * pointer to codec context |
593 | | * |
594 | | * @param[in] ps_proc |
595 | | * pointer to proc context |
596 | | * |
597 | | * @param[in] pu1_mb_qp |
598 | | * pointer to mb quantization param |
599 | | * |
600 | | * @param[in] pu1_cur_pic_luma |
601 | | * pointer to recon buffer luma |
602 | | * |
603 | | * @param[in] pu1_cur_pic_chroma |
604 | | * pointer to recon buffer chroma |
605 | | * |
606 | | * @param[in] pu4_pic_vert_bs |
607 | | * pointer to vertical blocking strength |
608 | | * |
609 | | * @returns none |
610 | | * |
611 | | * @remarks none |
612 | | * |
613 | | ******************************************************************************* |
614 | | */ |
615 | | static void ih264e_filter_left_edge(codec_t *ps_codec, |
616 | | process_ctxt_t *ps_proc, |
617 | | UWORD8 *pu1_mb_qp, |
618 | | UWORD8 *pu1_cur_pic_luma, |
619 | | UWORD8 *pu1_cur_pic_chroma, |
620 | | UWORD32 *pu4_pic_vert_bs) |
621 | 5.23M | { |
622 | | /* strd */ |
623 | 5.23M | WORD32 i4_rec_strd = ps_proc->i4_rec_strd; |
624 | | |
625 | | /* deblk params */ |
626 | 5.23M | UWORD32 u4_alpha_luma, u4_beta_luma, u4_qp_luma, u4_idx_A_luma, u4_idx_B_luma, u4_qp_p, u4_qp_q; |
627 | 5.23M | UWORD32 u4_alpha_chroma, u4_beta_chroma, u4_qp_chroma, u4_idx_A_chroma, u4_idx_B_chroma; |
628 | | |
629 | | /* collect qp of left & curr mb */ |
630 | 5.23M | u4_qp_p = pu1_mb_qp[-1]; |
631 | 5.23M | u4_qp_q = pu1_mb_qp[0]; |
632 | | |
633 | | /********/ |
634 | | /* luma */ |
635 | | /********/ |
636 | 5.23M | u4_qp_luma = (u4_qp_p + u4_qp_q + 1) >> 1; |
637 | | |
638 | | /* filter offset A and filter offset B have to be received from slice header */ |
639 | | /* TODO : for now lets set these offsets as zero */ |
640 | | |
641 | | |
642 | 5.23M | u4_idx_A_luma = MIN(51, u4_qp_luma + 0); |
643 | 5.23M | u4_idx_B_luma = MIN(51, u4_qp_luma + 0); |
644 | | |
645 | | /* alpha, beta computation */ |
646 | 5.23M | u4_alpha_luma = gu1_ih264_alpha_table[u4_idx_A_luma]; |
647 | 5.23M | u4_beta_luma = gu1_ih264_beta_table[u4_idx_B_luma]; |
648 | | |
649 | | /**********/ |
650 | | /* chroma */ |
651 | | /**********/ |
652 | 5.23M | u4_qp_chroma = (gu1_qpc_fqpi[u4_qp_p] + gu1_qpc_fqpi[u4_qp_q] + 1) >> 1; |
653 | | |
654 | | /* filter offset A and filter offset B have to be received from slice header */ |
655 | | /* TODO : for now lets set these offsets as zero */ |
656 | | |
657 | | |
658 | 5.23M | u4_idx_A_chroma = MIN(51, u4_qp_chroma + 0); |
659 | 5.23M | u4_idx_B_chroma = MIN(51, u4_qp_chroma + 0); |
660 | | |
661 | | /* alpha, beta computation */ |
662 | 5.23M | u4_alpha_chroma = gu1_ih264_alpha_table[u4_idx_A_chroma]; |
663 | 5.23M | u4_beta_chroma = gu1_ih264_beta_table[u4_idx_B_chroma]; |
664 | | |
665 | | /* deblk edge */ |
666 | 5.23M | if (pu4_pic_vert_bs[0] == 0x04040404) |
667 | 5.21M | { |
668 | | /* strong filter */ |
669 | 5.21M | ps_codec->pf_deblk_luma_vert_bs4(pu1_cur_pic_luma, i4_rec_strd, u4_alpha_luma, u4_beta_luma); |
670 | 5.21M | ps_codec->pf_deblk_chroma_vert_bs4(pu1_cur_pic_chroma, i4_rec_strd, u4_alpha_chroma, u4_beta_chroma, u4_alpha_chroma, u4_beta_chroma); |
671 | 5.21M | } |
672 | 24.2k | else |
673 | 24.2k | { |
674 | | /* normal filter */ |
675 | 24.2k | ps_codec->pf_deblk_luma_vert_bslt4(pu1_cur_pic_luma, i4_rec_strd, |
676 | 24.2k | u4_alpha_luma, u4_beta_luma, |
677 | 24.2k | pu4_pic_vert_bs[0], |
678 | 24.2k | gu1_ih264_clip_table[u4_idx_A_luma]); |
679 | | |
680 | 24.2k | ps_codec->pf_deblk_chroma_vert_bslt4(pu1_cur_pic_chroma, i4_rec_strd, u4_alpha_chroma, |
681 | 24.2k | u4_beta_chroma, u4_alpha_chroma, u4_beta_chroma, pu4_pic_vert_bs[0], |
682 | 24.2k | gu1_ih264_clip_table[u4_idx_A_chroma], gu1_ih264_clip_table[u4_idx_A_chroma]); |
683 | 24.2k | } |
684 | 5.23M | } |
685 | | |
686 | | /** |
687 | | ******************************************************************************* |
688 | | * |
689 | | * @brief This function performs deblocking on an mb |
690 | | * |
691 | | * @par Description: |
692 | | * This function performs deblocking on an mb |
693 | | * |
694 | | * @param[in] ps_proc |
695 | | * process context corresponding to the job |
696 | | * |
697 | | * @param[in] ps_deblk |
698 | | * pointer to deblock context |
699 | | * |
700 | | * @returns none |
701 | | * |
702 | | * @remarks none |
703 | | * |
704 | | ******************************************************************************* |
705 | | */ |
706 | | void ih264e_deblock_mb(process_ctxt_t *ps_proc, deblk_ctxt_t * ps_deblk) |
707 | 5.34M | { |
708 | | /* codec ctxt */ |
709 | 5.34M | codec_t *ps_codec = ps_proc->ps_codec; |
710 | | |
711 | | /* ngbr availability */ |
712 | 5.34M | UWORD8 u1_mb_a, u1_mb_b; |
713 | | |
714 | | /* mb indices */ |
715 | 5.34M | WORD32 i4_mb_x = ps_deblk->i4_mb_x, i4_mb_y = ps_deblk->i4_mb_y; |
716 | | |
717 | | /* pic qp ptr */ |
718 | 5.34M | UWORD8 *pu1_pic_qp = ps_deblk->s_bs_ctxt.pu1_pic_qp; |
719 | | |
720 | | /* vertical blocking strength */ |
721 | 5.34M | UWORD32 *pu4_pic_vert_bs = ps_deblk->s_bs_ctxt.pu4_pic_vert_bs; |
722 | | |
723 | | /* horizontal blocking strength */ |
724 | 5.34M | UWORD32 *pu4_pic_horz_bs = ps_deblk->s_bs_ctxt.pu4_pic_horz_bs; |
725 | | |
726 | | /* src buffers luma */ |
727 | 5.34M | UWORD8 *pu1_cur_pic_luma = ps_deblk->pu1_cur_pic_luma; |
728 | | |
729 | | /* src buffers chroma */ |
730 | 5.34M | UWORD8 *pu1_cur_pic_chroma = ps_deblk->pu1_cur_pic_chroma; |
731 | | |
732 | | /* strd */ |
733 | 5.34M | WORD32 i4_rec_strd = ps_proc->i4_rec_strd; |
734 | | |
735 | | /* deblk params */ |
736 | 5.34M | UWORD32 u4_alpha_luma, u4_beta_luma, u4_qp_luma, u4_idx_A_luma, u4_idx_B_luma; |
737 | 5.34M | UWORD32 u4_alpha_chroma, u4_beta_chroma, u4_qp_chroma, u4_idx_A_chroma, u4_idx_B_chroma; |
738 | | |
739 | | /* temp var */ |
740 | 5.34M | UWORD32 push_ptr = (i4_mb_y * ps_proc->i4_wd_mbs) + i4_mb_x; |
741 | | |
742 | | /* derive neighbor availability */ |
743 | | /* In slice mode the edges of mbs that lie on the slice boundary are not deblocked */ |
744 | | /* deblocking filter idc '2' */ |
745 | 5.34M | if (ps_codec->s_cfg.e_slice_mode != IVE_SLICE_MODE_NONE) |
746 | 0 | { |
747 | | /* slice index */ |
748 | 0 | UWORD8 *pu1_slice_idx = ps_deblk->pu1_slice_idx; |
749 | |
|
750 | 0 | pu1_slice_idx += (i4_mb_y * ps_proc->i4_wd_mbs); |
751 | | /* left macroblock availability */ |
752 | 0 | u1_mb_a = (i4_mb_x == 0 || |
753 | 0 | (pu1_slice_idx[i4_mb_x - 1 ] != pu1_slice_idx[i4_mb_x]))? 0 : 1; |
754 | | /* top macroblock availability */ |
755 | 0 | u1_mb_b = (i4_mb_y == 0 || |
756 | 0 | (pu1_slice_idx[i4_mb_x-ps_proc->i4_wd_mbs] != pu1_slice_idx[i4_mb_x]))? 0 : 1; |
757 | 0 | } |
758 | 5.34M | else |
759 | 5.34M | { |
760 | | /* left macroblock availability */ |
761 | 5.34M | u1_mb_a = (i4_mb_x == 0)? 0 : 1; |
762 | | /* top macroblock availability */ |
763 | 5.34M | u1_mb_b = (i4_mb_y == 0)? 0 : 1; |
764 | 5.34M | } |
765 | | |
766 | 5.34M | pu1_pic_qp += push_ptr; |
767 | 5.34M | pu4_pic_vert_bs += push_ptr * 4; |
768 | 5.34M | pu4_pic_horz_bs += push_ptr * 4; |
769 | | |
770 | | /********/ |
771 | | /* luma */ |
772 | | /********/ |
773 | 5.34M | u4_qp_luma = pu1_pic_qp[0]; |
774 | | |
775 | | /* filter offset A and filter offset B have to be received from slice header */ |
776 | | /* TODO : for now lets set these offsets as zero */ |
777 | | |
778 | | |
779 | 5.34M | u4_idx_A_luma = MIN(51, u4_qp_luma + 0); |
780 | 5.34M | u4_idx_B_luma = MIN(51, u4_qp_luma + 0); |
781 | | |
782 | | /* alpha, beta computation */ |
783 | 5.34M | u4_alpha_luma = gu1_ih264_alpha_table[u4_idx_A_luma]; |
784 | 5.34M | u4_beta_luma = gu1_ih264_beta_table[u4_idx_B_luma]; |
785 | | |
786 | | /**********/ |
787 | | /* chroma */ |
788 | | /**********/ |
789 | 5.34M | u4_qp_chroma = gu1_qpc_fqpi[u4_qp_luma]; |
790 | | |
791 | | /* filter offset A and filter offset B have to be received from slice header */ |
792 | | /* TODO : for now lets set these offsets as zero */ |
793 | | |
794 | | |
795 | 5.34M | u4_idx_A_chroma = MIN(51, u4_qp_chroma + 0); |
796 | 5.34M | u4_idx_B_chroma = MIN(51, u4_qp_chroma + 0); |
797 | | |
798 | | /* alpha, beta computation */ |
799 | 5.34M | u4_alpha_chroma = gu1_ih264_alpha_table[u4_idx_A_chroma]; |
800 | 5.34M | u4_beta_chroma = gu1_ih264_beta_table[u4_idx_B_chroma]; |
801 | | |
802 | | /* Deblock vertical edges */ |
803 | | /* left vertical edge 0 - allowed to be deblocked ? */ |
804 | 5.34M | if (u1_mb_a) |
805 | 5.23M | { |
806 | 5.23M | ih264e_filter_left_edge(ps_codec, ps_proc, pu1_pic_qp, pu1_cur_pic_luma, pu1_cur_pic_chroma, pu4_pic_vert_bs); |
807 | 5.23M | } |
808 | | |
809 | | /* vertical edge 1 */ |
810 | 5.34M | if (pu4_pic_vert_bs[1] == 0x04040404) |
811 | 0 | { |
812 | | /* strong filter */ |
813 | 0 | ps_codec->pf_deblk_luma_vert_bs4(pu1_cur_pic_luma + 4, i4_rec_strd, u4_alpha_luma, u4_beta_luma); |
814 | 0 | } |
815 | 5.34M | else |
816 | 5.34M | { |
817 | | /* normal filter */ |
818 | 5.34M | ps_codec->pf_deblk_luma_vert_bslt4(pu1_cur_pic_luma + 4, i4_rec_strd, |
819 | 5.34M | u4_alpha_luma, u4_beta_luma, |
820 | 5.34M | pu4_pic_vert_bs[1], |
821 | 5.34M | gu1_ih264_clip_table[u4_idx_A_luma]); |
822 | 5.34M | } |
823 | | |
824 | | /* vertical edge 2 */ |
825 | 5.34M | if (pu4_pic_vert_bs[2] == 0x04040404) |
826 | 0 | { |
827 | | /* strong filter */ |
828 | 0 | ps_codec->pf_deblk_luma_vert_bs4(pu1_cur_pic_luma + 8, i4_rec_strd, u4_alpha_luma, u4_beta_luma); |
829 | 0 | ps_codec->pf_deblk_chroma_vert_bs4(pu1_cur_pic_chroma + 8, i4_rec_strd, u4_alpha_chroma, u4_beta_chroma, u4_alpha_chroma, u4_beta_chroma); |
830 | 0 | } |
831 | 5.34M | else |
832 | 5.34M | { |
833 | | /* normal filter */ |
834 | 5.34M | ps_codec->pf_deblk_luma_vert_bslt4(pu1_cur_pic_luma + 8, i4_rec_strd, u4_alpha_luma, |
835 | 5.34M | u4_beta_luma, pu4_pic_vert_bs[2], |
836 | 5.34M | gu1_ih264_clip_table[u4_idx_A_luma]); |
837 | | |
838 | 5.34M | ps_codec->pf_deblk_chroma_vert_bslt4(pu1_cur_pic_chroma + 8, i4_rec_strd, u4_alpha_chroma, |
839 | 5.34M | u4_beta_chroma, u4_alpha_chroma, u4_beta_chroma, pu4_pic_vert_bs[2], |
840 | 5.34M | gu1_ih264_clip_table[u4_idx_A_chroma], gu1_ih264_clip_table[u4_idx_A_chroma]); |
841 | 5.34M | } |
842 | | |
843 | | /* vertical edge 3 */ |
844 | 5.34M | if (pu4_pic_vert_bs[3] == 0x04040404) |
845 | 0 | { |
846 | | /* strong filter */ |
847 | 0 | ps_codec->pf_deblk_luma_vert_bs4(pu1_cur_pic_luma + 12, i4_rec_strd, u4_alpha_luma, u4_beta_luma); |
848 | 0 | } |
849 | 5.34M | else |
850 | 5.34M | { |
851 | | /* normal filter */ |
852 | 5.34M | ps_codec->pf_deblk_luma_vert_bslt4(pu1_cur_pic_luma + 12, i4_rec_strd, u4_alpha_luma, |
853 | 5.34M | u4_beta_luma, pu4_pic_vert_bs[3], |
854 | 5.34M | gu1_ih264_clip_table[u4_idx_A_luma]); |
855 | 5.34M | } |
856 | | |
857 | | /* Deblock Horizontal edges */ |
858 | | /* Horizontal edge 0 */ |
859 | 5.34M | if (u1_mb_b) |
860 | 5.23M | { |
861 | 5.23M | ih264e_filter_top_edge(ps_codec, ps_proc, pu1_pic_qp, pu1_cur_pic_luma, pu1_cur_pic_chroma, pu4_pic_horz_bs); |
862 | 5.23M | } |
863 | | |
864 | | /* horizontal edge 1 */ |
865 | 5.34M | if (pu4_pic_horz_bs[1] == 0x04040404) |
866 | 0 | { |
867 | | /* strong filter */ |
868 | 0 | ps_codec->pf_deblk_luma_horz_bs4(pu1_cur_pic_luma + 4 * i4_rec_strd, i4_rec_strd, u4_alpha_luma, u4_beta_luma); |
869 | 0 | } |
870 | 5.34M | else |
871 | 5.34M | { |
872 | | /* normal filter */ |
873 | 5.34M | ps_codec->pf_deblk_luma_horz_bslt4(pu1_cur_pic_luma + 4 * i4_rec_strd, i4_rec_strd, u4_alpha_luma, |
874 | 5.34M | u4_beta_luma, pu4_pic_horz_bs[1], |
875 | 5.34M | gu1_ih264_clip_table[u4_idx_A_luma]); |
876 | 5.34M | } |
877 | | |
878 | | /* horizontal edge 2 */ |
879 | 5.34M | if (pu4_pic_horz_bs[2] == 0x04040404) |
880 | 0 | { |
881 | | /* strong filter */ |
882 | 0 | ps_codec->pf_deblk_luma_horz_bs4(pu1_cur_pic_luma + 8 * i4_rec_strd, i4_rec_strd, u4_alpha_luma, u4_beta_luma); |
883 | 0 | ps_codec->pf_deblk_chroma_horz_bs4(pu1_cur_pic_chroma + 4 * i4_rec_strd, i4_rec_strd, u4_alpha_chroma, u4_beta_chroma, u4_alpha_chroma, u4_beta_chroma); |
884 | 0 | } |
885 | 5.34M | else |
886 | 5.34M | { |
887 | | /* normal filter */ |
888 | 5.34M | ps_codec->pf_deblk_luma_horz_bslt4(pu1_cur_pic_luma + 8 * i4_rec_strd, i4_rec_strd, u4_alpha_luma, |
889 | 5.34M | u4_beta_luma, pu4_pic_horz_bs[2], |
890 | 5.34M | gu1_ih264_clip_table[u4_idx_A_luma]); |
891 | | |
892 | 5.34M | ps_codec->pf_deblk_chroma_horz_bslt4(pu1_cur_pic_chroma + 4 * i4_rec_strd, i4_rec_strd, u4_alpha_chroma, |
893 | 5.34M | u4_beta_chroma, u4_alpha_chroma, u4_beta_chroma, pu4_pic_horz_bs[2], |
894 | 5.34M | gu1_ih264_clip_table[u4_idx_A_chroma], gu1_ih264_clip_table[u4_idx_A_chroma]); |
895 | 5.34M | } |
896 | | |
897 | | /* horizontal edge 3 */ |
898 | 5.34M | if (pu4_pic_horz_bs[3] == 0x04040404) |
899 | 0 | { |
900 | | /* strong filter */ |
901 | 0 | ps_codec->pf_deblk_luma_horz_bs4(pu1_cur_pic_luma + 12 * i4_rec_strd, i4_rec_strd, u4_alpha_luma, u4_beta_luma); |
902 | 0 | } |
903 | 5.34M | else |
904 | 5.34M | { |
905 | | /* normal filter */ |
906 | 5.34M | ps_codec->pf_deblk_luma_horz_bslt4(pu1_cur_pic_luma + 12 * i4_rec_strd, i4_rec_strd, u4_alpha_luma, |
907 | 5.34M | u4_beta_luma, pu4_pic_horz_bs[3], |
908 | 5.34M | gu1_ih264_clip_table[u4_idx_A_luma]); |
909 | 5.34M | } |
910 | | |
911 | 5.34M | return ; |
912 | 5.34M | } |