/src/libavc/decoder/ih264d_compute_bs.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 | | #include "ih264_typedefs.h" |
22 | | #include "ih264_macros.h" |
23 | | #include "ih264_platform_macros.h" |
24 | | #include "ih264d_structs.h" |
25 | | #include "ih264d_defs.h" |
26 | | #include "ih264d_deblocking.h" |
27 | | #include "string.h" |
28 | | #include "ih264d_debug.h" |
29 | | #include "ih264d_tables.h" |
30 | | |
31 | | UWORD16 ih264d_update_csbp_8x8(UWORD16 u2_luma_csbp) |
32 | 1.83M | { |
33 | 1.83M | UWORD16 u2_mod_csbp; |
34 | | |
35 | 1.83M | u2_mod_csbp = u2_luma_csbp; |
36 | | |
37 | 1.83M | if(u2_mod_csbp & 0x0033) |
38 | 263k | { |
39 | 263k | u2_mod_csbp |= 0x0033; |
40 | 263k | } |
41 | | |
42 | 1.83M | if(u2_mod_csbp & 0x00CC) |
43 | 250k | { |
44 | 250k | u2_mod_csbp |= 0x00CC; |
45 | 250k | } |
46 | | |
47 | 1.83M | if(u2_mod_csbp & 0x3300) |
48 | 256k | { |
49 | 256k | u2_mod_csbp |= 0x3300; |
50 | 256k | } |
51 | | |
52 | 1.83M | if(u2_mod_csbp & 0xCC00) |
53 | 252k | { |
54 | 252k | u2_mod_csbp |= 0xCC00; |
55 | 252k | } |
56 | | |
57 | 1.83M | return u2_mod_csbp; |
58 | 1.83M | } |
59 | | |
60 | | /*****************************************************************************/ |
61 | | /* */ |
62 | | /* Function Name : ih264d_fill_bs2_horz_vert */ |
63 | | /* */ |
64 | | /* Description : This function fills boundray strength (=2) for all horz */ |
65 | | /* and vert edges of current mb based on coded sub block */ |
66 | | /* pattern of current, top and left mb */ |
67 | | /* Inputs : */ |
68 | | /* pu4_bs : Base pointer of BS table which gets updated */ |
69 | | /* u4_left_mb_csbp : left mb's coded sub block pattern */ |
70 | | /* u4_top_mb_csbp : top mb's coded sub block pattern */ |
71 | | /* u4_cur_mb_csbp : current mb's coded sub block pattern */ |
72 | | /* */ |
73 | | /* Globals : <Does it use any global variables?> */ |
74 | | /* Processing : */ |
75 | | /* */ |
76 | | /* csbp for each 4x4 block in a mb is bit packet in reverse */ |
77 | | /* raster scan order for each mb as shown below: */ |
78 | | /* 15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0. */ |
79 | | /* */ |
80 | | /* BS=2 for a 4x4 edge if any of adjacent blocks forming edge */ |
81 | | /* are coded. Keeping this in mind, bs=2 for all horz and vert */ |
82 | | /* edges can be derived using a lookup table for each edge */ |
83 | | /* after "ORing" the csbp values as follows: */ |
84 | | /* (C means current Mb, T means top mb and L means left mb) */ |
85 | | /* */ |
86 | | /* All Horz edges: */ |
87 | | /* 15C|14C|13C|12C|11C|10C|9C|8C|7C|6C|5C|4C|3C |2C |1C |0C */ |
88 | | /* (or with) 11C|10C| 9C| 8C| 7C|6C |5C|4C|3C|2C|1C|0C|15T|14T|13T|12T */ |
89 | | /* -----BS[3]-----|----BS[2]----|---BS[1]---|----BS[0]-----| */ |
90 | | /* */ |
91 | | /* All Vert edges: */ |
92 | | /* 15C|14C|13C|12C|11C|10C|9C| 8C|7C|6C|5C|4C|3C |2C |1C |0C */ |
93 | | /* (or with) 14C|13C|12C|15L|10C| 9C|8C|11L|6C|5C|4C|7L|2C |1C |0C |3L */ |
94 | | /* Do 4x4 transpose of resulting pattern to get vertBS[4]-BS[7] */ |
95 | | /* */ |
96 | | /* Outputs : <What does the function produce?> */ |
97 | | /* Returns : <What does the function return?> */ |
98 | | /* */ |
99 | | /* Issues : <List any issues or problems with this function> */ |
100 | | /* */ |
101 | | /* Revision History: */ |
102 | | /* */ |
103 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
104 | | /* 16 10 2008 Jay Draft */ |
105 | | /* */ |
106 | | /*****************************************************************************/ |
107 | 14.3M | #define CSBP_LEFT_BLOCK_MASK 0x1111 |
108 | 14.3M | #define CSBP_RIGHT_BLOCK_MASK 0x8888 |
109 | | |
110 | | void ih264d_fill_bs2_horz_vert(UWORD32 *pu4_bs, /* Base pointer of BS table */ |
111 | | WORD32 u4_left_mb_csbp, /* csbp of left mb */ |
112 | | WORD32 u4_top_mb_csbp, /* csbp of top mb */ |
113 | | WORD32 u4_cur_mb_csbp, /* csbp of current mb */ |
114 | | const UWORD32 *pu4_packed_bs2, const UWORD16 *pu2_4x4_v2h_reorder) |
115 | 14.3M | { |
116 | | /*************************************************************************/ |
117 | | /*u4_nbr_horz_csbp=11C|10C|9C|8C|7C|6C|5C|4C|3C|2C|1C|0C|15T|14T|13T|12T */ |
118 | | /*************************************************************************/ |
119 | 14.3M | UWORD32 u4_nbr_horz_csbp = (u4_cur_mb_csbp << 4) | (u4_top_mb_csbp >> 12); |
120 | 14.3M | UWORD32 u4_horz_bs2_dec = u4_cur_mb_csbp | u4_nbr_horz_csbp; |
121 | | |
122 | | /*************************************************************************/ |
123 | | /*u4_left_mb_masked_csbp = 15L|0|0|0|11L|0|0|0|7L|0|0|0|3L|0|0|0 */ |
124 | | /*************************************************************************/ |
125 | 14.3M | UWORD32 u4_left_mb_masked_csbp = u4_left_mb_csbp & CSBP_RIGHT_BLOCK_MASK; |
126 | | |
127 | | /*************************************************************************/ |
128 | | /*u4_cur_mb_masked_csbp =14C|13C|12C|x|10C|9C|8C|x|6C|5C|4C|x|2C|1C|0C|x */ |
129 | | /*************************************************************************/ |
130 | 14.3M | UWORD32 u4_cur_mb_masked_csbp = (u4_cur_mb_csbp << 1) |
131 | 14.3M | & (~CSBP_LEFT_BLOCK_MASK); |
132 | | |
133 | | /*************************************************************************/ |
134 | | /*u4_nbr_vert_csbp=14C|13C|12C|15L|10C|9C|8C|11L|6C|5C|4C|7L|2C|1C|0C|3L */ |
135 | | /*************************************************************************/ |
136 | 14.3M | UWORD32 u4_nbr_vert_csbp = (u4_cur_mb_masked_csbp) |
137 | 14.3M | | (u4_left_mb_masked_csbp >> 3); |
138 | | |
139 | 14.3M | UWORD32 u4_vert_bs2_dec = u4_cur_mb_csbp | u4_nbr_vert_csbp; |
140 | | |
141 | 14.3M | UWORD32 u4_reordered_vert_bs2_dec, u4_temp; |
142 | | |
143 | 14.3M | PROFILE_DISABLE_BOUNDARY_STRENGTH() |
144 | | |
145 | | /*************************************************************************/ |
146 | | /* Fill horz edges (0,1,2,3) boundary strengths 2 using look up table */ |
147 | | /*************************************************************************/ |
148 | 14.3M | pu4_bs[0] = pu4_packed_bs2[u4_horz_bs2_dec & 0xF]; |
149 | 14.3M | pu4_bs[1] = pu4_packed_bs2[(u4_horz_bs2_dec >> 4) & 0xF]; |
150 | 14.3M | pu4_bs[2] = pu4_packed_bs2[(u4_horz_bs2_dec >> 8) & 0xF]; |
151 | 14.3M | pu4_bs[3] = pu4_packed_bs2[(u4_horz_bs2_dec >> 12) & 0xF]; |
152 | | |
153 | | /*************************************************************************/ |
154 | | /* Do 4x4 tranpose of u4_vert_bs2_dec by using look up table for reorder */ |
155 | | /*************************************************************************/ |
156 | 14.3M | u4_reordered_vert_bs2_dec = pu2_4x4_v2h_reorder[u4_vert_bs2_dec & 0xF]; |
157 | 14.3M | u4_temp = pu2_4x4_v2h_reorder[(u4_vert_bs2_dec >> 4) & 0xF]; |
158 | 14.3M | u4_reordered_vert_bs2_dec |= (u4_temp << 1); |
159 | 14.3M | u4_temp = pu2_4x4_v2h_reorder[(u4_vert_bs2_dec >> 8) & 0xF]; |
160 | 14.3M | u4_reordered_vert_bs2_dec |= (u4_temp << 2); |
161 | 14.3M | u4_temp = pu2_4x4_v2h_reorder[(u4_vert_bs2_dec >> 12) & 0xF]; |
162 | 14.3M | u4_reordered_vert_bs2_dec |= (u4_temp << 3); |
163 | | |
164 | | /*************************************************************************/ |
165 | | /* Fill vert edges (4,5,6,7) boundary strengths 2 using look up table */ |
166 | | /*************************************************************************/ |
167 | 14.3M | pu4_bs[4] = pu4_packed_bs2[u4_reordered_vert_bs2_dec & 0xF]; |
168 | 14.3M | pu4_bs[5] = pu4_packed_bs2[(u4_reordered_vert_bs2_dec >> 4) & 0xF]; |
169 | 14.3M | pu4_bs[6] = pu4_packed_bs2[(u4_reordered_vert_bs2_dec >> 8) & 0xF]; |
170 | 14.3M | pu4_bs[7] = pu4_packed_bs2[(u4_reordered_vert_bs2_dec >> 12) & 0xF]; |
171 | 14.3M | } |
172 | | |
173 | | /*****************************************************************************/ |
174 | | /* */ |
175 | | /* Function Name : ih264d_fill_bs1_16x16mb_pslice */ |
176 | | /* */ |
177 | | /* Description : This function fills boundray strength (=1) for those */ |
178 | | /* horz and vert mb edges of 16x16mb which are set to 0 by */ |
179 | | /* ih264d_fill_bs2_horz_vert. This function is used for p slices */ |
180 | | /* */ |
181 | | /* Inputs : <What inputs does the function take?> */ |
182 | | /* Globals : <Does it use any global variables?> */ |
183 | | /* Processing : If any motion vector component of adjacent 4x4 blocks */ |
184 | | /* differs by more than 1 integer pel or if reference */ |
185 | | /* pictures are different, Bs is set to 1. */ |
186 | | /* */ |
187 | | /* Outputs : <What does the function produce?> */ |
188 | | /* Returns : <What does the function return?> */ |
189 | | /* */ |
190 | | /* Issues : <List any issues or problems with this function> */ |
191 | | /* */ |
192 | | /* Revision History: */ |
193 | | /* */ |
194 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
195 | | /* 16 10 2008 Jay Draft */ |
196 | | /* */ |
197 | | /*****************************************************************************/ |
198 | | void ih264d_fill_bs1_16x16mb_pslice(mv_pred_t *ps_cur_mv_pred, |
199 | | mv_pred_t *ps_top_mv_pred, |
200 | | void **ppv_map_ref_idx_to_poc, |
201 | | UWORD32 *pu4_bs_table, /* pointer to the BsTable array */ |
202 | | mv_pred_t *ps_leftmost_mv_pred, |
203 | | neighbouradd_t *ps_left_addr, |
204 | | void **u4_pic_addrress, /* picture address for BS calc */ |
205 | | WORD32 i4_ver_mvlimit) |
206 | 9.33M | { |
207 | 9.33M | WORD16 i2_q_mv0, i2_q_mv1; |
208 | 9.33M | WORD16 i2_p_mv0, i2_p_mv1; |
209 | 9.33M | void *pv_cur_pic_addr0, *pv_cur_pic_addr1; |
210 | 9.33M | void *pv_nbr_pic_addr0, *pv_nbr_pic_addr1; |
211 | 9.33M | void **ppv_map_ref_idx_to_poc_l0; //,*ppv_map_ref_idx_to_poc_l1; |
212 | 9.33M | UWORD32 i; |
213 | 9.33M | UWORD32 u4_bs_horz = pu4_bs_table[0]; |
214 | 9.33M | UWORD32 u4_bs_vert = pu4_bs_table[4]; |
215 | | |
216 | 9.33M | PROFILE_DISABLE_BOUNDARY_STRENGTH() |
217 | | |
218 | 9.33M | ppv_map_ref_idx_to_poc_l0 = ppv_map_ref_idx_to_poc; |
219 | | |
220 | 9.33M | i2_q_mv0 = ps_cur_mv_pred->i2_mv[0]; |
221 | 9.33M | i2_q_mv1 = ps_cur_mv_pred->i2_mv[1]; |
222 | 9.33M | pv_cur_pic_addr0 = ppv_map_ref_idx_to_poc_l0[ps_cur_mv_pred->i1_ref_frame[0]]; |
223 | 9.33M | pv_cur_pic_addr1 = 0; |
224 | | |
225 | | /*********************************/ |
226 | | /* Computing Bs for the top edge */ |
227 | | /*********************************/ |
228 | 46.6M | for(i = 0; i < 4; i++, ps_top_mv_pred++) |
229 | 37.3M | { |
230 | 37.3M | UWORD32 u4_idx = 24 - (i << 3); |
231 | | |
232 | | /*********************************/ |
233 | | /* check if Bs is already set */ |
234 | | /*********************************/ |
235 | 37.3M | if(!((u4_bs_horz >> u4_idx) & 0xf)) |
236 | 36.8M | { |
237 | | /************************************************************/ |
238 | | /* If Bs is not set, use left edge and current edge mvs and */ |
239 | | /* reference pictures addresses to evaluate Bs==1 */ |
240 | | /************************************************************/ |
241 | 36.8M | UWORD32 u4_bs_temp1; |
242 | 36.8M | UWORD32 u4_bs; |
243 | | |
244 | | /*********************************************************/ |
245 | | /* If any motion vector component differs by more than 1 */ |
246 | | /* integer pel or if reference pictures are different Bs */ |
247 | | /* is set to 1. Note that this condition shall be met for*/ |
248 | | /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/ |
249 | | /*********************************************************/ |
250 | 36.8M | i2_p_mv0 = ps_top_mv_pred->i2_mv[0]; |
251 | 36.8M | i2_p_mv1 = ps_top_mv_pred->i2_mv[1]; |
252 | 36.8M | pv_nbr_pic_addr0 = u4_pic_addrress[i & 2]; |
253 | 36.8M | pv_nbr_pic_addr1 = u4_pic_addrress[1 + (i & 2)]; |
254 | | |
255 | 36.8M | u4_bs_temp1 = ((ABS((i2_p_mv0 - i2_q_mv0)) >= 4) || |
256 | 36.8M | (ABS((i2_p_mv1 - i2_q_mv1)) >= i4_ver_mvlimit)); |
257 | | |
258 | 36.8M | u4_bs = ((pv_cur_pic_addr0 != pv_nbr_pic_addr0) |
259 | 36.8M | || (pv_cur_pic_addr1 != pv_nbr_pic_addr1) |
260 | 36.8M | || u4_bs_temp1); |
261 | | |
262 | 36.8M | u4_bs_horz |= (u4_bs << u4_idx); |
263 | 36.8M | } |
264 | 37.3M | } |
265 | 9.33M | pu4_bs_table[0] = u4_bs_horz; |
266 | | |
267 | | /***********************************/ |
268 | | /* Computing Bs for the left edge */ |
269 | | /***********************************/ |
270 | 46.6M | for(i = 0; i < 4; i++, ps_leftmost_mv_pred += 4) |
271 | 37.3M | { |
272 | 37.3M | UWORD32 u4_idx = 24 - (i << 3); |
273 | | |
274 | | /*********************************/ |
275 | | /* check if Bs is already set */ |
276 | | /*********************************/ |
277 | 37.3M | if(!((u4_bs_vert >> u4_idx) & 0xf)) |
278 | 37.0M | { |
279 | | /****************************************************/ |
280 | | /* If Bs is not set, evalaute conditions for Bs=1 */ |
281 | | /****************************************************/ |
282 | 37.0M | UWORD32 u4_bs_temp1; |
283 | 37.0M | UWORD32 u4_bs; |
284 | | /*********************************************************/ |
285 | | /* If any motion vector component differs by more than 1 */ |
286 | | /* integer pel or if reference pictures are different Bs */ |
287 | | /* is set to 1. Note that this condition shall be met for*/ |
288 | | /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/ |
289 | | /*********************************************************/ |
290 | | |
291 | 37.0M | i2_p_mv0 = ps_leftmost_mv_pred->i2_mv[0]; |
292 | 37.0M | i2_p_mv1 = ps_leftmost_mv_pred->i2_mv[1]; |
293 | 37.0M | pv_nbr_pic_addr0 = ps_left_addr->u4_add[i & 2]; |
294 | 37.0M | pv_nbr_pic_addr1 = ps_left_addr->u4_add[1 + (i & 2)]; |
295 | | |
296 | 37.0M | u4_bs_temp1 = |
297 | 37.0M | ((ABS((i2_p_mv0 - i2_q_mv0)) |
298 | 37.0M | >= 4) |
299 | 37.0M | | (ABS((i2_p_mv1 - i2_q_mv1)) |
300 | 37.0M | >= i4_ver_mvlimit)); |
301 | | |
302 | 37.0M | u4_bs = ((pv_cur_pic_addr0 != pv_nbr_pic_addr0) |
303 | 37.0M | || (pv_cur_pic_addr1 != pv_nbr_pic_addr1) |
304 | 37.0M | || u4_bs_temp1); |
305 | | |
306 | 37.0M | u4_bs_vert |= (u4_bs << u4_idx); |
307 | 37.0M | } |
308 | 37.3M | } |
309 | 9.33M | pu4_bs_table[4] = u4_bs_vert; |
310 | | |
311 | 9.33M | return; |
312 | 9.33M | } |
313 | | |
314 | | /*****************************************************************************/ |
315 | | /* */ |
316 | | /* Function Name : ih264d_fill_bs1_non16x16mb_pslice */ |
317 | | /* */ |
318 | | /* Description : This function fills boundray strength (=1) for those */ |
319 | | /* horz and vert edges of non16x16mb which are set to 0 by */ |
320 | | /* ih264d_fill_bs2_horz_vert. This function is used for p slices */ |
321 | | /* */ |
322 | | /* Inputs : <What inputs does the function take?> */ |
323 | | /* Globals : <Does it use any global variables?> */ |
324 | | /* Processing : If any motion vector component of adjacent 4x4 blocks */ |
325 | | /* differs by more than 1 integer pel or if reference */ |
326 | | /* pictures are different, Bs is set to 1. */ |
327 | | /* */ |
328 | | /* Outputs : <What does the function produce?> */ |
329 | | /* Returns : <What does the function return?> */ |
330 | | /* */ |
331 | | /* Issues : <List any issues or problems with this function> */ |
332 | | /* */ |
333 | | /* Revision History: */ |
334 | | /* */ |
335 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
336 | | /* 16 10 2008 Jay Draft */ |
337 | | /* */ |
338 | | /*****************************************************************************/ |
339 | | void ih264d_fill_bs1_non16x16mb_pslice(mv_pred_t *ps_cur_mv_pred, |
340 | | mv_pred_t *ps_top_mv_pred, |
341 | | void **ppv_map_ref_idx_to_poc, |
342 | | UWORD32 *pu4_bs_table, /* pointer to the BsTable array */ |
343 | | mv_pred_t *ps_leftmost_mv_pred, |
344 | | neighbouradd_t *ps_left_addr, |
345 | | void **u4_pic_addrress, |
346 | | WORD32 i4_ver_mvlimit) |
347 | 257k | { |
348 | 257k | UWORD32 edge; |
349 | 257k | void **ppv_map_ref_idx_to_poc_l0; //,*ppv_map_ref_idx_to_poc_l1; |
350 | | |
351 | 257k | PROFILE_DISABLE_BOUNDARY_STRENGTH() |
352 | | |
353 | 257k | ppv_map_ref_idx_to_poc_l0 = ppv_map_ref_idx_to_poc; |
354 | | |
355 | | |
356 | 1.28M | for(edge = 0; edge < 4; edge++, ps_top_mv_pred = ps_cur_mv_pred - 4) |
357 | 1.02M | { |
358 | | /*********************************************************************/ |
359 | | /* Each iteration of this loop fills the four BS values of one HORIZ */ |
360 | | /* edge and one BS value for each of the four VERT edges. */ |
361 | | /*********************************************************************/ |
362 | 1.02M | WORD32 i; |
363 | 1.02M | UWORD32 u4_vert_idx = 24 - (edge << 3); |
364 | 1.02M | UWORD32 u4_bs_horz = pu4_bs_table[edge]; |
365 | 1.02M | mv_pred_t *ps_left_mv_pred = ps_leftmost_mv_pred + (edge << 2); |
366 | | |
367 | 5.14M | for(i = 0; i < 4; i++, ps_top_mv_pred++, ps_cur_mv_pred++) |
368 | 4.11M | { |
369 | 4.11M | WORD16 i2_cur_mv0, i2_cur_mv1; |
370 | 4.11M | WORD8 i1_cur_ref0; |
371 | 4.11M | void *pv_cur_pic_addr0, *pv_cur_pic_addr1 = 0; |
372 | 4.11M | void *pv_nbr_pic_addr0, *pv_nbr_pic_addr1; |
373 | | |
374 | | /******************************************************/ |
375 | | /* Each iteration of this inner loop computes a HORIZ */ |
376 | | /* and a VERT BS value for a 4x4 block */ |
377 | | /******************************************************/ |
378 | 4.11M | UWORD32 u4_bs_vert = (pu4_bs_table[i + 4] >> u4_vert_idx) & 0xf; |
379 | 4.11M | UWORD32 u4_horz_idx = 24 - (i << 3); |
380 | | |
381 | | /*****************************************************/ |
382 | | /* check if vert Bs for this block is already set */ |
383 | | /*****************************************************/ |
384 | 4.11M | if(!u4_bs_vert) |
385 | 3.13M | { |
386 | 3.13M | WORD16 i2_left_mv0, i2_left_mv1; |
387 | | /************************************************************/ |
388 | | /* If Bs is not set, use left edge and current edge mvs and */ |
389 | | /* reference pictures addresses to evaluate Bs==1 */ |
390 | | /************************************************************/ |
391 | 3.13M | i2_left_mv0 = ps_left_mv_pred->i2_mv[0]; |
392 | 3.13M | i2_left_mv1 = ps_left_mv_pred->i2_mv[1]; |
393 | | |
394 | 3.13M | i2_cur_mv0 = ps_cur_mv_pred->i2_mv[0]; |
395 | 3.13M | i2_cur_mv1 = ps_cur_mv_pred->i2_mv[1]; |
396 | | |
397 | 3.13M | i1_cur_ref0 = ps_cur_mv_pred->i1_ref_frame[0]; |
398 | | |
399 | 3.13M | pv_cur_pic_addr0 = ppv_map_ref_idx_to_poc_l0[i1_cur_ref0]; |
400 | 3.13M | if(i) |
401 | 2.40M | { |
402 | 2.40M | WORD8 i1_left_ref0 = ps_left_mv_pred->i1_ref_frame[0]; |
403 | 2.40M | pv_nbr_pic_addr0 = ppv_map_ref_idx_to_poc_l0[i1_left_ref0]; |
404 | 2.40M | pv_nbr_pic_addr1 = 0; |
405 | 2.40M | } |
406 | 731k | else |
407 | 731k | { |
408 | 731k | pv_nbr_pic_addr0 = ps_left_addr->u4_add[edge & 2]; |
409 | 731k | pv_nbr_pic_addr1 = ps_left_addr->u4_add[1 + (edge & 2)]; |
410 | 731k | } |
411 | | |
412 | 3.13M | { |
413 | 3.13M | UWORD32 u4_bs_temp1; |
414 | | /*********************************************************/ |
415 | | /* If any motion vector component differs by more than 1 */ |
416 | | /* integer pel or if reference pictures are different Bs */ |
417 | | /* is set to 1. Note that this condition shall be met for*/ |
418 | | /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/ |
419 | | /*********************************************************/ |
420 | | |
421 | 3.13M | u4_bs_temp1 = |
422 | 3.13M | ((ABS((i2_left_mv0 - i2_cur_mv0)) |
423 | 3.13M | >= 4) |
424 | 3.13M | | (ABS((i2_left_mv1 |
425 | 3.13M | - i2_cur_mv1)) |
426 | 3.13M | >= i4_ver_mvlimit)); |
427 | | |
428 | 3.13M | u4_bs_vert = ((pv_nbr_pic_addr0 != pv_cur_pic_addr0) |
429 | 3.13M | || (pv_nbr_pic_addr1 != pv_cur_pic_addr1) |
430 | 3.13M | || u4_bs_temp1); |
431 | | |
432 | 3.13M | pu4_bs_table[i + 4] |= (u4_bs_vert << u4_vert_idx); |
433 | 3.13M | } |
434 | 3.13M | } |
435 | | |
436 | | /*****************************************************/ |
437 | | /* check if horz Bs for this block is already set */ |
438 | | /*****************************************************/ |
439 | 4.11M | if(!((u4_bs_horz >> u4_horz_idx) & 0xf)) |
440 | 3.13M | { |
441 | 3.13M | WORD16 i2_top_mv0, i2_top_mv1; |
442 | | /************************************************************/ |
443 | | /* If Bs is not set, use top edge and current edge mvs and */ |
444 | | /* reference pictures addresses to evaluate Bs==1 */ |
445 | | /************************************************************/ |
446 | 3.13M | i2_cur_mv0 = ps_cur_mv_pred->i2_mv[0]; |
447 | 3.13M | i2_cur_mv1 = ps_cur_mv_pred->i2_mv[1]; |
448 | | |
449 | 3.13M | i1_cur_ref0 = ps_cur_mv_pred->i1_ref_frame[0]; |
450 | | |
451 | 3.13M | i2_top_mv0 = ps_top_mv_pred->i2_mv[0]; |
452 | 3.13M | i2_top_mv1 = ps_top_mv_pred->i2_mv[1]; |
453 | | |
454 | 3.13M | pv_cur_pic_addr0 = ppv_map_ref_idx_to_poc_l0[i1_cur_ref0]; |
455 | 3.13M | if(edge) |
456 | 2.39M | { |
457 | 2.39M | WORD8 i1_top_ref0 = ps_top_mv_pred->i1_ref_frame[0]; |
458 | 2.39M | pv_nbr_pic_addr0 = ppv_map_ref_idx_to_poc_l0[i1_top_ref0]; |
459 | 2.39M | pv_nbr_pic_addr1 = 0; |
460 | 2.39M | } |
461 | 739k | else |
462 | 739k | { |
463 | 739k | pv_nbr_pic_addr0 = u4_pic_addrress[i & 2]; |
464 | 739k | pv_nbr_pic_addr1 = u4_pic_addrress[1 + (i & 2)]; |
465 | 739k | } |
466 | | |
467 | 3.13M | { |
468 | 3.13M | UWORD32 u4_bs_temp1; |
469 | 3.13M | UWORD32 u4_bs; |
470 | | /*********************************************************/ |
471 | | /* If any motion vector component differs by more than 1 */ |
472 | | /* integer pel or if reference pictures are different Bs */ |
473 | | /* is set to 1. Note that this condition shall be met for*/ |
474 | | /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/ |
475 | | /*********************************************************/ |
476 | | |
477 | 3.13M | u4_bs_temp1 = |
478 | 3.13M | ((ABS((i2_top_mv0 - i2_cur_mv0)) |
479 | 3.13M | >= 4) |
480 | 3.13M | | (ABS((i2_top_mv1 |
481 | 3.13M | - i2_cur_mv1)) |
482 | 3.13M | >= i4_ver_mvlimit)); |
483 | | |
484 | 3.13M | u4_bs = ((pv_nbr_pic_addr0 != pv_cur_pic_addr0) |
485 | 3.13M | || (pv_nbr_pic_addr1 != pv_cur_pic_addr1) |
486 | 3.13M | || u4_bs_temp1); |
487 | | |
488 | 3.13M | u4_bs_horz |= (u4_bs << u4_horz_idx); |
489 | 3.13M | } |
490 | 3.13M | } |
491 | | |
492 | 4.11M | ps_left_mv_pred = ps_cur_mv_pred; |
493 | 4.11M | } |
494 | | |
495 | 1.02M | pu4_bs_table[edge] = u4_bs_horz; |
496 | 1.02M | } |
497 | 257k | } |
498 | | |
499 | | /*****************************************************************************/ |
500 | | /* */ |
501 | | /* Function Name : ih264d_fill_bs1_16x16mb_bslice */ |
502 | | /* */ |
503 | | /* Description : This function fills boundray strength (=1) for those */ |
504 | | /* horz and vert mb edges of 16x16mb which are set to 0 by */ |
505 | | /* ih264d_fill_bs2_horz_vert. This function is used for b slices */ |
506 | | /* */ |
507 | | /* Inputs : <What inputs does the function take?> */ |
508 | | /* Globals : <Does it use any global variables?> */ |
509 | | /* Processing : If any motion vector component of adjacent 4x4 blocks */ |
510 | | /* differs by more than 1 integer pel or if reference */ |
511 | | /* pictures are different, Bs is set to 1. */ |
512 | | /* */ |
513 | | /* Outputs : <What does the function produce?> */ |
514 | | /* Returns : <What does the function return?> */ |
515 | | /* */ |
516 | | /* Issues : <List any issues or problems with this function> */ |
517 | | /* */ |
518 | | /* Revision History: */ |
519 | | /* */ |
520 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
521 | | /* 16 10 2008 Jay Draft */ |
522 | | /* */ |
523 | | /*****************************************************************************/ |
524 | | void ih264d_fill_bs1_16x16mb_bslice(mv_pred_t *ps_cur_mv_pred, |
525 | | mv_pred_t *ps_top_mv_pred, |
526 | | void **ppv_map_ref_idx_to_poc, |
527 | | UWORD32 *pu4_bs_table, /* pointer to the BsTable array */ |
528 | | mv_pred_t *ps_leftmost_mv_pred, |
529 | | neighbouradd_t *ps_left_addr, |
530 | | void **u4_pic_addrress, |
531 | | WORD32 i4_ver_mvlimit) |
532 | 4.61M | { |
533 | 4.61M | WORD16 i2_q_mv0, i2_q_mv1, i2_q_mv2, i2_q_mv3; |
534 | 4.61M | WORD16 i2_p_mv0, i2_p_mv1, i2_p_mv2, i2_p_mv3; |
535 | 4.61M | void *pv_cur_pic_addr0, *pv_cur_pic_addr1; |
536 | 4.61M | void *pv_nbr_pic_addr0, *pv_nbr_pic_addr1; |
537 | 4.61M | void **ppv_map_ref_idx_to_poc_l0, **ppv_map_ref_idx_to_poc_l1; |
538 | 4.61M | UWORD32 i; |
539 | 4.61M | UWORD32 u4_bs_horz = pu4_bs_table[0]; |
540 | 4.61M | UWORD32 u4_bs_vert = pu4_bs_table[4]; |
541 | | |
542 | 4.61M | PROFILE_DISABLE_BOUNDARY_STRENGTH() |
543 | | |
544 | 4.61M | ppv_map_ref_idx_to_poc_l0 = ppv_map_ref_idx_to_poc; |
545 | 4.61M | ppv_map_ref_idx_to_poc_l1 = ppv_map_ref_idx_to_poc + POC_LIST_L0_TO_L1_DIFF; |
546 | 4.61M | i2_q_mv0 = ps_cur_mv_pred->i2_mv[0]; |
547 | 4.61M | i2_q_mv1 = ps_cur_mv_pred->i2_mv[1]; |
548 | 4.61M | i2_q_mv2 = ps_cur_mv_pred->i2_mv[2]; |
549 | 4.61M | i2_q_mv3 = ps_cur_mv_pred->i2_mv[3]; |
550 | 4.61M | pv_cur_pic_addr0 = ppv_map_ref_idx_to_poc_l0[ps_cur_mv_pred->i1_ref_frame[0]]; |
551 | 4.61M | pv_cur_pic_addr1 = ppv_map_ref_idx_to_poc_l1[ps_cur_mv_pred->i1_ref_frame[1]]; |
552 | | |
553 | | /*********************************/ |
554 | | /* Computing Bs for the top edge */ |
555 | | /*********************************/ |
556 | 23.0M | for(i = 0; i < 4; i++, ps_top_mv_pred++) |
557 | 18.4M | { |
558 | 18.4M | UWORD32 u4_idx = 24 - (i << 3); |
559 | | |
560 | | /*********************************/ |
561 | | /* check if Bs is already set */ |
562 | | /*********************************/ |
563 | 18.4M | if(!((u4_bs_horz >> u4_idx) & 0xf)) |
564 | 18.3M | { |
565 | | /************************************************************/ |
566 | | /* If Bs is not set, use left edge and current edge mvs and */ |
567 | | /* reference pictures addresses to evaluate Bs==1 */ |
568 | | /************************************************************/ |
569 | 18.3M | UWORD32 u4_bs_temp1, u4_bs_temp2; |
570 | 18.3M | UWORD32 u4_bs; |
571 | | |
572 | | /*********************************************************/ |
573 | | /* If any motion vector component differs by more than 1 */ |
574 | | /* integer pel or if reference pictures are different Bs */ |
575 | | /* is set to 1. Note that this condition shall be met for*/ |
576 | | /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/ |
577 | | /*********************************************************/ |
578 | 18.3M | i2_p_mv0 = ps_top_mv_pred->i2_mv[0]; |
579 | 18.3M | i2_p_mv1 = ps_top_mv_pred->i2_mv[1]; |
580 | 18.3M | i2_p_mv2 = ps_top_mv_pred->i2_mv[2]; |
581 | 18.3M | i2_p_mv3 = ps_top_mv_pred->i2_mv[3]; |
582 | 18.3M | pv_nbr_pic_addr0 = u4_pic_addrress[i & 2]; |
583 | 18.3M | pv_nbr_pic_addr1 = u4_pic_addrress[1 + (i & 2)]; |
584 | | |
585 | 18.3M | u4_bs_temp1 = |
586 | 18.3M | ((ABS((i2_p_mv0 - i2_q_mv0)) |
587 | 18.3M | >= 4) |
588 | 18.3M | | (ABS((i2_p_mv1 - i2_q_mv1)) |
589 | 18.3M | >= i4_ver_mvlimit) |
590 | 18.3M | | (ABS((i2_p_mv2 - i2_q_mv2)) |
591 | 18.3M | >= 4) |
592 | 18.3M | | (ABS((i2_p_mv3 - i2_q_mv3)) |
593 | 18.3M | >= i4_ver_mvlimit)); |
594 | | |
595 | 18.3M | u4_bs_temp2 = |
596 | 18.3M | ((ABS((i2_p_mv0 - i2_q_mv2)) |
597 | 18.3M | >= 4) |
598 | 18.3M | | (ABS((i2_p_mv1 - i2_q_mv3)) |
599 | 18.3M | >= i4_ver_mvlimit) |
600 | 18.3M | | (ABS((i2_p_mv2 - i2_q_mv0)) |
601 | 18.3M | >= 4) |
602 | 18.3M | | (ABS((i2_p_mv3 - i2_q_mv1)) |
603 | 18.3M | >= i4_ver_mvlimit)); |
604 | | |
605 | 18.3M | u4_bs = ((pv_cur_pic_addr0 != pv_nbr_pic_addr0) |
606 | 18.3M | || (pv_cur_pic_addr1 != pv_nbr_pic_addr1) |
607 | 18.3M | || u4_bs_temp1) |
608 | 18.3M | && ((pv_cur_pic_addr0 != pv_nbr_pic_addr1) |
609 | 1.44M | || (pv_cur_pic_addr1 |
610 | 489k | != pv_nbr_pic_addr0) |
611 | 1.44M | || u4_bs_temp2); |
612 | | |
613 | 18.3M | u4_bs_horz |= (u4_bs << u4_idx); |
614 | 18.3M | } |
615 | 18.4M | } |
616 | 4.61M | pu4_bs_table[0] = u4_bs_horz; |
617 | | |
618 | | /***********************************/ |
619 | | /* Computing Bs for the left edge */ |
620 | | /***********************************/ |
621 | 23.0M | for(i = 0; i < 4; i++, ps_leftmost_mv_pred += 4) |
622 | 18.4M | { |
623 | 18.4M | UWORD32 u4_idx = 24 - (i << 3); |
624 | | |
625 | | /*********************************/ |
626 | | /* check if Bs is already set */ |
627 | | /*********************************/ |
628 | 18.4M | if(!((u4_bs_vert >> u4_idx) & 0xf)) |
629 | 18.3M | { |
630 | | /****************************************************/ |
631 | | /* If Bs is not set, evalaute conditions for Bs=1 */ |
632 | | /****************************************************/ |
633 | 18.3M | UWORD32 u4_bs_temp1, u4_bs_temp2; |
634 | 18.3M | UWORD32 u4_bs; |
635 | | /*********************************************************/ |
636 | | /* If any motion vector component differs by more than 1 */ |
637 | | /* integer pel or if reference pictures are different Bs */ |
638 | | /* is set to 1. Note that this condition shall be met for*/ |
639 | | /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/ |
640 | | /*********************************************************/ |
641 | | |
642 | 18.3M | i2_p_mv0 = ps_leftmost_mv_pred->i2_mv[0]; |
643 | 18.3M | i2_p_mv1 = ps_leftmost_mv_pred->i2_mv[1]; |
644 | 18.3M | i2_p_mv2 = ps_leftmost_mv_pred->i2_mv[2]; |
645 | 18.3M | i2_p_mv3 = ps_leftmost_mv_pred->i2_mv[3]; |
646 | 18.3M | pv_nbr_pic_addr0 = ps_left_addr->u4_add[i & 2]; |
647 | 18.3M | pv_nbr_pic_addr1 = ps_left_addr->u4_add[1 + (i & 2)]; |
648 | | |
649 | 18.3M | u4_bs_temp1 = |
650 | 18.3M | ((ABS((i2_p_mv0 - i2_q_mv0)) |
651 | 18.3M | >= 4) |
652 | 18.3M | | (ABS((i2_p_mv1 - i2_q_mv1)) |
653 | 18.3M | >= i4_ver_mvlimit) |
654 | 18.3M | | (ABS((i2_p_mv2 - i2_q_mv2)) |
655 | 18.3M | >= 4) |
656 | 18.3M | | (ABS((i2_p_mv3 - i2_q_mv3)) |
657 | 18.3M | >= i4_ver_mvlimit)); |
658 | | |
659 | 18.3M | u4_bs_temp2 = |
660 | 18.3M | ((ABS((i2_p_mv0 - i2_q_mv2)) |
661 | 18.3M | >= 4) |
662 | 18.3M | | (ABS((i2_p_mv1 - i2_q_mv3)) |
663 | 18.3M | >= i4_ver_mvlimit) |
664 | 18.3M | | (ABS((i2_p_mv2 - i2_q_mv0)) |
665 | 18.3M | >= 4) |
666 | 18.3M | | (ABS((i2_p_mv3 - i2_q_mv1)) |
667 | 18.3M | >= i4_ver_mvlimit)); |
668 | | |
669 | 18.3M | u4_bs = ((pv_cur_pic_addr0 != pv_nbr_pic_addr0) |
670 | 18.3M | || (pv_cur_pic_addr1 != pv_nbr_pic_addr1) |
671 | 18.3M | || u4_bs_temp1) |
672 | 18.3M | && ((pv_cur_pic_addr0 != pv_nbr_pic_addr1) |
673 | 715k | || (pv_cur_pic_addr1 |
674 | 273k | != pv_nbr_pic_addr0) |
675 | 715k | || u4_bs_temp2); |
676 | | |
677 | 18.3M | u4_bs_vert |= (u4_bs << u4_idx); |
678 | 18.3M | } |
679 | 18.4M | } |
680 | 4.61M | pu4_bs_table[4] = u4_bs_vert; |
681 | | |
682 | 4.61M | return; |
683 | 4.61M | } |
684 | | |
685 | | /*****************************************************************************/ |
686 | | /* */ |
687 | | /* Function Name : ih264d_fill_bs1_non16x16mb_bslice */ |
688 | | /* */ |
689 | | /* Description : This function fills boundray strength (=1) for those */ |
690 | | /* horz and vert edges of non16x16mb which are set to 0 by */ |
691 | | /* ih264d_fill_bs2_horz_vert. This function is used for b slices */ |
692 | | /* */ |
693 | | /* Inputs : <What inputs does the function take?> */ |
694 | | /* Globals : <Does it use any global variables?> */ |
695 | | /* Processing : If any motion vector component of adjacent 4x4 blocks */ |
696 | | /* differs by more than 1 integer pel or if reference */ |
697 | | /* pictures are different, Bs is set to 1. */ |
698 | | /* */ |
699 | | /* Outputs : <What does the function produce?> */ |
700 | | /* Returns : <What does the function return?> */ |
701 | | /* */ |
702 | | /* Issues : <List any issues or problems with this function> */ |
703 | | /* */ |
704 | | /* Revision History: */ |
705 | | /* */ |
706 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
707 | | /* 16 10 2008 Jay Draft */ |
708 | | /* */ |
709 | | /*****************************************************************************/ |
710 | | void ih264d_fill_bs1_non16x16mb_bslice(mv_pred_t *ps_cur_mv_pred, |
711 | | mv_pred_t *ps_top_mv_pred, |
712 | | void **ppv_map_ref_idx_to_poc, |
713 | | UWORD32 *pu4_bs_table, /* pointer to the BsTable array */ |
714 | | mv_pred_t *ps_leftmost_mv_pred, |
715 | | neighbouradd_t *ps_left_addr, |
716 | | void **u4_pic_addrress, |
717 | | WORD32 i4_ver_mvlimit) |
718 | 160k | { |
719 | 160k | UWORD32 edge; |
720 | 160k | void **ppv_map_ref_idx_to_poc_l0, **ppv_map_ref_idx_to_poc_l1; |
721 | 160k | ppv_map_ref_idx_to_poc_l0 = ppv_map_ref_idx_to_poc; |
722 | 160k | ppv_map_ref_idx_to_poc_l1 = ppv_map_ref_idx_to_poc + POC_LIST_L0_TO_L1_DIFF; |
723 | | |
724 | 160k | PROFILE_DISABLE_BOUNDARY_STRENGTH() |
725 | | |
726 | 800k | for(edge = 0; edge < 4; edge++, ps_top_mv_pred = ps_cur_mv_pred - 4) |
727 | 640k | { |
728 | | /*********************************************************************/ |
729 | | /* Each iteration of this loop fills the four BS values of one HORIZ */ |
730 | | /* edge and one BS value for each of the four VERT edges. */ |
731 | | /*********************************************************************/ |
732 | 640k | WORD32 i; |
733 | 640k | UWORD32 u4_vert_idx = 24 - (edge << 3); |
734 | 640k | UWORD32 u4_bs_horz = pu4_bs_table[edge]; |
735 | 640k | mv_pred_t *ps_left_mv_pred = ps_leftmost_mv_pred + (edge << 2); |
736 | | |
737 | 3.20M | for(i = 0; i < 4; i++, ps_top_mv_pred++, ps_cur_mv_pred++) |
738 | 2.56M | { |
739 | 2.56M | WORD16 i2_cur_mv0, i2_cur_mv1, i16_curMv2, i16_curMv3; |
740 | 2.56M | WORD8 i1_cur_ref0, i1_cur_ref1; |
741 | 2.56M | void *pv_cur_pic_addr0, *pv_cur_pic_addr1; |
742 | 2.56M | void *pv_nbr_pic_addr0, *pv_nbr_pic_addr1; |
743 | | |
744 | | /******************************************************/ |
745 | | /* Each iteration of this inner loop computes a HORIZ */ |
746 | | /* and a VERT BS value for a 4x4 block */ |
747 | | /******************************************************/ |
748 | 2.56M | UWORD32 u4_bs_vert = (pu4_bs_table[i + 4] >> u4_vert_idx) & 0xf; |
749 | 2.56M | UWORD32 u4_horz_idx = 24 - (i << 3); |
750 | | |
751 | | /*****************************************************/ |
752 | | /* check if vert Bs for this block is already set */ |
753 | | /*****************************************************/ |
754 | 2.56M | if(!u4_bs_vert) |
755 | 2.40M | { |
756 | 2.40M | WORD16 i2_left_mv0, i2_left_mv1, i2_left_mv2, i2_left_mv3; |
757 | | /************************************************************/ |
758 | | /* If Bs is not set, use left edge and current edge mvs and */ |
759 | | /* reference pictures addresses to evaluate Bs==1 */ |
760 | | /************************************************************/ |
761 | 2.40M | i2_left_mv0 = ps_left_mv_pred->i2_mv[0]; |
762 | 2.40M | i2_left_mv1 = ps_left_mv_pred->i2_mv[1]; |
763 | 2.40M | i2_left_mv2 = ps_left_mv_pred->i2_mv[2]; |
764 | 2.40M | i2_left_mv3 = ps_left_mv_pred->i2_mv[3]; |
765 | | |
766 | 2.40M | i2_cur_mv0 = ps_cur_mv_pred->i2_mv[0]; |
767 | 2.40M | i2_cur_mv1 = ps_cur_mv_pred->i2_mv[1]; |
768 | 2.40M | i16_curMv2 = ps_cur_mv_pred->i2_mv[2]; |
769 | 2.40M | i16_curMv3 = ps_cur_mv_pred->i2_mv[3]; |
770 | 2.40M | i1_cur_ref0 = ps_cur_mv_pred->i1_ref_frame[0]; |
771 | 2.40M | i1_cur_ref1 = ps_cur_mv_pred->i1_ref_frame[1]; |
772 | 2.40M | pv_cur_pic_addr0 = ppv_map_ref_idx_to_poc_l0[i1_cur_ref0]; |
773 | 2.40M | pv_cur_pic_addr1 = ppv_map_ref_idx_to_poc_l1[i1_cur_ref1]; |
774 | | |
775 | 2.40M | if(i) |
776 | 1.80M | { |
777 | 1.80M | WORD8 i1_left_ref0, i1_left_ref1; |
778 | 1.80M | i1_left_ref0 = ps_left_mv_pred->i1_ref_frame[0]; |
779 | 1.80M | i1_left_ref1 = ps_left_mv_pred->i1_ref_frame[1]; |
780 | 1.80M | pv_nbr_pic_addr0 = ppv_map_ref_idx_to_poc_l0[i1_left_ref0]; |
781 | 1.80M | pv_nbr_pic_addr1 = ppv_map_ref_idx_to_poc_l1[i1_left_ref1]; |
782 | 1.80M | } |
783 | 598k | else |
784 | 598k | { |
785 | 598k | pv_nbr_pic_addr0 = ps_left_addr->u4_add[edge & 2]; |
786 | 598k | pv_nbr_pic_addr1 = ps_left_addr->u4_add[1 + (edge & 2)]; |
787 | 598k | } |
788 | | |
789 | 2.40M | { |
790 | 2.40M | UWORD32 u4_bs_temp1, u4_bs_temp2; |
791 | | /*********************************************************/ |
792 | | /* If any motion vector component differs by more than 1 */ |
793 | | /* integer pel or if reference pictures are different Bs */ |
794 | | /* is set to 1. Note that this condition shall be met for*/ |
795 | | /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/ |
796 | | /*********************************************************/ |
797 | | |
798 | 2.40M | u4_bs_temp1 = |
799 | 2.40M | ((ABS((i2_left_mv0 - i2_cur_mv0)) |
800 | 2.40M | >= 4) |
801 | 2.40M | | (ABS((i2_left_mv1 |
802 | 2.40M | - i2_cur_mv1)) |
803 | 2.40M | >= i4_ver_mvlimit) |
804 | 2.40M | | (ABS((i2_left_mv2 |
805 | 2.40M | - i16_curMv2)) |
806 | 2.40M | >= 4) |
807 | 2.40M | | (ABS((i2_left_mv3 |
808 | 2.40M | - i16_curMv3)) |
809 | 2.40M | >= i4_ver_mvlimit)); |
810 | | |
811 | 2.40M | u4_bs_temp2 = |
812 | 2.40M | ((ABS((i2_left_mv0 - i16_curMv2)) |
813 | 2.40M | >= 4) |
814 | 2.40M | | (ABS((i2_left_mv1 |
815 | 2.40M | - i16_curMv3)) |
816 | 2.40M | >= i4_ver_mvlimit) |
817 | 2.40M | | (ABS((i2_left_mv2 |
818 | 2.40M | - i2_cur_mv0)) |
819 | 2.40M | >= 4) |
820 | 2.40M | | (ABS((i2_left_mv3 |
821 | 2.40M | - i2_cur_mv1)) |
822 | 2.40M | >= i4_ver_mvlimit)); |
823 | | |
824 | 2.40M | u4_bs_vert = |
825 | 2.40M | ((pv_nbr_pic_addr0 != pv_cur_pic_addr0) |
826 | 2.40M | || (pv_nbr_pic_addr1 |
827 | 2.20M | != pv_cur_pic_addr1) |
828 | 2.40M | || u4_bs_temp1) |
829 | 2.40M | && ((pv_nbr_pic_addr0 |
830 | 418k | != pv_cur_pic_addr1) |
831 | 418k | || (pv_nbr_pic_addr1 |
832 | 197k | != pv_cur_pic_addr0) |
833 | 418k | || u4_bs_temp2); |
834 | | |
835 | 2.40M | pu4_bs_table[i + 4] |= (u4_bs_vert << u4_vert_idx); |
836 | 2.40M | } |
837 | 2.40M | } |
838 | | |
839 | | /*****************************************************/ |
840 | | /* check if horz Bs for this block is already set */ |
841 | | /*****************************************************/ |
842 | 2.56M | if(!((u4_bs_horz >> u4_horz_idx) & 0xf)) |
843 | 2.40M | { |
844 | 2.40M | WORD16 i2_top_mv0, i2_top_mv1, i16_topMv2, i16_topMv3; |
845 | | /************************************************************/ |
846 | | /* If Bs is not set, use top edge and current edge mvs and */ |
847 | | /* reference pictures addresses to evaluate Bs==1 */ |
848 | | /************************************************************/ |
849 | 2.40M | i2_cur_mv0 = ps_cur_mv_pred->i2_mv[0]; |
850 | 2.40M | i2_cur_mv1 = ps_cur_mv_pred->i2_mv[1]; |
851 | 2.40M | i16_curMv2 = ps_cur_mv_pred->i2_mv[2]; |
852 | 2.40M | i16_curMv3 = ps_cur_mv_pred->i2_mv[3]; |
853 | 2.40M | i1_cur_ref0 = ps_cur_mv_pred->i1_ref_frame[0]; |
854 | 2.40M | i1_cur_ref1 = ps_cur_mv_pred->i1_ref_frame[1]; |
855 | | |
856 | 2.40M | i2_top_mv0 = ps_top_mv_pred->i2_mv[0]; |
857 | 2.40M | i2_top_mv1 = ps_top_mv_pred->i2_mv[1]; |
858 | 2.40M | i16_topMv2 = ps_top_mv_pred->i2_mv[2]; |
859 | 2.40M | i16_topMv3 = ps_top_mv_pred->i2_mv[3]; |
860 | 2.40M | pv_cur_pic_addr0 = ppv_map_ref_idx_to_poc_l0[i1_cur_ref0]; |
861 | 2.40M | pv_cur_pic_addr1 = ppv_map_ref_idx_to_poc_l1[i1_cur_ref1]; |
862 | 2.40M | if(edge) |
863 | 1.80M | { |
864 | 1.80M | WORD8 i1_top_ref0, i1_top_ref1; |
865 | 1.80M | i1_top_ref0 = ps_top_mv_pred->i1_ref_frame[0]; |
866 | 1.80M | i1_top_ref1 = ps_top_mv_pred->i1_ref_frame[1]; |
867 | 1.80M | pv_nbr_pic_addr0 = ppv_map_ref_idx_to_poc_l0[i1_top_ref0]; |
868 | 1.80M | pv_nbr_pic_addr1 = ppv_map_ref_idx_to_poc_l1[i1_top_ref1]; |
869 | 1.80M | } |
870 | 596k | else |
871 | 596k | { |
872 | 596k | pv_nbr_pic_addr0 = u4_pic_addrress[i & 2]; |
873 | 596k | pv_nbr_pic_addr1 = u4_pic_addrress[1 + (i & 2)]; |
874 | 596k | } |
875 | | |
876 | 2.40M | { |
877 | 2.40M | UWORD32 u4_bs_temp1, u4_bs_temp2; |
878 | 2.40M | UWORD32 u4_bs; |
879 | | /*********************************************************/ |
880 | | /* If any motion vector component differs by more than 1 */ |
881 | | /* integer pel or if reference pictures are different Bs */ |
882 | | /* is set to 1. Note that this condition shall be met for*/ |
883 | | /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/ |
884 | | /*********************************************************/ |
885 | | |
886 | 2.40M | u4_bs_temp1 = |
887 | 2.40M | ((ABS((i2_top_mv0 - i2_cur_mv0)) |
888 | 2.40M | >= 4) |
889 | 2.40M | | (ABS((i2_top_mv1 |
890 | 2.40M | - i2_cur_mv1)) |
891 | 2.40M | >= i4_ver_mvlimit) |
892 | 2.40M | | (ABS((i16_topMv2 |
893 | 2.40M | - i16_curMv2)) |
894 | 2.40M | >= 4) |
895 | 2.40M | | (ABS((i16_topMv3 |
896 | 2.40M | - i16_curMv3)) |
897 | 2.40M | >= i4_ver_mvlimit)); |
898 | | |
899 | 2.40M | u4_bs_temp2 = |
900 | 2.40M | ((ABS((i2_top_mv0 - i16_curMv2)) |
901 | 2.40M | >= 4) |
902 | 2.40M | | (ABS((i2_top_mv1 |
903 | 2.40M | - i16_curMv3)) |
904 | 2.40M | >= i4_ver_mvlimit) |
905 | 2.40M | | (ABS((i16_topMv2 |
906 | 2.40M | - i2_cur_mv0)) |
907 | 2.40M | >= 4) |
908 | 2.40M | | (ABS((i16_topMv3 |
909 | 2.40M | - i2_cur_mv1)) |
910 | 2.40M | >= i4_ver_mvlimit)); |
911 | | |
912 | 2.40M | u4_bs = |
913 | 2.40M | ((pv_nbr_pic_addr0 != pv_cur_pic_addr0) |
914 | 2.40M | || (pv_nbr_pic_addr1 |
915 | 2.15M | != pv_cur_pic_addr1) |
916 | 2.40M | || u4_bs_temp1) |
917 | 2.40M | && ((pv_nbr_pic_addr0 |
918 | 654k | != pv_cur_pic_addr1) |
919 | 654k | || (pv_nbr_pic_addr1 |
920 | 342k | != pv_cur_pic_addr0) |
921 | 654k | || u4_bs_temp2); |
922 | | |
923 | 2.40M | u4_bs_horz |= (u4_bs << u4_horz_idx); |
924 | 2.40M | } |
925 | 2.40M | } |
926 | | |
927 | 2.56M | ps_left_mv_pred = ps_cur_mv_pred; |
928 | 2.56M | } |
929 | | |
930 | 640k | pu4_bs_table[edge] = u4_bs_horz; |
931 | 640k | } |
932 | 160k | } |
933 | | |
934 | | /*****************************************************************************/ |
935 | | /* */ |
936 | | /* Function Name : ih264d_fill_bs_xtra_left_edge_cur_fld */ |
937 | | /* */ |
938 | | /* Description : This function fills boundray strength (= 2 or 1) for */ |
939 | | /* xtra left mb edge when cur mb is field and left mb is */ |
940 | | /* frame. */ |
941 | | /* Inputs : */ |
942 | | /* */ |
943 | | /* Globals : <Does it use any global variables?> */ |
944 | | /* Processing : */ |
945 | | /* */ |
946 | | /* */ |
947 | | /* Outputs : <What does the function produce?> */ |
948 | | /* Returns : <What does the function return?> */ |
949 | | /* */ |
950 | | /* Issues : <List any issues or problems with this function> */ |
951 | | /* */ |
952 | | /* Revision History: */ |
953 | | /* */ |
954 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
955 | | /* 16 10 2008 Jay Draft */ |
956 | | /* */ |
957 | | /*****************************************************************************/ |
958 | | void ih264d_fill_bs_xtra_left_edge_cur_fld(UWORD32 *pu4_bs, /* Base pointer of BS table */ |
959 | | WORD32 u4_left_mb_t_csbp, /* left mbpair's top csbp */ |
960 | | WORD32 u4_left_mb_b_csbp, /* left mbpair's bottom csbp*/ |
961 | | WORD32 u4_cur_mb_csbp, /* csbp of current mb */ |
962 | | UWORD32 u4_cur_mb_top /* is top or bottom mb */ |
963 | | |
964 | | ) |
965 | 18.9k | { |
966 | 18.9k | const UWORD32 *pu4_packed_bs = (const UWORD32 *)gau4_ih264d_packed_bs2; |
967 | 18.9k | UWORD32 u4_cur, u4_left, u4_or; |
968 | 18.9k | UNUSED(u4_cur_mb_top); |
969 | | |
970 | 18.9k | PROFILE_DISABLE_BOUNDARY_STRENGTH() |
971 | | |
972 | 18.9k | u4_left_mb_t_csbp = ((u4_left_mb_t_csbp & 0x0008) >> 3) |
973 | 18.9k | + ((u4_left_mb_t_csbp & 0x0080) >> 6) |
974 | 18.9k | + ((u4_left_mb_t_csbp & 0x0800) >> 9) |
975 | 18.9k | + ((u4_left_mb_t_csbp & 0x8000) >> 12); |
976 | | |
977 | 18.9k | u4_left_mb_b_csbp = ((u4_left_mb_b_csbp & 0x0008) << 1) |
978 | 18.9k | + ((u4_left_mb_b_csbp & 0x0080) >> 2) |
979 | 18.9k | + ((u4_left_mb_b_csbp & 0x0800) >> 5) |
980 | 18.9k | + ((u4_left_mb_b_csbp & 0x8000) >> 8); |
981 | | |
982 | | /*********************************************************************/ |
983 | | /* u4_cur = 0|0|0|0|0|0|0|0|12C|12C|8C|8C|4C|4C|0C|0C */ |
984 | | /*********************************************************************/ |
985 | 18.9k | u4_cur = (u4_cur_mb_csbp & 0x0001) + ((u4_cur_mb_csbp & 0x0001) << 1) |
986 | 18.9k | + ((u4_cur_mb_csbp & 0x0010) >> 2) |
987 | 18.9k | + ((u4_cur_mb_csbp & 0x0010) >> 1) |
988 | 18.9k | + ((u4_cur_mb_csbp & 0x0100) >> 4) |
989 | 18.9k | + ((u4_cur_mb_csbp & 0x0100) >> 3) |
990 | 18.9k | + ((u4_cur_mb_csbp & 0x1000) >> 6) |
991 | 18.9k | + ((u4_cur_mb_csbp & 0x1000) >> 5); |
992 | | |
993 | | /*********************************************************************/ |
994 | | /* u4_left =0|0|0|0|0|0|0|0|15Lb|11Lb|7Lb|3Lb|15Lt|11Lt|7Lt|3Lt */ |
995 | | /*********************************************************************/ |
996 | 18.9k | u4_left = u4_left_mb_t_csbp + u4_left_mb_b_csbp; |
997 | | |
998 | 18.9k | u4_or = (u4_cur | u4_left); |
999 | | /*********************************************************************/ |
1000 | | /* Fill vert edges (4,9) boundary strengths using look up table */ |
1001 | | /*********************************************************************/ |
1002 | 18.9k | pu4_packed_bs += 16; |
1003 | 18.9k | pu4_bs[4] = pu4_packed_bs[u4_or & 0xF]; |
1004 | 18.9k | pu4_bs[9] = pu4_packed_bs[(u4_or >> 4)]; |
1005 | 18.9k | } |
1006 | | |
1007 | | /*****************************************************************************/ |
1008 | | /* */ |
1009 | | /* Function Name : ih264d_fill_bs_xtra_left_edge_cur_frm */ |
1010 | | /* */ |
1011 | | /* Description : This function fills boundray strength (= 2 or 1) for */ |
1012 | | /* xtra left mb edge when cur mb is frame and left mb is */ |
1013 | | /* field. */ |
1014 | | /* Inputs : */ |
1015 | | /* */ |
1016 | | /* Globals : <Does it use any global variables?> */ |
1017 | | /* Processing : */ |
1018 | | /* */ |
1019 | | /* */ |
1020 | | /* Outputs : <What does the function produce?> */ |
1021 | | /* Returns : <What does the function return?> */ |
1022 | | /* */ |
1023 | | /* Issues : <List any issues or problems with this function> */ |
1024 | | /* */ |
1025 | | /* Revision History: */ |
1026 | | /* */ |
1027 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
1028 | | /* 16 10 2008 Jay Draft */ |
1029 | | /* */ |
1030 | | /*****************************************************************************/ |
1031 | | void ih264d_fill_bs_xtra_left_edge_cur_frm(UWORD32 *pu4_bs, /* Base pointer of BS table */ |
1032 | | WORD32 u4_left_mb_t_csbp, /* left mbpair's top csbp */ |
1033 | | WORD32 u4_left_mb_b_csbp, /* left mbpair's bottom csbp*/ |
1034 | | WORD32 u4_cur_mb_csbp, /* csbp of current mb */ |
1035 | | UWORD32 u4_cur_mb_bot /* is top or bottom mb */ |
1036 | | |
1037 | | ) |
1038 | 18.2k | { |
1039 | 18.2k | const UWORD32 *pu4_packed_bs = (const UWORD32 *)gau4_ih264d_packed_bs2; |
1040 | 18.2k | UWORD32 u4_cur, u4_left, u4_or; |
1041 | 18.2k | UWORD32 u4_right_shift = (u4_cur_mb_bot << 3); |
1042 | | |
1043 | 18.2k | PROFILE_DISABLE_BOUNDARY_STRENGTH() |
1044 | | |
1045 | 18.2k | u4_left_mb_t_csbp >>= u4_right_shift; |
1046 | 18.2k | u4_left_mb_b_csbp >>= u4_right_shift; |
1047 | | |
1048 | 18.2k | u4_left_mb_t_csbp = ((u4_left_mb_t_csbp & 0x08) >> 3) |
1049 | 18.2k | + ((u4_left_mb_t_csbp & 0x08) >> 2) |
1050 | 18.2k | + ((u4_left_mb_t_csbp & 0x80) >> 5) |
1051 | 18.2k | + ((u4_left_mb_t_csbp & 0x80) >> 4); |
1052 | | |
1053 | 18.2k | u4_left_mb_b_csbp = ((u4_left_mb_b_csbp & 0x08) << 1) |
1054 | 18.2k | + ((u4_left_mb_b_csbp & 0x08) << 2) |
1055 | 18.2k | + ((u4_left_mb_b_csbp & 0x80) >> 1) |
1056 | 18.2k | + ((u4_left_mb_b_csbp & 0x80)); |
1057 | | |
1058 | 18.2k | u4_cur = ((u4_cur_mb_csbp & 0x0001)) + ((u4_cur_mb_csbp & 0x0010) >> 3) |
1059 | 18.2k | + ((u4_cur_mb_csbp & 0x0100) >> 6) |
1060 | 18.2k | + ((u4_cur_mb_csbp & 0x1000) >> 9); |
1061 | | |
1062 | 18.2k | u4_cur += (u4_cur << 4); |
1063 | | |
1064 | 18.2k | u4_left = u4_left_mb_t_csbp + u4_left_mb_b_csbp; |
1065 | | |
1066 | 18.2k | u4_or = (u4_cur | u4_left); |
1067 | | /*********************************************************************/ |
1068 | | /* Fill vert edges (4,9) boundary strengths using look up table */ |
1069 | | /*********************************************************************/ |
1070 | 18.2k | pu4_packed_bs += 16; |
1071 | 18.2k | pu4_bs[4] = pu4_packed_bs[u4_or & 0xF]; |
1072 | 18.2k | pu4_bs[9] = pu4_packed_bs[(u4_or >> 4)]; |
1073 | 18.2k | } |
1074 | | |
1075 | | /*****************************************************************************/ |
1076 | | /* */ |
1077 | | /* Function Name : ih264d_fill_bs_xtra_top_edge */ |
1078 | | /* */ |
1079 | | /* Description : This function fills boundray strength (= 2 or 1) for */ |
1080 | | /* xtra top mb edge when cur mb is top mb of frame mb pair */ |
1081 | | /* and top mbpair is field coded. */ |
1082 | | /* Inputs : */ |
1083 | | /* */ |
1084 | | /* Globals : <Does it use any global variables?> */ |
1085 | | /* Processing : */ |
1086 | | /* */ |
1087 | | /* */ |
1088 | | /* Outputs : <What does the function produce?> */ |
1089 | | /* Returns : <What does the function return?> */ |
1090 | | /* */ |
1091 | | /* Issues : <List any issues or problems with this function> */ |
1092 | | /* */ |
1093 | | /* Revision History: */ |
1094 | | /* */ |
1095 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
1096 | | /* 16 10 2008 Jay Draft */ |
1097 | | /* */ |
1098 | | /*****************************************************************************/ |
1099 | | void ih264d_fill_bs_xtra_top_edge(UWORD32 *pu4_bs, /* Base pointer of BS table */ |
1100 | | WORD32 u4_topmb_t_csbp, /* top mbpair's top csbp */ |
1101 | | WORD32 u4_topmb_b_csbp, /* top mbpair's bottom csbp*/ |
1102 | | WORD32 u4_cur_mb_csbp /* csbp of current mb */ |
1103 | | |
1104 | | ) |
1105 | 12.9k | { |
1106 | 12.9k | const UWORD32 *pu4_packed_bs = (const UWORD32 *)gau4_ih264d_packed_bs2; |
1107 | 12.9k | UWORD32 u4_or; |
1108 | | |
1109 | 12.9k | u4_cur_mb_csbp &= 0xf; |
1110 | 12.9k | u4_topmb_t_csbp >>= 12; |
1111 | 12.9k | u4_topmb_b_csbp >>= 12; |
1112 | | |
1113 | 12.9k | u4_or = (u4_cur_mb_csbp | u4_topmb_t_csbp); |
1114 | | /*********************************************************************/ |
1115 | | /* Fill vert edges (0,8) boundary strengths using look up table */ |
1116 | | /*********************************************************************/ |
1117 | 12.9k | pu4_packed_bs += 16; |
1118 | 12.9k | pu4_bs[8] = pu4_packed_bs[u4_or]; |
1119 | | |
1120 | 12.9k | u4_or = (u4_cur_mb_csbp | u4_topmb_b_csbp); |
1121 | 12.9k | pu4_bs[0] = pu4_packed_bs[u4_or]; |
1122 | 12.9k | } |
1123 | | |
1124 | | /*****************************************************************************/ |
1125 | | /* */ |
1126 | | /* Function Name : ih264d_compute_bs_non_mbaff */ |
1127 | | /* */ |
1128 | | /* Description : This function computes the pointers of left,top & current*/ |
1129 | | /* : Nnz, MvPred & deblk_mb_t and supplies to FillBs function for*/ |
1130 | | /* : Boundary Strength Calculation */ |
1131 | | /* Inputs : <What inputs does the function take?> */ |
1132 | | /* Processing : This functions calls deblock MB in the MB increment order*/ |
1133 | | /* */ |
1134 | | /* Outputs : Produces the Boundary Strength for Current Mb */ |
1135 | | /* Returns : None */ |
1136 | | /* */ |
1137 | | /* Revision History: */ |
1138 | | /* */ |
1139 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
1140 | | /* ITTIAM */ |
1141 | | /*****************************************************************************/ |
1142 | | |
1143 | | void ih264d_compute_bs_non_mbaff(dec_struct_t * ps_dec, |
1144 | | dec_mb_info_t * ps_cur_mb_info, |
1145 | | const UWORD16 u2_mbxn_mb) |
1146 | 9.64M | { |
1147 | | /* Mvpred and Nnz for top and Courrent */ |
1148 | 9.64M | mv_pred_t *ps_cur_mv_pred, *ps_top_mv_pred = NULL, *ps_left_mv_pred; |
1149 | | /* deblk_mb_t Params */ |
1150 | 9.64M | deblk_mb_t *ps_cur_mb_params; /*< Parameters of current MacroBlock */ |
1151 | 9.64M | deblkmb_neighbour_t *ps_deblk_top_mb; |
1152 | | |
1153 | | /* Reference Index to POC mapping*/ |
1154 | 9.64M | void ** apv_map_ref_idx_to_poc; |
1155 | 9.64M | UWORD32 u4_leftmbtype; |
1156 | | |
1157 | 9.64M | UWORD16 u2_left_csbp, u2_top_csbp, u2_cur_csbp; |
1158 | | |
1159 | | /* Set of flags */ |
1160 | 9.64M | UWORD32 u4_cur_mb_intra, u1_top_mb_typ, u4_cur_mb_fld; |
1161 | 9.64M | UWORD32 u1_cur_mb_type; |
1162 | 9.64M | UWORD32 * pu4_bs_table; |
1163 | | |
1164 | | /* Neighbour availability */ |
1165 | | /* Initialization */ |
1166 | 9.64M | const UWORD32 u2_mbx = ps_cur_mb_info->u2_mbx; |
1167 | 9.64M | const UWORD32 u2_mby = ps_cur_mb_info->u2_mby; |
1168 | 9.64M | const UWORD32 u1_pingpong = u2_mbx & 0x01; |
1169 | | |
1170 | 9.64M | PROFILE_DISABLE_BOUNDARY_STRENGTH() |
1171 | | |
1172 | 9.64M | ps_deblk_top_mb = ps_dec->ps_deblk_top_mb + u2_mbx; |
1173 | | |
1174 | | |
1175 | | /* Pointer assignment for Current DeblkMB, Current Mv Pred */ |
1176 | 9.64M | ps_cur_mb_params = ps_dec->ps_deblk_mbn + u2_mbxn_mb; |
1177 | 9.64M | ps_cur_mv_pred = ps_dec->ps_mv_cur + (u2_mbxn_mb << 4); |
1178 | | |
1179 | 9.64M | apv_map_ref_idx_to_poc = ps_dec->ppv_map_ref_idx_to_poc + 1; |
1180 | 9.64M | u1_cur_mb_type = ps_cur_mb_params->u1_mb_type; |
1181 | 9.64M | u1_top_mb_typ = ps_deblk_top_mb->u1_mb_type; |
1182 | 9.64M | ps_deblk_top_mb->u1_mb_type = u1_cur_mb_type; |
1183 | | |
1184 | 9.64M | { |
1185 | 9.64M | UWORD8 mb_qp_temp; |
1186 | | |
1187 | 9.64M | ps_cur_mb_params->u1_topmb_qp = ps_deblk_top_mb->u1_mb_qp; |
1188 | 9.64M | ps_deblk_top_mb->u1_mb_qp = ps_cur_mb_params->u1_mb_qp; |
1189 | | |
1190 | 9.64M | ps_cur_mb_params->u1_left_mb_qp = ps_dec->deblk_left_mb[1].u1_mb_qp; |
1191 | 9.64M | ps_dec->deblk_left_mb[1].u1_mb_qp = ps_cur_mb_params->u1_mb_qp; |
1192 | | |
1193 | 9.64M | } |
1194 | | |
1195 | | /* if no deblocking required for current Mb then continue */ |
1196 | | /* Check next Mbs in Mb group */ |
1197 | 9.64M | if(ps_cur_mb_params->u1_deblocking_mode & MB_DISABLE_FILTERING) |
1198 | 1.76M | { |
1199 | 1.76M | void ** pu4_map_ref_idx_to_poc_l1 = apv_map_ref_idx_to_poc + |
1200 | 1.76M | POC_LIST_L0_TO_L1_DIFF; |
1201 | 1.76M | { |
1202 | | /* Store Parameter for Top MvPred refernce frame Address */ |
1203 | | |
1204 | 1.76M | void ** ppv_top_mv_pred_addr = ps_cur_mb_info->ps_curmb->u4_pic_addrress; |
1205 | 1.76M | WORD8 * p1_refTop0 = (ps_cur_mv_pred + 12)->i1_ref_frame; |
1206 | 1.76M | WORD8 * p1_refTop1 = (ps_cur_mv_pred + 14)->i1_ref_frame; |
1207 | | |
1208 | | /* Store Left addresses for Next Mb */ |
1209 | 1.76M | void ** ppv_left_mv_pred_addr = |
1210 | 1.76M | ps_dec->ps_left_mvpred_addr[!u1_pingpong][1].u4_add; |
1211 | 1.76M | WORD8 * p1_refleft0 = (ps_cur_mv_pred + 3)->i1_ref_frame; |
1212 | | |
1213 | | |
1214 | 1.76M | ppv_top_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refTop0[0]]; |
1215 | 1.76M | ppv_top_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refTop0[1]]; |
1216 | | |
1217 | 1.76M | ppv_left_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]]; |
1218 | 1.76M | ppv_top_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]]; |
1219 | 1.76M | ppv_left_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]]; |
1220 | 1.76M | ppv_top_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]]; |
1221 | | |
1222 | 1.76M | ppv_left_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refleft0[0]]; |
1223 | 1.76M | ppv_left_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refleft0[1]]; |
1224 | | //} |
1225 | | /* Storing the leftMbtype for next Mb */ |
1226 | 1.76M | ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type; |
1227 | 1.76M | } |
1228 | | |
1229 | 1.76M | return; |
1230 | 1.76M | } |
1231 | | |
1232 | | /* Flag for extra left Edge */ |
1233 | 7.88M | ps_cur_mb_params->u1_single_call = 1; |
1234 | | |
1235 | | /* Update the Left deblk_mb_t and Left MvPred Parameters */ |
1236 | 7.88M | if(!u2_mbx) |
1237 | 890k | { |
1238 | 890k | u4_leftmbtype = 0; |
1239 | | |
1240 | | /* Initialize the ps_left_mv_pred with Junk but Valid Location */ |
1241 | | /* to avoid invalid memory access */ |
1242 | | /* this is read only pointer */ |
1243 | 890k | ps_left_mv_pred = ps_dec->ps_mv_cur + 3; |
1244 | 890k | } |
1245 | 6.99M | else |
1246 | 6.99M | { |
1247 | 6.99M | u4_leftmbtype = ps_dec->deblk_left_mb[1].u1_mb_type; |
1248 | | |
1249 | | /* Come to Left Most Edge of the MB */ |
1250 | 6.99M | ps_left_mv_pred = (u2_mbxn_mb) ? |
1251 | 6.96M | ps_dec->ps_mv_cur + ((u2_mbxn_mb - 1) << 4) + 3 : |
1252 | 6.99M | ps_dec->ps_mv_left + 3; |
1253 | 6.99M | } |
1254 | | |
1255 | 7.88M | if(!u2_mby) |
1256 | 445k | u1_top_mb_typ = 0; |
1257 | | |
1258 | | /* MvPred Pointer Calculation */ |
1259 | | /* CHANGED CODE */ |
1260 | 7.88M | ps_top_mv_pred = ps_cur_mv_pred - (ps_dec->u2_frm_wd_in_mbs << 4) + 12; |
1261 | | |
1262 | 7.88M | u4_cur_mb_intra = u1_cur_mb_type & D_INTRA_MB; |
1263 | 7.88M | u4_cur_mb_fld = !!(u1_cur_mb_type & D_FLD_MB); |
1264 | | /* Compute BS function */ |
1265 | 7.88M | pu4_bs_table = ps_cur_mb_params->u4_bs_table; |
1266 | | |
1267 | 7.88M | u2_cur_csbp = ps_cur_mb_info->ps_curmb->u2_luma_csbp; |
1268 | 7.88M | u2_left_csbp = ps_cur_mb_info->ps_left_mb->u2_luma_csbp; |
1269 | 7.88M | u2_top_csbp = ps_cur_mb_info->ps_top_mb->u2_luma_csbp; |
1270 | | /* Compute BS function */ |
1271 | 7.88M | if(ps_dec->ps_cur_sps->u1_profile_idc == HIGH_PROFILE_IDC) |
1272 | 1.54M | { |
1273 | 1.54M | if(ps_cur_mb_info->u1_tran_form8x8 == 1) |
1274 | 289k | { |
1275 | 289k | u2_cur_csbp = ih264d_update_csbp_8x8( |
1276 | 289k | ps_cur_mb_info->ps_curmb->u2_luma_csbp); |
1277 | 289k | } |
1278 | | |
1279 | 1.54M | if(ps_cur_mb_info->ps_left_mb->u1_tran_form8x8 == 1) |
1280 | 260k | { |
1281 | 260k | u2_left_csbp = ih264d_update_csbp_8x8( |
1282 | 260k | ps_cur_mb_info->ps_left_mb->u2_luma_csbp); |
1283 | 260k | } |
1284 | | |
1285 | 1.54M | if(ps_cur_mb_info->ps_top_mb->u1_tran_form8x8 == 1) |
1286 | 281k | { |
1287 | 281k | u2_top_csbp = ih264d_update_csbp_8x8( |
1288 | 281k | ps_cur_mb_info->ps_top_mb->u2_luma_csbp); |
1289 | 281k | } |
1290 | 1.54M | } |
1291 | 7.88M | if(u4_cur_mb_intra) |
1292 | 377k | { |
1293 | | |
1294 | 377k | pu4_bs_table[4] = 0x04040404; |
1295 | 377k | pu4_bs_table[0] = u4_cur_mb_fld ? 0x03030303 : 0x04040404; |
1296 | 377k | pu4_bs_table[1] = 0x03030303; |
1297 | 377k | pu4_bs_table[2] = 0x03030303; |
1298 | 377k | pu4_bs_table[3] = 0x03030303; |
1299 | 377k | pu4_bs_table[5] = 0x03030303; |
1300 | 377k | pu4_bs_table[6] = 0x03030303; |
1301 | 377k | pu4_bs_table[7] = 0x03030303; |
1302 | 377k | } |
1303 | 7.50M | else |
1304 | 7.50M | { |
1305 | 7.50M | UWORD32 u4_is_non16x16 = !!(u1_cur_mb_type & D_PRED_NON_16x16); |
1306 | 7.50M | UWORD32 u4_is_b = ps_dec->u1_B; |
1307 | | |
1308 | 7.50M | ih264d_fill_bs2_horz_vert( |
1309 | 7.50M | pu4_bs_table, u2_left_csbp, u2_top_csbp, u2_cur_csbp, |
1310 | 7.50M | (const UWORD32 *)(gau4_ih264d_packed_bs2), |
1311 | 7.50M | (const UWORD16 *)(gau2_ih264d_4x4_v2h_reorder)); |
1312 | | |
1313 | 7.50M | if(u4_leftmbtype & D_INTRA_MB) |
1314 | 15.9k | pu4_bs_table[4] = 0x04040404; |
1315 | | |
1316 | 7.50M | if(u1_top_mb_typ & D_INTRA_MB) |
1317 | 53.6k | pu4_bs_table[0] = u4_cur_mb_fld ? 0x03030303 : 0x04040404; |
1318 | | |
1319 | 7.50M | ps_dec->pf_fill_bs1[u4_is_b][u4_is_non16x16]( |
1320 | 7.50M | ps_cur_mv_pred, ps_top_mv_pred, apv_map_ref_idx_to_poc, |
1321 | 7.50M | pu4_bs_table, ps_left_mv_pred, |
1322 | 7.50M | &(ps_dec->ps_left_mvpred_addr[u1_pingpong][1]), |
1323 | 7.50M | ps_cur_mb_info->ps_top_mb->u4_pic_addrress, |
1324 | 7.50M | (4 >> u4_cur_mb_fld)); |
1325 | 7.50M | } |
1326 | | |
1327 | 7.88M | { |
1328 | 7.88M | void ** pu4_map_ref_idx_to_poc_l1 = apv_map_ref_idx_to_poc + |
1329 | 7.88M | POC_LIST_L0_TO_L1_DIFF; |
1330 | 7.88M | { |
1331 | | /* Store Parameter for Top MvPred refernce frame Address */ |
1332 | | |
1333 | 7.88M | void ** ppv_top_mv_pred_addr = ps_cur_mb_info->ps_curmb->u4_pic_addrress; |
1334 | 7.88M | WORD8 * p1_refTop0 = (ps_cur_mv_pred + 12)->i1_ref_frame; |
1335 | 7.88M | WORD8 * p1_refTop1 = (ps_cur_mv_pred + 14)->i1_ref_frame; |
1336 | | |
1337 | | /* Store Left addresses for Next Mb */ |
1338 | 7.88M | void ** ppv_left_mv_pred_addr = |
1339 | 7.88M | ps_dec->ps_left_mvpred_addr[!u1_pingpong][1].u4_add; |
1340 | 7.88M | WORD8 * p1_refleft0 = (ps_cur_mv_pred + 3)->i1_ref_frame; |
1341 | | |
1342 | 7.88M | ppv_top_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refTop0[0]]; |
1343 | 7.88M | ppv_top_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refTop0[1]]; |
1344 | | |
1345 | 7.88M | ppv_left_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]]; |
1346 | 7.88M | ppv_top_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]]; |
1347 | 7.88M | ppv_left_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]]; |
1348 | 7.88M | ppv_top_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]]; |
1349 | | |
1350 | 7.88M | ppv_left_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refleft0[0]]; |
1351 | 7.88M | ppv_left_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refleft0[1]]; |
1352 | | |
1353 | | /* Storing the leftMbtype for next Mb */ |
1354 | 7.88M | ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type; |
1355 | | |
1356 | 7.88M | } |
1357 | 7.88M | } |
1358 | | |
1359 | | /* For transform 8x8 disable deblocking of the intrernal edges of a 8x8 block */ |
1360 | 7.88M | if(ps_cur_mb_info->u1_tran_form8x8) |
1361 | 304k | { |
1362 | 304k | pu4_bs_table[1] = 0; |
1363 | 304k | pu4_bs_table[3] = 0; |
1364 | 304k | pu4_bs_table[5] = 0; |
1365 | 304k | pu4_bs_table[7] = 0; |
1366 | 304k | } |
1367 | 7.88M | } |
1368 | | |
1369 | | /*****************************************************************************/ |
1370 | | /* */ |
1371 | | /* Function Name : ih264d_compute_bs_mbaff */ |
1372 | | /* */ |
1373 | | /* Description : This function computes the pointers of left,top & current*/ |
1374 | | /* : Nnz, MvPred & deblk_mb_t and supplies to FillBs function for*/ |
1375 | | /* : Boundary Strength Calculation */ |
1376 | | /* Inputs : <What inputs does the function take?> */ |
1377 | | /* Processing : This functions calls deblock MB in the MB increment order*/ |
1378 | | /* */ |
1379 | | /* Outputs : Produces the Boundary Strength for Current Mb */ |
1380 | | /* Returns : None */ |
1381 | | /* */ |
1382 | | /* Revision History: */ |
1383 | | /* */ |
1384 | | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
1385 | | /* ITTIAM */ |
1386 | | /*****************************************************************************/ |
1387 | | |
1388 | | void ih264d_compute_bs_mbaff(dec_struct_t * ps_dec, |
1389 | | dec_mb_info_t * ps_cur_mb_info, |
1390 | | const UWORD16 u2_mbxn_mb) |
1391 | 2.24M | { |
1392 | | /* Mvpred and Nnz for top and Courrent */ |
1393 | 2.24M | mv_pred_t *ps_cur_mv_pred, *ps_top_mv_pred = NULL, *ps_left_mv_pred; |
1394 | | /* deblk_mb_t Params */ |
1395 | 2.24M | deblk_mb_t *ps_cur_mb_params; /*< Parameters of current MacroBlock */ |
1396 | 2.24M | neighbouradd_t * ps_left_ngbr; |
1397 | 2.24M | deblkmb_neighbour_t *ps_deblk_top_mb; |
1398 | | /* Reference Index to POC mapping*/ |
1399 | 2.24M | void ** apv_map_ref_idx_to_poc; |
1400 | | |
1401 | 2.24M | UWORD32 u4_leftmbtype; |
1402 | | |
1403 | | |
1404 | 2.24M | UWORD16 u2_left_csbp, u2_top_csbp, u2_cur_csbp; |
1405 | | |
1406 | | /* Set of flags */ |
1407 | 2.24M | UWORD32 u4_cur_mb_intra, u4_cur_mb_fld, u4_top_mb_fld, u1_top_mb_typ, u4_left_mb_fld; |
1408 | 2.24M | UWORD32 u1_cur_mb_type; |
1409 | 2.24M | UWORD32 * pu4_bs_table; |
1410 | 2.24M | const UWORD32 u4_bot_mb = (1 - ps_cur_mb_info->u1_topmb); |
1411 | | /* Initialization */ |
1412 | 2.24M | const UWORD32 u2_mbx = ps_cur_mb_info->u2_mbx; |
1413 | 2.24M | const UWORD32 u2_mby = ps_cur_mb_info->u2_mby; |
1414 | | /* Load From u1_pingpong and Store in !u1_pingpong */ |
1415 | 2.24M | const UWORD32 u1_pingpong = u2_mbx & 0x01; |
1416 | | |
1417 | 2.24M | PROFILE_DISABLE_BOUNDARY_STRENGTH() |
1418 | | |
1419 | 2.24M | ps_deblk_top_mb = ps_dec->ps_deblk_top_mb + (u2_mbx << 1); |
1420 | | |
1421 | | |
1422 | | /************************************************/ |
1423 | | /* Initialize the left Mb type */ |
1424 | | /* Left MvPred */ |
1425 | | /************************************************/ |
1426 | | |
1427 | 2.24M | if(!u2_mbx) |
1428 | 136k | { |
1429 | | /************************************************************/ |
1430 | | /* Initialize the ps_left_mv_pred with Junk but Valid Location */ |
1431 | | /* to avoid invalid memory access */ |
1432 | | /* this is read only pointer */ |
1433 | | /************************************************************/ |
1434 | 136k | ps_left_mv_pred = ps_dec->ps_mv_cur + 16; |
1435 | 136k | } |
1436 | 2.11M | else |
1437 | 2.11M | { |
1438 | | /* Come to Left Most Edge of the MB */ |
1439 | 2.11M | ps_left_mv_pred = (u2_mbxn_mb) ? |
1440 | 2.10M | ps_dec->ps_mv_cur + ((u2_mbxn_mb - 1) << 5) + 3 : |
1441 | 2.11M | ps_dec->ps_mv_left + 3; |
1442 | | |
1443 | 2.11M | ps_left_mv_pred += (u4_bot_mb << 4); |
1444 | 2.11M | } |
1445 | | |
1446 | 2.24M | u4_leftmbtype = ps_dec->deblk_left_mb[u4_bot_mb].u1_mb_type; |
1447 | | |
1448 | 2.24M | ps_left_ngbr = &(ps_dec->ps_left_mvpred_addr[u1_pingpong][u4_bot_mb]); |
1449 | | |
1450 | | /************************************************/ |
1451 | | /* Pointer Assignment for Current Mb Parameters */ |
1452 | | /* Pointer Assignment for Current MvPred */ |
1453 | | /************************************************/ |
1454 | 2.24M | ps_cur_mb_params = ps_dec->ps_deblk_mbn + (u2_mbxn_mb << 1) + u4_bot_mb; |
1455 | 2.24M | u1_cur_mb_type = ps_cur_mb_params->u1_mb_type; |
1456 | | |
1457 | 2.24M | ps_cur_mv_pred = ps_dec->ps_mv_cur + (u2_mbxn_mb << 5); |
1458 | 2.24M | ps_cur_mv_pred += (u4_bot_mb << 4); |
1459 | | |
1460 | | /********************************************/ |
1461 | | /* Pointer Assignment for Top Mb Parameters */ |
1462 | | /* Pointer Assignment for Top MvPred and */ |
1463 | | /* Pointer Assignment for Top Nnz */ |
1464 | | /********************************************/ |
1465 | | |
1466 | | /* CHANGED CODE */ |
1467 | 2.24M | ps_top_mv_pred = ps_cur_mv_pred - (ps_dec->u2_frm_wd_in_mbs << 5) + 12; |
1468 | | |
1469 | 2.24M | u4_cur_mb_fld = !!(u1_cur_mb_type & D_FLD_MB); |
1470 | 2.24M | u4_left_mb_fld = !!(ps_dec->deblk_left_mb[0].u1_mb_type & D_FLD_MB); |
1471 | | |
1472 | 2.24M | if(u4_left_mb_fld != u4_cur_mb_fld) |
1473 | 56.9k | { |
1474 | | /* Flag for extra left Edge */ |
1475 | 56.9k | ps_cur_mb_params->u1_single_call = 0; |
1476 | | |
1477 | 56.9k | if(u4_bot_mb) |
1478 | 28.4k | { |
1479 | 28.4k | ps_left_ngbr--; |
1480 | 28.4k | ps_left_mv_pred -= 16; |
1481 | 28.4k | } |
1482 | 56.9k | } |
1483 | 2.19M | else |
1484 | 2.19M | ps_cur_mb_params->u1_single_call = 1; |
1485 | | |
1486 | 2.24M | apv_map_ref_idx_to_poc = ps_dec->ppv_map_ref_idx_to_poc + 1; |
1487 | 2.24M | if(u4_cur_mb_fld) |
1488 | 100k | { |
1489 | 100k | if(u4_bot_mb) |
1490 | 50.1k | { |
1491 | 50.1k | apv_map_ref_idx_to_poc += BOT_LIST_FLD_L0; |
1492 | 50.1k | } |
1493 | 50.1k | else |
1494 | 50.1k | { |
1495 | 50.1k | apv_map_ref_idx_to_poc += TOP_LIST_FLD_L0; |
1496 | 50.1k | } |
1497 | 100k | } |
1498 | | |
1499 | | /**********************************************************/ |
1500 | | /* if no deblocking required for current Mb then continue */ |
1501 | | /**********************************************************/ |
1502 | 2.24M | if(ps_cur_mb_params->u1_deblocking_mode & MB_DISABLE_FILTERING) |
1503 | 1.83k | { |
1504 | 1.83k | void ** pu4_map_ref_idx_to_poc_l1 = apv_map_ref_idx_to_poc + |
1505 | 1.83k | POC_LIST_L0_TO_L1_DIFF; |
1506 | | |
1507 | 1.83k | { |
1508 | | /* Store Parameter for Top MvPred refernce frame Address */ |
1509 | | |
1510 | 1.83k | void ** ppv_top_mv_pred_addr = ps_cur_mb_info->ps_curmb->u4_pic_addrress; |
1511 | 1.83k | void ** ppv_left_mv_pred_addr = |
1512 | 1.83k | ps_dec->ps_left_mvpred_addr[!u1_pingpong][u4_bot_mb].u4_add; |
1513 | 1.83k | WORD8 * p1_refTop0 = (ps_cur_mv_pred + 12)->i1_ref_frame; |
1514 | 1.83k | WORD8 * p1_refTop1 = (ps_cur_mv_pred + 14)->i1_ref_frame; |
1515 | 1.83k | WORD8 * p1_refLeft0 = (ps_cur_mv_pred + 3)->i1_ref_frame; |
1516 | 1.83k | ppv_top_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refTop0[0]]; |
1517 | 1.83k | ppv_top_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refTop0[1]]; |
1518 | 1.83k | ppv_left_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]]; |
1519 | 1.83k | ppv_top_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]]; |
1520 | 1.83k | ppv_left_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]]; |
1521 | 1.83k | ppv_top_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]]; |
1522 | 1.83k | ppv_left_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refLeft0[0]]; |
1523 | 1.83k | ppv_left_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refLeft0[1]]; |
1524 | 1.83k | } |
1525 | 1.83k | if(u4_bot_mb) |
1526 | 917 | { |
1527 | | /* store The Left Mb Type*/ |
1528 | 917 | ps_dec->deblk_left_mb[0].u1_mb_type = |
1529 | 917 | (ps_cur_mb_params - 1)->u1_mb_type; |
1530 | 917 | ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type; |
1531 | | |
1532 | 917 | } |
1533 | 1.83k | ps_deblk_top_mb[u4_bot_mb].u1_mb_type = u1_cur_mb_type; |
1534 | 1.83k | return; |
1535 | 1.83k | } |
1536 | | |
1537 | 2.24M | if(u2_mby) |
1538 | 2.17M | { |
1539 | 2.17M | u1_top_mb_typ = ps_deblk_top_mb[1].u1_mb_type; |
1540 | 2.17M | u4_top_mb_fld = !!(u1_top_mb_typ & D_FLD_MB); |
1541 | | |
1542 | 2.17M | if(!u4_bot_mb) |
1543 | 1.08M | { |
1544 | 1.08M | if(u4_top_mb_fld & u4_cur_mb_fld) |
1545 | 33.6k | u1_top_mb_typ = ps_deblk_top_mb[0].u1_mb_type; |
1546 | 1.05M | else |
1547 | 1.05M | { |
1548 | 1.05M | ps_top_mv_pred += 16; |
1549 | 1.05M | } |
1550 | 1.08M | } |
1551 | 2.17M | } |
1552 | 65.9k | else |
1553 | 65.9k | { |
1554 | 65.9k | u4_top_mb_fld = u4_cur_mb_fld; |
1555 | 65.9k | u1_top_mb_typ = 0; |
1556 | 65.9k | } |
1557 | | |
1558 | 2.24M | if(u4_bot_mb & !u4_cur_mb_fld) |
1559 | 1.07M | { |
1560 | 1.07M | u1_top_mb_typ = ps_deblk_top_mb[0].u1_mb_type; |
1561 | 1.07M | u4_top_mb_fld = u4_cur_mb_fld; |
1562 | 1.07M | ps_top_mv_pred = ps_cur_mv_pred - 4; |
1563 | 1.07M | } |
1564 | | |
1565 | 2.24M | pu4_bs_table = ps_cur_mb_params->u4_bs_table; |
1566 | 2.24M | u4_cur_mb_intra = u1_cur_mb_type & D_INTRA_MB; |
1567 | | |
1568 | 2.24M | u2_cur_csbp = ps_cur_mb_info->ps_curmb->u2_luma_csbp; |
1569 | 2.24M | u2_left_csbp = ps_cur_mb_info->ps_left_mb->u2_luma_csbp; |
1570 | 2.24M | u2_top_csbp = ps_cur_mb_info->ps_top_mb->u2_luma_csbp; |
1571 | | /* Compute BS function */ |
1572 | 2.24M | if(ps_dec->ps_cur_sps->u1_profile_idc == HIGH_PROFILE_IDC) |
1573 | 2.06M | { |
1574 | | |
1575 | 2.06M | if(ps_cur_mb_info->u1_tran_form8x8 == 1) |
1576 | 266k | { |
1577 | 266k | u2_cur_csbp = ih264d_update_csbp_8x8( |
1578 | 266k | ps_cur_mb_info->ps_curmb->u2_luma_csbp); |
1579 | 266k | } |
1580 | | |
1581 | 2.06M | if(ps_cur_mb_info->ps_left_mb->u1_tran_form8x8 == 1) |
1582 | 266k | { |
1583 | 266k | u2_left_csbp = ih264d_update_csbp_8x8( |
1584 | 266k | ps_cur_mb_info->ps_left_mb->u2_luma_csbp); |
1585 | 266k | } |
1586 | | |
1587 | 2.06M | if(ps_cur_mb_info->ps_top_mb->u1_tran_form8x8 == 1) |
1588 | 283k | { |
1589 | 283k | u2_top_csbp = ih264d_update_csbp_8x8( |
1590 | 283k | ps_cur_mb_info->ps_top_mb->u2_luma_csbp); |
1591 | 283k | } |
1592 | 2.06M | } |
1593 | 2.24M | if(u4_cur_mb_intra) |
1594 | 34.2k | { |
1595 | | |
1596 | 34.2k | pu4_bs_table[4] = 0x04040404; |
1597 | 34.2k | if((0 == u4_cur_mb_fld) && (0 == u4_top_mb_fld)) |
1598 | 15.1k | { |
1599 | 15.1k | pu4_bs_table[0] = 0x04040404; |
1600 | 15.1k | } |
1601 | 19.1k | else |
1602 | 19.1k | { |
1603 | 19.1k | pu4_bs_table[0] = 0x03030303; |
1604 | 19.1k | } |
1605 | | |
1606 | 34.2k | pu4_bs_table[1] = 0x03030303; |
1607 | 34.2k | pu4_bs_table[2] = 0x03030303; |
1608 | 34.2k | pu4_bs_table[3] = 0x03030303; |
1609 | 34.2k | pu4_bs_table[5] = 0x03030303; |
1610 | 34.2k | pu4_bs_table[6] = 0x03030303; |
1611 | 34.2k | pu4_bs_table[7] = 0x03030303; |
1612 | | |
1613 | | /*********************************************************************/ |
1614 | | /* Fill Bs of xtra top and left edge unconditionally to avoid checks */ |
1615 | | /*********************************************************************/ |
1616 | 34.2k | pu4_bs_table[8] = 0x03030303; |
1617 | 34.2k | pu4_bs_table[9] = 0x04040404; |
1618 | 34.2k | } |
1619 | 2.21M | else |
1620 | 2.21M | { |
1621 | 2.21M | UWORD32 u4_is_non16x16 = !!(u1_cur_mb_type & D_PRED_NON_16x16); |
1622 | 2.21M | UWORD32 u4_is_b = ps_dec->u1_B; |
1623 | | |
1624 | 2.21M | ih264d_fill_bs2_horz_vert( |
1625 | 2.21M | pu4_bs_table, u2_left_csbp, u2_top_csbp, u2_cur_csbp, |
1626 | 2.21M | (const UWORD32 *)(gau4_ih264d_packed_bs2), |
1627 | 2.21M | (const UWORD16 *)(gau2_ih264d_4x4_v2h_reorder)); |
1628 | | |
1629 | 2.21M | if(u4_leftmbtype & D_INTRA_MB) |
1630 | 17.5k | pu4_bs_table[4] = 0x04040404; |
1631 | | |
1632 | 2.21M | if(u1_top_mb_typ & D_INTRA_MB) |
1633 | 17.2k | pu4_bs_table[0] = u4_cur_mb_fld ? 0x03030303 : 0x04040404; |
1634 | 2.19M | else if(u4_cur_mb_fld != u4_top_mb_fld) |
1635 | 26.6k | { |
1636 | | /****************************************************/ |
1637 | | /* Setting BS for mixed mode edge=1 when (Bs!=2) */ |
1638 | | /****************************************************/ |
1639 | 26.6k | pu4_bs_table[0] = (pu4_bs_table[0] >> 1) + 0x01010101; |
1640 | 26.6k | } |
1641 | | |
1642 | 2.21M | { |
1643 | | /* Call to Compute Boundary Strength for Extra Left Edge */ |
1644 | 2.21M | if(u2_mbx |
1645 | 2.21M | && !(ps_cur_mb_params->u1_deblocking_mode |
1646 | 2.07M | & MB_DISABLE_LEFT_EDGE)) |
1647 | 2.07M | { |
1648 | 2.07M | if(u4_cur_mb_fld != u4_left_mb_fld) |
1649 | 37.2k | { |
1650 | 37.2k | UWORD32 u4_left_mb_t_csbp = |
1651 | 37.2k | ps_cur_mb_info->ps_left_mb[0].u2_luma_csbp; |
1652 | 37.2k | UWORD32 u4_left_mb_b_csbp = |
1653 | 37.2k | ps_cur_mb_info->ps_left_mb[1].u2_luma_csbp; |
1654 | 37.2k | if(1 == ps_cur_mb_info->ps_left_mb[0].u1_tran_form8x8) |
1655 | 5.37k | { |
1656 | 5.37k | u4_left_mb_t_csbp = (UWORD32)ih264d_update_csbp_8x8( |
1657 | 5.37k | (UWORD16)u4_left_mb_t_csbp); |
1658 | 5.37k | } |
1659 | | |
1660 | 37.2k | if(1 == ps_cur_mb_info->ps_left_mb[1].u1_tran_form8x8) |
1661 | 5.13k | { |
1662 | 5.13k | u4_left_mb_b_csbp = (UWORD32)ih264d_update_csbp_8x8( |
1663 | 5.13k | (UWORD16)u4_left_mb_b_csbp); |
1664 | 5.13k | } |
1665 | 37.2k | ps_dec->pf_fill_bs_xtra_left_edge[u4_cur_mb_fld]( |
1666 | 37.2k | pu4_bs_table, u4_left_mb_t_csbp, |
1667 | 37.2k | u4_left_mb_b_csbp, u2_cur_csbp, u4_bot_mb); |
1668 | | |
1669 | 37.2k | if(ps_dec->deblk_left_mb[0].u1_mb_type & D_INTRA_MB) |
1670 | 4.79k | pu4_bs_table[4] = 0x04040404; |
1671 | | |
1672 | 37.2k | if(ps_dec->deblk_left_mb[1].u1_mb_type & D_INTRA_MB) |
1673 | 5.15k | pu4_bs_table[9] = 0x04040404; |
1674 | | |
1675 | 37.2k | } |
1676 | 2.07M | } |
1677 | | /* Call to Compute Boundary Strength for Extra Top Edge */ |
1678 | 2.21M | if(u2_mby |
1679 | 2.21M | && !(ps_cur_mb_params->u1_deblocking_mode |
1680 | 2.14M | & MB_DISABLE_TOP_EDGE)) |
1681 | 2.14M | { |
1682 | 2.14M | if((((!u4_bot_mb) & (!u4_cur_mb_fld)) && u4_top_mb_fld)) |
1683 | 12.9k | { |
1684 | 12.9k | UWORD32 u4_topmb_t_csbp = |
1685 | 12.9k | ps_cur_mb_info->ps_top_mb[-1].u2_luma_csbp; |
1686 | 12.9k | UWORD32 u4_topmb_b_csbp = |
1687 | 12.9k | ps_cur_mb_info->ps_top_mb[0].u2_luma_csbp; |
1688 | 12.9k | if(1 == ps_cur_mb_info->ps_top_mb[-1].u1_tran_form8x8) |
1689 | 1.59k | { |
1690 | 1.59k | u4_topmb_t_csbp = (UWORD32)ih264d_update_csbp_8x8( |
1691 | 1.59k | (UWORD16)u4_topmb_t_csbp); |
1692 | 1.59k | } |
1693 | | |
1694 | 12.9k | if(1 == ps_cur_mb_info->ps_top_mb[0].u1_tran_form8x8) |
1695 | 1.63k | { |
1696 | 1.63k | u4_topmb_b_csbp = (UWORD32)ih264d_update_csbp_8x8( |
1697 | 1.63k | (UWORD16)u4_topmb_b_csbp); |
1698 | 1.63k | } |
1699 | 12.9k | ih264d_fill_bs_xtra_top_edge(pu4_bs_table, u4_topmb_t_csbp, |
1700 | 12.9k | u4_topmb_b_csbp, u2_cur_csbp); |
1701 | | |
1702 | 12.9k | if(ps_deblk_top_mb[0].u1_mb_type & D_INTRA_MB) |
1703 | 2.48k | pu4_bs_table[8] = 0x03030303; |
1704 | | |
1705 | 12.9k | if(ps_deblk_top_mb[1].u1_mb_type & D_INTRA_MB) |
1706 | 2.66k | pu4_bs_table[0] = 0x03030303; |
1707 | 12.9k | } |
1708 | 2.14M | } |
1709 | 2.21M | } |
1710 | | |
1711 | 2.21M | ps_dec->pf_fill_bs1[u4_is_b][u4_is_non16x16]( |
1712 | 2.21M | ps_cur_mv_pred, ps_top_mv_pred, apv_map_ref_idx_to_poc, |
1713 | 2.21M | pu4_bs_table, ps_left_mv_pred, ps_left_ngbr, |
1714 | 2.21M | ps_cur_mb_info->ps_top_mb->u4_pic_addrress, |
1715 | 2.21M | (4 >> u4_cur_mb_fld)); |
1716 | 2.21M | } |
1717 | | |
1718 | 2.24M | { |
1719 | 2.24M | void ** pu4_map_ref_idx_to_poc_l1 = apv_map_ref_idx_to_poc + |
1720 | 2.24M | POC_LIST_L0_TO_L1_DIFF; |
1721 | | |
1722 | 2.24M | { |
1723 | | /* Store Parameter for Top MvPred refernce frame Address */ |
1724 | 2.24M | void ** ppv_top_mv_pred_addr = ps_cur_mb_info->ps_curmb->u4_pic_addrress; |
1725 | 2.24M | void ** ppv_left_mv_pred_addr = |
1726 | 2.24M | ps_dec->ps_left_mvpred_addr[!u1_pingpong][u4_bot_mb].u4_add; |
1727 | 2.24M | WORD8 * p1_refTop0 = (ps_cur_mv_pred + 12)->i1_ref_frame; |
1728 | 2.24M | WORD8 * p1_refTop1 = (ps_cur_mv_pred + 14)->i1_ref_frame; |
1729 | 2.24M | WORD8 * p1_refLeft0 = (ps_cur_mv_pred + 3)->i1_ref_frame; |
1730 | 2.24M | ppv_top_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refTop0[0]]; |
1731 | 2.24M | ppv_top_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refTop0[1]]; |
1732 | 2.24M | ppv_left_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]]; |
1733 | 2.24M | ppv_top_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]]; |
1734 | 2.24M | ppv_left_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]]; |
1735 | 2.24M | ppv_top_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]]; |
1736 | 2.24M | ppv_left_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refLeft0[0]]; |
1737 | 2.24M | ppv_left_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refLeft0[1]]; |
1738 | 2.24M | } |
1739 | 2.24M | if(u4_bot_mb) |
1740 | 1.12M | { |
1741 | | /* store The Left Mb Type*/ |
1742 | 1.12M | ps_dec->deblk_left_mb[0].u1_mb_type = |
1743 | 1.12M | (ps_cur_mb_params - 1)->u1_mb_type; |
1744 | 1.12M | ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type; |
1745 | | |
1746 | 1.12M | } |
1747 | 2.24M | ps_deblk_top_mb[u4_bot_mb].u1_mb_type = u1_cur_mb_type; |
1748 | 2.24M | } |
1749 | | /* For transform 8x8 disable deblocking of the intrernal edges of a 8x8 block */ |
1750 | 2.24M | if(ps_cur_mb_info->u1_tran_form8x8) |
1751 | 266k | { |
1752 | 266k | pu4_bs_table[1] = 0; |
1753 | 266k | pu4_bs_table[3] = 0; |
1754 | 266k | pu4_bs_table[5] = 0; |
1755 | 266k | pu4_bs_table[7] = 0; |
1756 | 266k | } |
1757 | | |
1758 | 2.24M | } |
1759 | | |
1760 | | |
1761 | | |
1762 | | /*! |
1763 | | ************************************************************************** |
1764 | | * \if Function name : ih264d_fill_bs_for_mb \endif |
1765 | | * |
1766 | | * \brief |
1767 | | * Determines the boundary strength (Bs), for the complete MB. Bs is |
1768 | | * determined for each block boundary between two neighbouring 4x4 |
1769 | | * luma blocks, then packed in a UWORD32, first Bs placed in MSB and |
1770 | | * so on. Such packed Bs values for all 8 edges are kept in an array. |
1771 | | * |
1772 | | * \return |
1773 | | * Returns the packed boundary strength(Bs) MSB -> LSB Bs0|Bs1|Bs2|Bs3 |
1774 | | * |
1775 | | ************************************************************************** |
1776 | | */ |
1777 | | |
1778 | | void ih264d_fill_bs_for_mb(deblk_mb_t * ps_cur_mb_params, |
1779 | | deblk_mb_t * ps_top_mb_params, |
1780 | | deblk_mb_t * ps_left_mb_params, |
1781 | | mv_pred_t *ps_cur_mv_pred, |
1782 | | mv_pred_t *ps_top_mv_pred, |
1783 | | UWORD8 *puc_cur_nnz, |
1784 | | UWORD8 *puc_top_nnz, |
1785 | | void **ppv_map_ref_idx_to_poc, |
1786 | | UWORD32 ui_mbAff, |
1787 | | UWORD32 ui_bs_table[], /* pointer to the BsTable array */ |
1788 | | mv_pred_t *ps_leftmost_mv_pred, |
1789 | | neighbouradd_t *ps_left_addr, |
1790 | | neighbouradd_t *ps_top_add) |
1791 | 0 | { |
1792 | 0 | UWORD32 u4_bs_horz = 0; |
1793 | 0 | UWORD8 edge, u1_top_intra = 0, u1_left_intra = 0; |
1794 | 0 | mv_pred_t *ps_left_mv_pred; |
1795 | 0 | WORD16 i2_cur_mv0, i2_cur_mv1, i16_curMv2, i16_curMv3; |
1796 | 0 | WORD16 i2_left_mv0, i2_left_mv1, i2_left_mv2, i2_left_mv3; |
1797 | 0 | WORD16 i2_top_mv0, i2_top_mv1, i16_topMv2, i16_topMv3; |
1798 | 0 | WORD8 i1_cur_ref0, i1_cur_ref1, i1_left_ref0, i1_left_ref1, i1_top_ref0, i1_top_ref1; |
1799 | 0 | UWORD8 uc_cur_nnz, uc_left_nnz, uc_top_nnz, u1_mb_type, uc_Bslice; |
1800 | 0 | void **ppv_map_ref_idx_to_poc_l0, **ppv_map_ref_idx_to_poc_l1; |
1801 | 0 | UWORD8 uc_temp; |
1802 | 0 | UWORD8 uc_cur_mb_fld, uc_top_mb_fld; |
1803 | 0 | UWORD32 c_mv_limit; |
1804 | |
|
1805 | 0 | u1_mb_type = ps_cur_mb_params->u1_mb_type; |
1806 | 0 | uc_Bslice = u1_mb_type & D_B_SLICE; |
1807 | 0 | ppv_map_ref_idx_to_poc_l0 = ppv_map_ref_idx_to_poc; |
1808 | 0 | ppv_map_ref_idx_to_poc_l1 = ppv_map_ref_idx_to_poc + POC_LIST_L0_TO_L1_DIFF; |
1809 | |
|
1810 | 0 | ps_top_mb_params = ps_top_mb_params ? ps_top_mb_params : ps_cur_mb_params; |
1811 | 0 | u1_top_intra = ps_top_mb_params->u1_mb_type & D_INTRA_MB; |
1812 | 0 | u1_left_intra = ps_left_mb_params->u1_mb_type & D_INTRA_MB; |
1813 | |
|
1814 | 0 | ui_bs_table[4] = 0x04040404; //Default for INTRA MB Boundary edges. |
1815 | 0 | uc_cur_mb_fld = (ps_cur_mb_params->u1_mb_type & D_FLD_MB) >> 7; |
1816 | 0 | uc_top_mb_fld = (ps_top_mb_params->u1_mb_type & D_FLD_MB) >> 7; |
1817 | |
|
1818 | 0 | c_mv_limit = 4 >> uc_cur_mb_fld; |
1819 | 0 | if((0 == uc_cur_mb_fld) && (0 == uc_top_mb_fld)) |
1820 | 0 | { |
1821 | 0 | ui_bs_table[0] = 0x04040404; |
1822 | 0 | } |
1823 | 0 | else |
1824 | 0 | { |
1825 | 0 | ui_bs_table[0] = 0x03030303; |
1826 | 0 | } |
1827 | |
|
1828 | 0 | for(edge = 0; edge < 4; |
1829 | 0 | edge++, ps_top_mv_pred = ps_cur_mv_pred - 4, puc_top_nnz = |
1830 | 0 | puc_cur_nnz - 4) |
1831 | 0 | { |
1832 | | //Each iteration of this loop fills the four BS values of one HORIZ edge and |
1833 | | //one BS value for each of the four VERT edges. |
1834 | 0 | WORD8 i = 0; |
1835 | 0 | UWORD8 uc_bs_horiz, uc_bs_vert; |
1836 | 0 | UWORD32 ui_cnd; |
1837 | 0 | void *ui_ref_pic_addr[4]; |
1838 | 0 | UWORD8 uc_mixed_mode_edge; |
1839 | |
|
1840 | 0 | uc_mixed_mode_edge = 0; |
1841 | |
|
1842 | 0 | uc_temp = (ui_mbAff << 4) + 13; |
1843 | |
|
1844 | 0 | uc_cur_nnz = *(puc_cur_nnz - uc_temp); |
1845 | 0 | ps_left_mv_pred = ps_leftmost_mv_pred + (edge << 2); |
1846 | |
|
1847 | 0 | for(i = 0; i < 4; i++, ps_top_mv_pred++, ps_cur_mv_pred++) |
1848 | 0 | { |
1849 | | //Each iteration of this inner loop computes a HORIZ |
1850 | | //and a VERT BS value for a 4x4 block |
1851 | |
|
1852 | 0 | uc_left_nnz = uc_cur_nnz; |
1853 | 0 | uc_cur_nnz = *puc_cur_nnz++; |
1854 | 0 | uc_top_nnz = *puc_top_nnz++; |
1855 | | |
1856 | | //VERT edge is assigned BS values first |
1857 | 0 | ui_cnd = !(uc_left_nnz || uc_cur_nnz); |
1858 | 0 | uc_bs_vert = 2; |
1859 | |
|
1860 | 0 | if(ui_cnd) |
1861 | 0 | { |
1862 | 0 | i2_left_mv0 = ps_left_mv_pred->i2_mv[0]; |
1863 | 0 | i2_left_mv1 = ps_left_mv_pred->i2_mv[1]; |
1864 | 0 | i2_left_mv2 = ps_left_mv_pred->i2_mv[2]; |
1865 | 0 | i2_left_mv3 = ps_left_mv_pred->i2_mv[3]; |
1866 | |
|
1867 | 0 | i2_cur_mv0 = ps_cur_mv_pred->i2_mv[0]; |
1868 | 0 | i2_cur_mv1 = ps_cur_mv_pred->i2_mv[1]; |
1869 | 0 | i16_curMv2 = ps_cur_mv_pred->i2_mv[2]; |
1870 | 0 | i16_curMv3 = ps_cur_mv_pred->i2_mv[3]; |
1871 | 0 | i1_cur_ref0 = ps_cur_mv_pred->i1_ref_frame[0]; |
1872 | 0 | i1_cur_ref1 = ps_cur_mv_pred->i1_ref_frame[1]; |
1873 | 0 | ui_ref_pic_addr[2] = ppv_map_ref_idx_to_poc_l0[i1_cur_ref0]; |
1874 | 0 | ui_ref_pic_addr[3] = ppv_map_ref_idx_to_poc_l1[i1_cur_ref1]; |
1875 | |
|
1876 | 0 | if(i) |
1877 | 0 | { |
1878 | 0 | i1_left_ref0 = ps_left_mv_pred->i1_ref_frame[0]; |
1879 | 0 | i1_left_ref1 = ps_left_mv_pred->i1_ref_frame[1]; |
1880 | 0 | ui_ref_pic_addr[0] = ppv_map_ref_idx_to_poc_l0[i1_left_ref0]; |
1881 | 0 | ui_ref_pic_addr[1] = ppv_map_ref_idx_to_poc_l1[i1_left_ref1]; |
1882 | 0 | } |
1883 | 0 | else |
1884 | 0 | { |
1885 | 0 | ui_ref_pic_addr[0] = ps_left_addr->u4_add[edge & 2]; |
1886 | 0 | ui_ref_pic_addr[1] = ps_left_addr->u4_add[1 + (edge & 2)]; |
1887 | 0 | } |
1888 | 0 | if(!uc_Bslice) |
1889 | 0 | { |
1890 | 0 | uc_bs_vert = |
1891 | 0 | (ui_ref_pic_addr[0] != ui_ref_pic_addr[2]) |
1892 | 0 | | (ABS((i2_left_mv0 |
1893 | 0 | - i2_cur_mv0)) |
1894 | 0 | >= 4) |
1895 | 0 | | (ABS((i2_left_mv1 |
1896 | 0 | - i2_cur_mv1)) |
1897 | 0 | >= (UWORD8)c_mv_limit); |
1898 | 0 | } |
1899 | 0 | else |
1900 | 0 | { |
1901 | 0 | UWORD8 uc_bs_temp1, uc_bs_temp2; |
1902 | |
|
1903 | 0 | uc_bs_vert = 1; |
1904 | |
|
1905 | 0 | uc_bs_temp1 = |
1906 | 0 | ((ABS((i2_left_mv0 - i2_cur_mv0)) |
1907 | 0 | >= 4) |
1908 | 0 | | (ABS((i2_left_mv1 |
1909 | 0 | - i2_cur_mv1)) |
1910 | 0 | >= (UWORD8)c_mv_limit) |
1911 | 0 | | (ABS((i2_left_mv2 |
1912 | 0 | - i16_curMv2)) |
1913 | 0 | >= 4) |
1914 | 0 | | (ABS((i2_left_mv3 |
1915 | 0 | - i16_curMv3)) |
1916 | 0 | >= (UWORD8)c_mv_limit)); |
1917 | |
|
1918 | 0 | uc_bs_temp2 = |
1919 | 0 | ((ABS((i2_left_mv0 - i16_curMv2)) |
1920 | 0 | >= 4) |
1921 | 0 | | (ABS((i2_left_mv1 |
1922 | 0 | - i16_curMv3)) |
1923 | 0 | >= (UWORD8)c_mv_limit) |
1924 | 0 | | (ABS((i2_left_mv2 |
1925 | 0 | - i2_cur_mv0)) |
1926 | 0 | >= 4) |
1927 | 0 | | (ABS((i2_left_mv3 |
1928 | 0 | - i2_cur_mv1)) |
1929 | 0 | >= (UWORD8)c_mv_limit)); |
1930 | |
|
1931 | 0 | uc_bs_vert = |
1932 | 0 | (((ui_ref_pic_addr[0] != ui_ref_pic_addr[2]) |
1933 | 0 | || (ui_ref_pic_addr[1] |
1934 | 0 | != ui_ref_pic_addr[3])) |
1935 | 0 | || (uc_bs_temp1)) |
1936 | 0 | && (((ui_ref_pic_addr[0] |
1937 | 0 | != ui_ref_pic_addr[3]) |
1938 | 0 | || (ui_ref_pic_addr[1] |
1939 | 0 | != ui_ref_pic_addr[2])) |
1940 | 0 | || (uc_bs_temp2)); |
1941 | |
|
1942 | 0 | } |
1943 | 0 | } |
1944 | | //Fill the VERT BS, only if valid i.e., |
1945 | | //if it is a non-edge OR it is an edge, which is not yet filled |
1946 | 0 | uc_bs_vert = (!i && u1_left_intra) ? 4 : uc_bs_vert; |
1947 | 0 | ui_bs_table[i + 4] = (ui_bs_table[i + 4] << 8) | uc_bs_vert; |
1948 | | |
1949 | | //HORIZ edge is assigned BS values next |
1950 | 0 | ui_cnd = !(uc_top_nnz || uc_cur_nnz); |
1951 | 0 | uc_bs_horiz = 2; |
1952 | |
|
1953 | 0 | if(ui_cnd) |
1954 | 0 | { |
1955 | 0 | uc_mixed_mode_edge = |
1956 | 0 | (0 == edge) ? (uc_top_mb_fld != uc_cur_mb_fld) : 0; |
1957 | 0 | ui_cnd = 1 - uc_mixed_mode_edge; |
1958 | 0 | uc_bs_horiz = uc_mixed_mode_edge; |
1959 | 0 | } |
1960 | |
|
1961 | 0 | if(ui_cnd) |
1962 | 0 | { |
1963 | 0 | i2_cur_mv0 = ps_cur_mv_pred->i2_mv[0]; |
1964 | 0 | i2_cur_mv1 = ps_cur_mv_pred->i2_mv[1]; |
1965 | 0 | i16_curMv2 = ps_cur_mv_pred->i2_mv[2]; |
1966 | 0 | i16_curMv3 = ps_cur_mv_pred->i2_mv[3]; |
1967 | 0 | i1_cur_ref0 = ps_cur_mv_pred->i1_ref_frame[0]; |
1968 | 0 | i1_cur_ref1 = ps_cur_mv_pred->i1_ref_frame[1]; |
1969 | |
|
1970 | 0 | i2_top_mv0 = ps_top_mv_pred->i2_mv[0]; |
1971 | 0 | i2_top_mv1 = ps_top_mv_pred->i2_mv[1]; |
1972 | 0 | i16_topMv2 = ps_top_mv_pred->i2_mv[2]; |
1973 | 0 | i16_topMv3 = ps_top_mv_pred->i2_mv[3]; |
1974 | 0 | ui_ref_pic_addr[2] = ppv_map_ref_idx_to_poc_l0[i1_cur_ref0]; |
1975 | 0 | ui_ref_pic_addr[3] = ppv_map_ref_idx_to_poc_l1[i1_cur_ref1]; |
1976 | 0 | if(edge) |
1977 | 0 | { |
1978 | 0 | i1_top_ref0 = ps_top_mv_pred->i1_ref_frame[0]; |
1979 | 0 | i1_top_ref1 = ps_top_mv_pred->i1_ref_frame[1]; |
1980 | 0 | ui_ref_pic_addr[0] = ppv_map_ref_idx_to_poc_l0[i1_top_ref0]; |
1981 | 0 | ui_ref_pic_addr[1] = ppv_map_ref_idx_to_poc_l1[i1_top_ref1]; |
1982 | 0 | } |
1983 | 0 | else |
1984 | 0 | { |
1985 | 0 | ui_ref_pic_addr[0] = ps_top_add->u4_add[i & 2]; |
1986 | 0 | ui_ref_pic_addr[1] = ps_top_add->u4_add[1 + (i & 2)]; |
1987 | 0 | } |
1988 | 0 | if(!uc_Bslice) |
1989 | 0 | { |
1990 | 0 | uc_bs_horiz = |
1991 | 0 | (ui_ref_pic_addr[0] != ui_ref_pic_addr[2]) |
1992 | 0 | | (ABS((i2_top_mv0 |
1993 | 0 | - i2_cur_mv0)) |
1994 | 0 | >= 4) |
1995 | 0 | | (ABS((i2_top_mv1 |
1996 | 0 | - i2_cur_mv1)) |
1997 | 0 | >= (UWORD8)c_mv_limit); |
1998 | 0 | } |
1999 | 0 | else |
2000 | 0 | { |
2001 | 0 | UWORD8 uc_bs_temp1, uc_bs_temp2; |
2002 | |
|
2003 | 0 | uc_bs_horiz = 1; |
2004 | |
|
2005 | 0 | uc_bs_temp1 = |
2006 | 0 | ((ABS((i2_top_mv0 - i2_cur_mv0)) |
2007 | 0 | >= 4) |
2008 | 0 | | (ABS((i2_top_mv1 |
2009 | 0 | - i2_cur_mv1)) |
2010 | 0 | >= (UWORD8)c_mv_limit) |
2011 | 0 | | (ABS((i16_topMv2 |
2012 | 0 | - i16_curMv2)) |
2013 | 0 | >= 4) |
2014 | 0 | | (ABS((i16_topMv3 |
2015 | 0 | - i16_curMv3)) |
2016 | 0 | >= (UWORD8)c_mv_limit)); |
2017 | |
|
2018 | 0 | uc_bs_temp2 = |
2019 | 0 | ((ABS((i2_top_mv0 - i16_curMv2)) |
2020 | 0 | >= 4) |
2021 | 0 | | (ABS((i2_top_mv1 |
2022 | 0 | - i16_curMv3)) |
2023 | 0 | >= (UWORD8)c_mv_limit) |
2024 | 0 | | (ABS((i16_topMv2 |
2025 | 0 | - i2_cur_mv0)) |
2026 | 0 | >= 4) |
2027 | 0 | | (ABS((i16_topMv3 |
2028 | 0 | - i2_cur_mv1)) |
2029 | 0 | >= (UWORD8)c_mv_limit)); |
2030 | |
|
2031 | 0 | uc_bs_horiz = |
2032 | 0 | (((ui_ref_pic_addr[0] != ui_ref_pic_addr[2]) |
2033 | 0 | || (ui_ref_pic_addr[1] |
2034 | 0 | != ui_ref_pic_addr[3])) |
2035 | 0 | || (uc_bs_temp1)) |
2036 | 0 | && (((ui_ref_pic_addr[0] |
2037 | 0 | != ui_ref_pic_addr[3]) |
2038 | 0 | || (ui_ref_pic_addr[1] |
2039 | 0 | != ui_ref_pic_addr[2])) |
2040 | 0 | || (uc_bs_temp2)); |
2041 | |
|
2042 | 0 | } |
2043 | 0 | } |
2044 | 0 | ps_left_mv_pred = ps_cur_mv_pred; |
2045 | 0 | u4_bs_horz = (u4_bs_horz << 8) + uc_bs_horiz; |
2046 | 0 | } |
2047 | | //Fill the HORIZ BS, only if valid i.e., |
2048 | | //if it is a non-edge OR it is an edge, which is not yet filled |
2049 | 0 | if(edge || (!edge && !u1_top_intra)) |
2050 | 0 | ui_bs_table[edge] = u4_bs_horz; |
2051 | 0 | } |
2052 | 0 | } |
2053 | | |
2054 | | /*! |
2055 | | ************************************************************************** |
2056 | | * \if Function name : ih264d_fill_bs_for_extra_left_edge \endif |
2057 | | * |
2058 | | * \brief |
2059 | | * Fills the boundary strength (Bs), for the top extra edge. ock |
2060 | | * |
2061 | | * \return |
2062 | | * Returns the packed boundary strength(Bs) MSB -> LSB Bs0|Bs1|Bs2|Bs3 |
2063 | | * |
2064 | | ************************************************************************** |
2065 | | */ |
2066 | | void ih264d_fill_bs_for_extra_left_edge(deblk_mb_t *ps_cur_deblk_mb, |
2067 | | deblk_mb_t *ps_leftDeblkMb, |
2068 | | UWORD8* puc_cur_nnz, |
2069 | | UWORD8 uc_botMb) |
2070 | 0 | { |
2071 | | /* Set the Flag in uc_deblocking_mode variable of current MB*/ |
2072 | | /* for mixed mode edge*/ |
2073 | 0 | ps_cur_deblk_mb->u1_single_call = 0; |
2074 | |
|
2075 | 0 | if(ps_cur_deblk_mb->u1_mb_type & D_INTRA_MB) |
2076 | 0 | { |
2077 | 0 | ps_cur_deblk_mb->u4_bs_table[4] = 0x04040404; |
2078 | 0 | ps_cur_deblk_mb->u4_bs_table[9] = 0x04040404; |
2079 | 0 | } |
2080 | 0 | else if((ps_leftDeblkMb->u1_mb_type & D_INTRA_MB) |
2081 | 0 | && ((ps_leftDeblkMb + 1)->u1_mb_type & D_INTRA_MB)) |
2082 | 0 | { |
2083 | 0 | ps_cur_deblk_mb->u4_bs_table[4] = 0x04040404; |
2084 | 0 | ps_cur_deblk_mb->u4_bs_table[9] = 0x04040404; |
2085 | 0 | } |
2086 | 0 | else |
2087 | 0 | { |
2088 | | /* Get strengths of left MB edge */ |
2089 | 0 | UWORD32 u4_bs; |
2090 | 0 | UWORD8 uc_Bs; |
2091 | 0 | WORD32 i; |
2092 | 0 | UWORD32 ui_curMbFld; |
2093 | 0 | UWORD8 *puc_left_nnz; |
2094 | 0 | UWORD32 ui_bs_left_edge[2]; |
2095 | |
|
2096 | 0 | ui_curMbFld = (ps_cur_deblk_mb->u1_mb_type & D_FLD_MB) >> 7; |
2097 | |
|
2098 | 0 | puc_left_nnz = puc_cur_nnz - 29; |
2099 | 0 | if((ui_curMbFld == 0) && uc_botMb) |
2100 | 0 | { |
2101 | 0 | puc_left_nnz -= 8; |
2102 | 0 | } |
2103 | 0 | else if(ui_curMbFld && uc_botMb) |
2104 | 0 | { |
2105 | 0 | puc_left_nnz -= 16; |
2106 | 0 | } |
2107 | |
|
2108 | 0 | if(ui_curMbFld) |
2109 | 0 | { |
2110 | 0 | if(ps_leftDeblkMb->u1_mb_type & D_INTRA_MB) |
2111 | 0 | { |
2112 | 0 | ui_bs_left_edge[0] = 0x04040404; |
2113 | 0 | puc_left_nnz += 16; |
2114 | 0 | puc_cur_nnz += 8; |
2115 | 0 | } |
2116 | 0 | else |
2117 | 0 | { |
2118 | 0 | u4_bs = 0; |
2119 | 0 | for(i = 4; i > 0; i--) |
2120 | 0 | { |
2121 | 0 | uc_Bs = ((*puc_cur_nnz || *puc_left_nnz)) ? 2 : 1; |
2122 | 0 | u4_bs = (u4_bs << 8) | uc_Bs; |
2123 | 0 | puc_left_nnz += 4; |
2124 | 0 | if(i & 0x01) |
2125 | 0 | puc_cur_nnz += 4; |
2126 | 0 | } |
2127 | 0 | ui_bs_left_edge[0] = u4_bs; |
2128 | 0 | } |
2129 | |
|
2130 | 0 | if((ps_leftDeblkMb + 1)->u1_mb_type & D_INTRA_MB) |
2131 | 0 | { |
2132 | 0 | ui_bs_left_edge[1] = 0x04040404; |
2133 | 0 | } |
2134 | 0 | else |
2135 | 0 | { |
2136 | 0 | u4_bs = 0; |
2137 | 0 | for(i = 4; i > 0; i--) |
2138 | 0 | { |
2139 | 0 | uc_Bs = ((*puc_cur_nnz || *puc_left_nnz)) ? 2 : 1; |
2140 | 0 | u4_bs = (u4_bs << 8) | uc_Bs; |
2141 | 0 | puc_left_nnz += 4; |
2142 | 0 | if(i & 0x01) |
2143 | 0 | puc_cur_nnz += 4; |
2144 | 0 | } |
2145 | 0 | ui_bs_left_edge[1] = u4_bs; |
2146 | 0 | } |
2147 | 0 | } |
2148 | 0 | else |
2149 | 0 | { |
2150 | 0 | UWORD8 *puc_curNnzB, *puc_leftNnzB; |
2151 | 0 | puc_curNnzB = puc_cur_nnz; |
2152 | 0 | puc_leftNnzB = puc_left_nnz + 16; |
2153 | 0 | if(ps_leftDeblkMb->u1_mb_type & D_INTRA_MB) |
2154 | 0 | { |
2155 | 0 | ui_bs_left_edge[0] = 0x04040404; |
2156 | 0 | } |
2157 | 0 | else |
2158 | 0 | { |
2159 | 0 | u4_bs = 0; |
2160 | 0 | for(i = 4; i > 0; i--, puc_cur_nnz += 4) |
2161 | 0 | { |
2162 | 0 | uc_Bs = ((*puc_cur_nnz || *puc_left_nnz)) ? 2 : 1; |
2163 | 0 | u4_bs = (u4_bs << 8) | uc_Bs; |
2164 | 0 | if(i & 0x01) |
2165 | 0 | puc_left_nnz += 4; |
2166 | 0 | } |
2167 | 0 | ui_bs_left_edge[0] = u4_bs; |
2168 | 0 | } |
2169 | |
|
2170 | 0 | if((ps_leftDeblkMb + 1)->u1_mb_type & D_INTRA_MB) |
2171 | 0 | { |
2172 | 0 | ui_bs_left_edge[1] = 0x04040404; |
2173 | 0 | } |
2174 | 0 | else |
2175 | 0 | { |
2176 | 0 | u4_bs = 0; |
2177 | 0 | for(i = 4; i > 0; i--, puc_curNnzB += 4) |
2178 | 0 | { |
2179 | 0 | uc_Bs = ((*puc_curNnzB || *puc_leftNnzB)) ? 2 : 1; |
2180 | 0 | u4_bs = (u4_bs << 8) | uc_Bs; |
2181 | 0 | if(i & 0x01) |
2182 | 0 | puc_leftNnzB += 4; |
2183 | 0 | } |
2184 | 0 | ui_bs_left_edge[1] = u4_bs; |
2185 | 0 | } |
2186 | 0 | } |
2187 | | /* Copy The Values in Cur Deblk Mb Parameters */ |
2188 | 0 | ps_cur_deblk_mb->u4_bs_table[4] = ui_bs_left_edge[0]; |
2189 | 0 | ps_cur_deblk_mb->u4_bs_table[9] = ui_bs_left_edge[1]; |
2190 | 0 | } |
2191 | |
|
2192 | 0 | } |
2193 | | |
2194 | | /*! |
2195 | | ************************************************************************** |
2196 | | * \if Function name : ih264d_fill_bs_for_extra_top_edge \endif |
2197 | | * |
2198 | | * \brief |
2199 | | * Fills the boundary strength (Bs), for the top extra edge. ock |
2200 | | * |
2201 | | * \return |
2202 | | * Returns the packed boundary strength(Bs) MSB -> LSB Bs0|Bs1|Bs2|Bs3 |
2203 | | * |
2204 | | ************************************************************************** |
2205 | | */ |
2206 | | void ih264d_fill_bs_for_extra_top_edge(deblk_mb_t *ps_cur_mb_params, |
2207 | | UWORD8 u1_Edge0_mb_typ, |
2208 | | UWORD8 u1_Edge1_mb_typ, |
2209 | | UWORD8 *pu1_curNnz, |
2210 | | UWORD8 *pu1_topNnz) |
2211 | 0 | { |
2212 | 0 | UWORD32 u4_bs; |
2213 | 0 | UWORD8 uc_Bs; |
2214 | 0 | WORD32 i; |
2215 | 0 | UWORD8 *pu1_cur_nnz_tmp; |
2216 | 0 | UWORD8 *pu1_top_nnz_tmp; |
2217 | 0 | UWORD8 u1_top_edge; |
2218 | 0 | UWORD8 u1_top_mb_type; |
2219 | 0 | for(u1_top_edge = 0; u1_top_edge < 2; u1_top_edge++) |
2220 | 0 | { |
2221 | 0 | u1_top_mb_type = u1_top_edge ? u1_Edge1_mb_typ : u1_Edge0_mb_typ; |
2222 | 0 | pu1_cur_nnz_tmp = pu1_curNnz; |
2223 | 0 | pu1_top_nnz_tmp = pu1_topNnz + (u1_top_edge << 2); |
2224 | |
|
2225 | 0 | if((ps_cur_mb_params->u1_mb_type & D_INTRA_MB) |
2226 | 0 | + (u1_top_mb_type & D_INTRA_MB)) |
2227 | 0 | { |
2228 | 0 | u4_bs = 0x03030303; |
2229 | 0 | } |
2230 | 0 | else |
2231 | 0 | { |
2232 | 0 | u4_bs = 0; |
2233 | 0 | for(i = 4; i > 0; i--, pu1_cur_nnz_tmp += 1, pu1_top_nnz_tmp += 1) |
2234 | 0 | { |
2235 | 0 | uc_Bs = ((*pu1_cur_nnz_tmp || *pu1_top_nnz_tmp)) ? 2 : 1; |
2236 | 0 | u4_bs = (u4_bs << 8) | uc_Bs; |
2237 | 0 | } |
2238 | 0 | } |
2239 | 0 | if(u1_top_edge) |
2240 | 0 | ps_cur_mb_params->u4_bs_table[0] = u4_bs; |
2241 | 0 | else |
2242 | 0 | ps_cur_mb_params->u4_bs_table[8] = u4_bs; |
2243 | 0 | } |
2244 | 0 | } |
2245 | | |
2246 | | |
2247 | | void ih264d_fill_bs_mbedge_4(dec_struct_t * ps_dec, |
2248 | | dec_mb_info_t * ps_cur_mb_info, |
2249 | | const UWORD16 u2_mbxn_mb) |
2250 | 0 | { |
2251 | | |
2252 | | /* deblk_mb_t Params */ |
2253 | 0 | deblk_mb_t *ps_cur_mb_params; /*< Parameters of current MacroBlock */ |
2254 | 0 | deblkmb_neighbour_t *ps_deblk_top_mb; |
2255 | 0 | UWORD32 * pu4_bs_table; |
2256 | 0 | UWORD8 u1_cur_mb_type; |
2257 | | |
2258 | | /* Neighbour availability */ |
2259 | | /* Initialization */ |
2260 | 0 | const UWORD32 u2_mbx = ps_cur_mb_info->u2_mbx; |
2261 | 0 | const UWORD32 u2_mby = ps_cur_mb_info->u2_mby; |
2262 | 0 | const UWORD32 u1_pingpong = u2_mbx & 0x01; |
2263 | 0 | ps_deblk_top_mb = ps_dec->ps_deblk_top_mb + u2_mbx; |
2264 | | |
2265 | | |
2266 | | /* Pointer assignment for Current DeblkMB, Current Mv Pred */ |
2267 | 0 | ps_cur_mb_params = ps_dec->ps_deblk_mbn + u2_mbxn_mb; |
2268 | |
|
2269 | 0 | u1_cur_mb_type = ps_cur_mb_params->u1_mb_type; |
2270 | |
|
2271 | 0 | ps_deblk_top_mb->u1_mb_type = u1_cur_mb_type; |
2272 | |
|
2273 | 0 | { |
2274 | 0 | UWORD8 mb_qp_temp; |
2275 | |
|
2276 | 0 | ps_cur_mb_params->u1_topmb_qp = ps_deblk_top_mb->u1_mb_qp; |
2277 | 0 | ps_deblk_top_mb->u1_mb_qp = ps_cur_mb_params->u1_mb_qp; |
2278 | |
|
2279 | 0 | ps_cur_mb_params->u1_left_mb_qp = ps_dec->deblk_left_mb[1].u1_mb_qp; |
2280 | 0 | ps_dec->deblk_left_mb[1].u1_mb_qp = ps_cur_mb_params->u1_mb_qp; |
2281 | |
|
2282 | 0 | } |
2283 | |
|
2284 | 0 | ps_cur_mb_params->u1_single_call = 1; |
2285 | |
|
2286 | 0 | ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type; |
2287 | | /* if no deblocking required for current Mb then continue */ |
2288 | | /* Check next Mbs in Mb group */ |
2289 | 0 | if(ps_cur_mb_params->u1_deblocking_mode & MB_DISABLE_FILTERING) |
2290 | 0 | { |
2291 | | /* Storing the leftMbtype for next Mb */ |
2292 | 0 | return; |
2293 | 0 | } |
2294 | | |
2295 | | /* Compute BS function */ |
2296 | 0 | pu4_bs_table = ps_cur_mb_params->u4_bs_table; |
2297 | |
|
2298 | 0 | pu4_bs_table[4] = 0x04040404; |
2299 | 0 | pu4_bs_table[0] = 0x04040404; |
2300 | 0 | pu4_bs_table[1] = 0; |
2301 | 0 | pu4_bs_table[2] = 0; |
2302 | 0 | pu4_bs_table[3] = 0; |
2303 | 0 | pu4_bs_table[5] = 0; |
2304 | 0 | pu4_bs_table[6] = 0; |
2305 | 0 | pu4_bs_table[7] = 0; |
2306 | |
|
2307 | 0 | } |
2308 | | |
2309 | | void ih264d_fill_bs_mbedge_2(dec_struct_t * ps_dec, |
2310 | | dec_mb_info_t * ps_cur_mb_info, |
2311 | | const UWORD16 u2_mbxn_mb) |
2312 | 0 | { |
2313 | | |
2314 | | /* deblk_mb_t Params */ |
2315 | 0 | deblk_mb_t *ps_cur_mb_params; /*< Parameters of current MacroBlock */ |
2316 | 0 | deblkmb_neighbour_t *ps_deblk_top_mb; |
2317 | 0 | UWORD32 * pu4_bs_table; |
2318 | 0 | UWORD8 u1_cur_mb_type; |
2319 | | |
2320 | | /* Neighbour availability */ |
2321 | | /* Initialization */ |
2322 | 0 | const UWORD32 u2_mbx = ps_cur_mb_info->u2_mbx; |
2323 | 0 | const UWORD32 u2_mby = ps_cur_mb_info->u2_mby; |
2324 | 0 | const UWORD32 u1_pingpong = u2_mbx & 0x01; |
2325 | 0 | ps_deblk_top_mb = ps_dec->ps_deblk_top_mb + u2_mbx; |
2326 | | |
2327 | | |
2328 | | /* Pointer assignment for Current DeblkMB, Current Mv Pred */ |
2329 | 0 | ps_cur_mb_params = ps_dec->ps_deblk_mbn + u2_mbxn_mb; |
2330 | |
|
2331 | 0 | u1_cur_mb_type = ps_cur_mb_params->u1_mb_type; |
2332 | |
|
2333 | 0 | ps_deblk_top_mb->u1_mb_type = u1_cur_mb_type; |
2334 | |
|
2335 | 0 | { |
2336 | 0 | UWORD8 mb_qp_temp; |
2337 | |
|
2338 | 0 | ps_cur_mb_params->u1_topmb_qp = ps_deblk_top_mb->u1_mb_qp; |
2339 | 0 | ps_deblk_top_mb->u1_mb_qp = ps_cur_mb_params->u1_mb_qp; |
2340 | |
|
2341 | 0 | ps_cur_mb_params->u1_left_mb_qp = ps_dec->deblk_left_mb[1].u1_mb_qp; |
2342 | 0 | ps_dec->deblk_left_mb[1].u1_mb_qp = ps_cur_mb_params->u1_mb_qp; |
2343 | |
|
2344 | 0 | } |
2345 | |
|
2346 | 0 | ps_cur_mb_params->u1_single_call = 1; |
2347 | |
|
2348 | 0 | ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type; |
2349 | | /* if no deblocking required for current Mb then continue */ |
2350 | | /* Check next Mbs in Mb group */ |
2351 | 0 | if(ps_cur_mb_params->u1_deblocking_mode & MB_DISABLE_FILTERING) |
2352 | 0 | { |
2353 | | /* Storing the leftMbtype for next Mb */ |
2354 | 0 | return; |
2355 | 0 | } |
2356 | | |
2357 | | /* Compute BS function */ |
2358 | 0 | pu4_bs_table = ps_cur_mb_params->u4_bs_table; |
2359 | |
|
2360 | 0 | { |
2361 | 0 | UWORD32 top_mb_csbp, left_mb_csbp, cur_mb_csbp; |
2362 | 0 | UWORD32 top_edge, left_edge; |
2363 | |
|
2364 | 0 | top_mb_csbp = ps_cur_mb_info->ps_top_mb->u2_luma_csbp; |
2365 | 0 | left_mb_csbp = ps_cur_mb_info->ps_left_mb->u2_luma_csbp; |
2366 | 0 | cur_mb_csbp = ps_cur_mb_info->ps_curmb->u2_luma_csbp; |
2367 | |
|
2368 | 0 | top_mb_csbp = top_mb_csbp >> 12; |
2369 | 0 | top_edge = top_mb_csbp | (cur_mb_csbp & 0xf); |
2370 | |
|
2371 | 0 | if(top_edge) |
2372 | 0 | pu4_bs_table[0] = 0x02020202; |
2373 | 0 | else |
2374 | 0 | pu4_bs_table[0] = 0; |
2375 | |
|
2376 | 0 | cur_mb_csbp = cur_mb_csbp & CSBP_LEFT_BLOCK_MASK; |
2377 | 0 | left_mb_csbp = left_mb_csbp & CSBP_RIGHT_BLOCK_MASK; |
2378 | |
|
2379 | 0 | left_edge = cur_mb_csbp | left_mb_csbp; |
2380 | |
|
2381 | 0 | if(left_edge) |
2382 | 0 | pu4_bs_table[4] = 0x02020202; |
2383 | 0 | else |
2384 | 0 | pu4_bs_table[4] = 0; |
2385 | |
|
2386 | 0 | pu4_bs_table[1] = 0; |
2387 | 0 | pu4_bs_table[2] = 0; |
2388 | 0 | pu4_bs_table[3] = 0; |
2389 | 0 | pu4_bs_table[5] = 0; |
2390 | 0 | pu4_bs_table[6] = 0; |
2391 | 0 | pu4_bs_table[7] = 0; |
2392 | 0 | } |
2393 | |
|
2394 | 0 | } |