1 /******************************************************************************
2 *
3 * Copyright (C) 2018 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *****************************************************************************
18 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20
21 /**
22 ******************************************************************************
23 * @file ihevce_nbr_avail.c
24 *
25 * @brief
26 * This file contains function definitions and look up tables for various
27 * neigbour avail flags in HEVC encoder
28 *
29 * @author
30 * Ittiam
31 *
32 * List of Functions
33 * <TODO: TO BE ADDED>
34 *
35 ******************************************************************************
36 */
37
38 /*****************************************************************************/
39 /* File Includes */
40 /*****************************************************************************/
41 /* System include files */
42 #include <stdio.h>
43 #include <string.h>
44 #include <stdlib.h>
45 #include <assert.h>
46 #include <stdarg.h>
47 #include <math.h>
48
49 /* User include files */
50 #include "ihevc_typedefs.h"
51 #include "itt_video_api.h"
52 #include "ihevce_api.h"
53
54 #include "rc_cntrl_param.h"
55 #include "rc_frame_info_collector.h"
56 #include "rc_look_ahead_params.h"
57
58 #include "ihevc_defs.h"
59 #include "ihevc_structs.h"
60 #include "ihevc_platform_macros.h"
61 #include "ihevc_deblk.h"
62 #include "ihevc_itrans_recon.h"
63 #include "ihevc_chroma_itrans_recon.h"
64 #include "ihevc_chroma_intra_pred.h"
65 #include "ihevc_intra_pred.h"
66 #include "ihevc_inter_pred.h"
67 #include "ihevc_mem_fns.h"
68 #include "ihevc_padding.h"
69 #include "ihevc_weighted_pred.h"
70 #include "ihevc_sao.h"
71 #include "ihevc_resi_trans.h"
72 #include "ihevc_quant_iquant_ssd.h"
73 #include "ihevc_cabac_tables.h"
74
75 #include "ihevce_defs.h"
76 #include "ihevce_lap_enc_structs.h"
77 #include "ihevce_multi_thrd_structs.h"
78 #include "ihevce_multi_thrd_funcs.h"
79 #include "ihevce_me_common_defs.h"
80 #include "ihevce_had_satd.h"
81 #include "ihevce_error_codes.h"
82 #include "ihevce_bitstream.h"
83 #include "ihevce_cabac.h"
84 #include "ihevce_rdoq_macros.h"
85 #include "ihevce_function_selector.h"
86 #include "ihevce_enc_structs.h"
87 #include "ihevce_nbr_avail.h"
88
89 /*****************************************************************************/
90 /* Function Definitions */
91 /*****************************************************************************/
92
93 /*!
94 ******************************************************************************
95 * \if Function name : ihevce_set_ctb_nbr \endif
96 *
97 * \brief
98 * This function sets the neighbour availability flags of ctb based on the
99 * CTB position
100 *
101 * \date
102 * 18/09/2012
103 *
104 * \author
105 * Ittiam
106 *
107 * \return
108 * none
109 *
110 ******************************************************************************
111 */
ihevce_set_ctb_nbr(nbr_avail_flags_t * ps_nbr,UWORD8 * pu1_nbr_map,WORD32 nbr_map_strd,WORD32 ctb_pos_x,WORD32 ctb_pos_y,frm_ctb_ctxt_t * ps_frm_ctb_prms)112 void ihevce_set_ctb_nbr(
113 nbr_avail_flags_t *ps_nbr,
114 UWORD8 *pu1_nbr_map,
115 WORD32 nbr_map_strd,
116 WORD32 ctb_pos_x,
117 WORD32 ctb_pos_y,
118 frm_ctb_ctxt_t *ps_frm_ctb_prms)
119 {
120 WORD32 ctr;
121 WORD32 *pi4_cur_ctb_tile_id;
122 WORD32 i4_curr_ctb_tile_id, i4_top_ctb_tile_id;
123 WORD32 i4_left_ctb_tile_id, i4_right_ctb_tile_id;
124
125 WORD32 ctb_size = ps_frm_ctb_prms->i4_ctb_size;
126 WORD32 num_ctb_horz = ps_frm_ctb_prms->i4_num_ctbs_horz;
127 WORD32 num_ctb_vert = ps_frm_ctb_prms->i4_num_ctbs_vert;
128 WORD32 cu_aligned_pic_wd = ps_frm_ctb_prms->i4_cu_aligned_pic_wd;
129 WORD32 cu_aligned_pic_ht = ps_frm_ctb_prms->i4_cu_aligned_pic_ht;
130 UWORD8 *pu1_top_nbr_map = pu1_nbr_map - nbr_map_strd;
131 UWORD8 *pu1_left_nbr_map = pu1_nbr_map - 1;
132 UWORD8 *pu1_top_lt_nbr_map = pu1_top_nbr_map - 1;
133 UWORD8 *pu1_top_rt_nbr_map = pu1_top_nbr_map + (ctb_size >> 2);
134 WORD32 num_4x4_ctb_x = (ctb_size >> 2);
135 WORD32 num_4x4_ctb_y = (ctb_size >> 2);
136
137 /* Conditionally update num_4x4_ctb_x and num_4x4_ctb_y */
138 if(ctb_pos_y == (num_ctb_vert - 1))
139 {
140 num_4x4_ctb_y = (cu_aligned_pic_ht - ((num_ctb_vert - 1) * ctb_size)) / 4;
141 }
142
143 if(ctb_pos_x == (num_ctb_horz - 1))
144 {
145 num_4x4_ctb_x = (cu_aligned_pic_wd - ((num_ctb_horz - 1) * ctb_size)) / 4;
146 }
147
148 /* Get Tile-ids of top, left and current CTBs */
149 pi4_cur_ctb_tile_id = ps_frm_ctb_prms->pi4_tile_id_map +
150 ctb_pos_y * ps_frm_ctb_prms->i4_tile_id_ctb_map_stride + ctb_pos_x;
151
152 i4_curr_ctb_tile_id = *pi4_cur_ctb_tile_id;
153 i4_left_ctb_tile_id = *(pi4_cur_ctb_tile_id - 1);
154 i4_right_ctb_tile_id = *(pi4_cur_ctb_tile_id + 1);
155 i4_top_ctb_tile_id = *(pi4_cur_ctb_tile_id - ps_frm_ctb_prms->i4_tile_id_ctb_map_stride);
156
157 /*********** Update Nbr availability in ps_nbr **********/
158
159 ps_nbr->u1_left_avail = (i4_left_ctb_tile_id == i4_curr_ctb_tile_id);
160 ps_nbr->u1_top_avail = (i4_top_ctb_tile_id == i4_curr_ctb_tile_id);
161 ps_nbr->u1_top_lt_avail = (ps_nbr->u1_left_avail && ps_nbr->u1_top_avail);
162 ps_nbr->u1_top_rt_avail = ps_nbr->u1_top_avail && (i4_right_ctb_tile_id == i4_curr_ctb_tile_id);
163 ps_nbr->u1_bot_lt_avail = 0; /* at ctb level bottom left is always not available */
164
165 /*********** Update Nbr availability in pu1_nbr_map **********/
166
167 /* NOTE: entire Nbr availability map is by default set to 0 */
168 *pu1_top_lt_nbr_map = ps_nbr->u1_top_lt_avail; /* Top-Left*/
169
170 memset(pu1_top_nbr_map, ps_nbr->u1_top_avail, num_4x4_ctb_x); /* Top */
171
172 for(ctr = 0; ctr < num_4x4_ctb_y; ctr++) /* Left */
173 {
174 *pu1_left_nbr_map = ps_nbr->u1_left_avail;
175 pu1_left_nbr_map += nbr_map_strd;
176 }
177
178 if((num_ctb_horz - 2) == ctb_pos_x) /* Top-Right */
179 {
180 /* For the last but 1 ctb, if the last ctb is non-multiple of 64,
181 then set the map accordingly */
182 WORD32 last_ctb_x = cu_aligned_pic_wd - ((num_ctb_horz - 1) * ctb_size);
183
184 num_4x4_ctb_x = MIN(last_ctb_x, MAX_TU_SIZE) / 4;
185 memset(pu1_top_rt_nbr_map, ps_nbr->u1_top_rt_avail, num_4x4_ctb_x);
186 }
187 else
188 {
189 memset(pu1_top_rt_nbr_map, ps_nbr->u1_top_rt_avail, (MAX_TU_SIZE / 4));
190 }
191
192 return;
193 }
194
195 /*!
196 ******************************************************************************
197 * \if Function name : ihevce_get_nbr_intra \endif
198 *
199 * \brief
200 * This function sets the neighbour availability flags of given unit
201 * based on the position and size
202 *
203 * \date
204 * 18/09/2012
205 *
206 * \author
207 * Ittiam
208 *
209 * \return
210 * none
211 *
212 ******************************************************************************
213 */
ihevce_get_nbr_intra(nbr_avail_flags_t * ps_cu_nbr,UWORD8 * pu1_nbr_map,WORD32 nbr_map_strd,WORD32 unit_4x4_pos_x,WORD32 unit_4x4_pos_y,WORD32 unit_4x4_size)214 WORD32 ihevce_get_nbr_intra(
215 nbr_avail_flags_t *ps_cu_nbr,
216 UWORD8 *pu1_nbr_map,
217 WORD32 nbr_map_strd,
218 WORD32 unit_4x4_pos_x,
219 WORD32 unit_4x4_pos_y,
220 WORD32 unit_4x4_size)
221 {
222 WORD32 nbr_tem_flags = 0;
223 WORD32 i;
224
225 UWORD8 *pu1_bot_lt_map;
226 UWORD8 *pu1_top_rt_map;
227 UWORD8 *pu1_top_lt_map;
228 UWORD8 *pu1_left_map;
229 UWORD8 *pu1_top_map;
230
231 /* map is stored at 4x4 level increment to point to current cu 4x4 */
232 pu1_nbr_map += (unit_4x4_pos_x);
233 pu1_nbr_map += (unit_4x4_pos_y)*nbr_map_strd;
234
235 pu1_top_map = pu1_nbr_map - nbr_map_strd;
236 pu1_top_lt_map = pu1_top_map - 1;
237 pu1_left_map = (pu1_nbr_map - 1);
238 /* use map to get top right availablility */
239 pu1_top_rt_map = pu1_nbr_map - nbr_map_strd;
240 pu1_top_rt_map += unit_4x4_size;
241
242 /* use map to get bot left availablility */
243 pu1_bot_lt_map = pu1_nbr_map - 1;
244 pu1_bot_lt_map += unit_4x4_size * nbr_map_strd;
245
246 /* Top flag */
247 ps_cu_nbr->u1_top_avail = *pu1_top_map;
248
249 /* left flag */
250 ps_cu_nbr->u1_left_avail = *pu1_left_map;
251
252 /* top left flag */
253 ps_cu_nbr->u1_top_lt_avail = *pu1_top_lt_map;
254
255 /* top right flag */
256 ps_cu_nbr->u1_top_rt_avail = *pu1_top_rt_map;
257
258 /* bottom left flag */
259 ps_cu_nbr->u1_bot_lt_avail = (*pu1_bot_lt_map);
260
261 /* Update the neighbor availiblity flag according to the nbr_map */
262 nbr_tem_flags = 0;
263
264 for(i = 0; i < 4; i++)
265 {
266 nbr_tem_flags |= ((*pu1_bot_lt_map) << (3 - i));
267 pu1_bot_lt_map += (nbr_map_strd * 2);
268 }
269
270 for(i = 0; i < 4; i++)
271 {
272 nbr_tem_flags |= ((*pu1_left_map) << (7 - i));
273 pu1_left_map += (nbr_map_strd * 2);
274 }
275 for(i = 0; i < 4; i++)
276 {
277 nbr_tem_flags |= ((*pu1_top_map) << (i + 8));
278 pu1_top_map += 2;
279 }
280 for(i = 0; i < 4; i++)
281 {
282 nbr_tem_flags |= ((*pu1_top_rt_map) << (i + 12));
283 pu1_top_rt_map += 2;
284 }
285 nbr_tem_flags |= (*pu1_top_lt_map << 16);
286
287 return nbr_tem_flags;
288 }
289
290 /*!
291 ******************************************************************************
292 * \if Function name : ihevce_get_nbr_intra_mxn_tu \endif
293 *
294 * \brief
295 * This function sets the neighbour availability flags of given unit
296 * based on the position and size
297 *
298 * \date
299 * 24/06/2014
300 *
301 * \author
302 * Ittiam
303 *
304 * \return
305 * none
306 *
307 ******************************************************************************
308 */
ihevce_get_nbr_intra_mxn_tu(UWORD8 * pu1_nbr_map,WORD32 nbr_map_strd,WORD32 unit_4x4_pos_x,WORD32 unit_4x4_pos_y,WORD32 unit_4x4_size_horz,WORD32 unit_4x4_size_vert)309 WORD32 ihevce_get_nbr_intra_mxn_tu(
310 UWORD8 *pu1_nbr_map,
311 WORD32 nbr_map_strd,
312 WORD32 unit_4x4_pos_x,
313 WORD32 unit_4x4_pos_y,
314 WORD32 unit_4x4_size_horz,
315 WORD32 unit_4x4_size_vert)
316 {
317 WORD32 nbr_tem_flags = 0;
318 WORD32 i;
319
320 UWORD8 *pu1_bot_lt_map;
321 UWORD8 *pu1_top_rt_map;
322 UWORD8 *pu1_top_lt_map;
323 UWORD8 *pu1_left_map;
324 UWORD8 *pu1_top_map;
325
326 /* map is stored at 4x4 level increment to point to current cu 4x4 */
327 pu1_nbr_map += (unit_4x4_pos_x);
328 pu1_nbr_map += (unit_4x4_pos_y)*nbr_map_strd;
329
330 pu1_top_map = pu1_nbr_map - nbr_map_strd;
331 pu1_top_lt_map = pu1_top_map - 1;
332 pu1_left_map = (pu1_nbr_map - 1);
333 /* use map to get top right availablility */
334 pu1_top_rt_map = pu1_nbr_map - nbr_map_strd;
335 pu1_top_rt_map += unit_4x4_size_horz;
336
337 /* use map to get bot left availablility */
338 pu1_bot_lt_map = pu1_nbr_map - 1;
339 pu1_bot_lt_map += unit_4x4_size_vert * nbr_map_strd;
340
341 /* Update the neighbor availiblity flag according to the nbr_map */
342 nbr_tem_flags = 0;
343
344 for(i = 0; i < 4; i++)
345 {
346 nbr_tem_flags |= ((*pu1_bot_lt_map) << (3 - i));
347 pu1_bot_lt_map += (nbr_map_strd * 2);
348 }
349
350 for(i = 0; i < 4; i++)
351 {
352 nbr_tem_flags |= ((*pu1_left_map) << (7 - i));
353 pu1_left_map += (nbr_map_strd * 2);
354 }
355 for(i = 0; i < 4; i++)
356 {
357 nbr_tem_flags |= ((*pu1_top_map) << (i + 8));
358 pu1_top_map += 2;
359 }
360 for(i = 0; i < 4; i++)
361 {
362 nbr_tem_flags |= ((*pu1_top_rt_map) << (i + 12));
363 pu1_top_rt_map += 2;
364 }
365 nbr_tem_flags |= (*pu1_top_lt_map << 16);
366
367 return nbr_tem_flags;
368 }
369
370 /*!
371 ******************************************************************************
372 * \if Function name : ihevce_get_intra_chroma_tu_nbr \endif
373 *
374 * \brief
375 * This function sets the neighbour availability flags of a chroma
376 * subTU based on luma availability and chroma format
377 *
378 * \date
379 * 04/07/2014
380 *
381 * \author
382 * Ittiam
383 *
384 * \return
385 * none
386 *
387 ******************************************************************************
388 */
ihevce_get_intra_chroma_tu_nbr(WORD32 i4_luma_nbr_flags,WORD32 i4_subtu_idx,WORD32 i4_trans_size,UWORD8 u1_is_422)389 WORD32 ihevce_get_intra_chroma_tu_nbr(
390 WORD32 i4_luma_nbr_flags, WORD32 i4_subtu_idx, WORD32 i4_trans_size, UWORD8 u1_is_422)
391 {
392 /* TOP LEFT | TOP-RIGHT | TOP | LEFT | BOTTOM LEFT*/
393 /* (1 bit) (4 bits) (4 bits) (4 bits) (4 bits) */
394 /* With reference to the above bit arrangement - */
395 /* BL0 - Bit 3 */
396 /* BL1 - Bit 2 */
397 /* BL2 - Bit 1 */
398 /* BL3 - Bit 0 */
399 /* L0 - Bit 7 */
400 /* L1 - Bit 6 */
401 /* L2 - Bit 5 */
402 /* L3 - Bit 4 */
403 /* T0 - Bit 8 */
404 /* T1 - Bit 9 */
405 /* T2 - Bit 10 */
406 /* T3 - Bit 11 */
407 /* TR0 - Bit 12 */
408 /* TR1 - Bit 13 */
409 /* TR2 - Bit 14 */
410 /* TR3 - Bit 15 */
411 if(u1_is_422)
412 {
413 if(0 == i4_subtu_idx)
414 {
415 /* If left is available for luma, then */
416 if(i4_luma_nbr_flags & 0xf0)
417 {
418 switch(i4_trans_size)
419 {
420 case 4:
421 {
422 /* BL0 - 1 */
423 /* BL1-3 - Luma_BL0-2 */
424 /*i4_luma_nbr_flags |= (i4_luma_nbr_flags & 0xe) >> 1;*/
425 i4_luma_nbr_flags |= 0x8;
426
427 /* L0-1 - 11 */
428 /* L2-3 - Luma_L2-3 */
429 i4_luma_nbr_flags |= 0xc0;
430
431 break;
432 }
433 case 8:
434 {
435 /* BL0-1 - 11 */
436 /* BL1-3 - Luma_BL0-1 */
437 /*i4_luma_nbr_flags |= (i4_luma_nbr_flags & 0xc) >> 2;*/
438 i4_luma_nbr_flags |= 0xc;
439
440 /* L0-3 - 1111 */
441 i4_luma_nbr_flags |= 0xf0;
442
443 break;
444 }
445 case 16:
446 {
447 /* BL0-3 - 1111 */
448 i4_luma_nbr_flags |= 0xf;
449
450 /* L0-3 - 1111 */
451 i4_luma_nbr_flags |= 0xf0;
452
453 break;
454 }
455 }
456 }
457 }
458 else
459 {
460 /* Top right is always unavailable */
461 /* Top is always available */
462
463 i4_luma_nbr_flags &= (0xffff0fff);
464
465 /* Top left is marked as available if */
466 /* luma left is available */
467 if(i4_luma_nbr_flags & 0xf0)
468 {
469 i4_luma_nbr_flags |= (1 << 16);
470 }
471
472 switch(i4_trans_size)
473 {
474 case 4:
475 {
476 /* T0 - 1 */
477 /* T1-3 - 000 */
478 i4_luma_nbr_flags |= 0x100;
479 i4_luma_nbr_flags &= 0xfffff1ff;
480
481 if(i4_luma_nbr_flags & 0xf0)
482 {
483 i4_luma_nbr_flags |= 0x80;
484 }
485
486 if(i4_luma_nbr_flags & 0x8)
487 {
488 i4_luma_nbr_flags |= 0x8;
489 }
490
491 break;
492 }
493 case 8:
494 {
495 /* T0-1 - 11 */
496 /* T2-3 - 00 */
497 i4_luma_nbr_flags |= 0x300;
498 i4_luma_nbr_flags &= 0xfffff3ff;
499
500 if(i4_luma_nbr_flags & 0xf0)
501 {
502 i4_luma_nbr_flags |= 0xc0;
503 }
504
505 if((i4_luma_nbr_flags & 0xc) == 0x8)
506 {
507 i4_luma_nbr_flags |= 0xc;
508 }
509 else if((i4_luma_nbr_flags & 0xc) == 0xc)
510 {
511 i4_luma_nbr_flags |= 0xf;
512 }
513 else if((i4_luma_nbr_flags & 0xf) == 0xe)
514 {
515 i4_luma_nbr_flags |= 0xf;
516 }
517
518 break;
519 }
520 case 16:
521 {
522 /* T0-3 - 1111 */
523 i4_luma_nbr_flags |= 0xf00;
524
525 if(i4_luma_nbr_flags & 0xf0)
526 {
527 i4_luma_nbr_flags |= 0xf0;
528 }
529
530 if((i4_luma_nbr_flags & 0xf) == 0x8)
531 {
532 i4_luma_nbr_flags |= 0xc;
533 }
534 else if((i4_luma_nbr_flags & 0xf) == 0xc)
535 {
536 i4_luma_nbr_flags |= 0xf;
537 }
538 else if((i4_luma_nbr_flags & 0xf) == 0xe)
539 {
540 i4_luma_nbr_flags |= 0xf;
541 }
542
543 break;
544 }
545 }
546 }
547 }
548
549 return i4_luma_nbr_flags;
550 }
551
552 /*!
553 ******************************************************************************
554 * \if Function name : ihevce_get_only_nbr_flag \endif
555 *
556 * \brief
557 * This function sets the neighbour availability flags of given unit
558 * based on the position, unit width and unit height
559 *
560 * \date
561 * 18/09/2012
562 *
563 * \author
564 * Ittiam
565 *
566 * \return
567 * none
568 *
569 ******************************************************************************
570 */
ihevce_get_only_nbr_flag(nbr_avail_flags_t * ps_cu_nbr,UWORD8 * pu1_nbr_map,WORD32 nbr_map_strd,WORD32 unit_4x4_pos_x,WORD32 unit_4x4_pos_y,WORD32 unit_4x4_size_hz,WORD32 unit_4x4_size_vt)571 void ihevce_get_only_nbr_flag(
572 nbr_avail_flags_t *ps_cu_nbr,
573 UWORD8 *pu1_nbr_map,
574 WORD32 nbr_map_strd,
575 WORD32 unit_4x4_pos_x,
576 WORD32 unit_4x4_pos_y,
577 WORD32 unit_4x4_size_hz,
578 WORD32 unit_4x4_size_vt)
579 {
580 /* map is stored at 4x4 level increment to point to current cu 4x4 */
581 pu1_nbr_map += (unit_4x4_pos_x);
582 pu1_nbr_map += (unit_4x4_pos_y)*nbr_map_strd;
583
584 /* Top flag */
585 ps_cu_nbr->u1_top_avail = *(pu1_nbr_map - nbr_map_strd);
586
587 /* left flag */
588 ps_cu_nbr->u1_left_avail = *(pu1_nbr_map - 1);
589
590 /* top left flag */
591 ps_cu_nbr->u1_top_lt_avail = *(pu1_nbr_map - nbr_map_strd - 1);
592
593 /* top right flag */
594 {
595 UWORD8 *pu1_top_rt_map;
596 /* use map to get top right availablility */
597 pu1_top_rt_map = pu1_nbr_map - nbr_map_strd;
598 pu1_top_rt_map += unit_4x4_size_hz;
599
600 /* store the availbility */
601 ps_cu_nbr->u1_top_rt_avail = *pu1_top_rt_map;
602 }
603
604 /* bottom left flag */
605 {
606 UWORD8 *pu1_bot_lt_map;
607
608 /* use map to get bot left availablility */
609 pu1_bot_lt_map = pu1_nbr_map - 1;
610 pu1_bot_lt_map += unit_4x4_size_vt * nbr_map_strd;
611
612 /* store the availbility */
613 ps_cu_nbr->u1_bot_lt_avail = *pu1_bot_lt_map;
614 }
615
616 return;
617 }
618
619 /*!
620 ******************************************************************************
621 * \if Function name : ihevce_set_nbr_map \endif
622 *
623 * \brief
624 * This function sets the neighbour availability flags of given value
625 * based on the position and size
626 *
627 * \date
628 * 18/09/2012
629 *
630 * \author
631 * Ittiam
632 *
633 * \return
634 * none
635 *
636 ******************************************************************************
637 */
ihevce_set_nbr_map(UWORD8 * pu1_nbr_map,WORD32 nbr_map_strd,WORD32 unit_4x4_pos_x,WORD32 unit_4x4_pos_y,WORD32 unit_4x4_size,WORD32 val)638 void ihevce_set_nbr_map(
639 UWORD8 *pu1_nbr_map,
640 WORD32 nbr_map_strd,
641 WORD32 unit_4x4_pos_x,
642 WORD32 unit_4x4_pos_y,
643 WORD32 unit_4x4_size,
644 WORD32 val)
645 {
646 WORD32 i;
647 /* map is stored at 4x4 level increment to point to current cu 4x4 */
648 pu1_nbr_map += (unit_4x4_pos_x);
649 pu1_nbr_map += (unit_4x4_pos_y)*nbr_map_strd;
650
651 /* loops to set the flags for given size */
652 for(i = 0; i < unit_4x4_size; i++)
653 {
654 memset(pu1_nbr_map, val, sizeof(UWORD8) * unit_4x4_size);
655 /* row level updates */
656 pu1_nbr_map += nbr_map_strd;
657 }
658
659 return;
660 }
661 /*!
662 ******************************************************************************
663 * \if Function name : ihevce_set_inter_nbr_map \endif
664 *
665 * \brief
666 * This function sets the neighbour availability flags of given value
667 * based on the position and horizontal width and vertical height
668 *
669 * \date
670 * 18/09/2012
671 *
672 * \author
673 * Ittiam
674 *
675 * \return
676 * none
677 * List of Functions
678 *
679 *
680 ******************************************************************************
681 */
ihevce_set_inter_nbr_map(UWORD8 * pu1_nbr_map,WORD32 nbr_map_strd,WORD32 unit_4x4_pos_x,WORD32 unit_4x4_pos_y,WORD32 unit_4x4_size_hz,WORD32 unit_4x4_size_vt,WORD32 val)682 void ihevce_set_inter_nbr_map(
683 UWORD8 *pu1_nbr_map,
684 WORD32 nbr_map_strd,
685 WORD32 unit_4x4_pos_x,
686 WORD32 unit_4x4_pos_y,
687 WORD32 unit_4x4_size_hz,
688 WORD32 unit_4x4_size_vt,
689 WORD32 val)
690 {
691 WORD32 i;
692 /* map is stored at 4x4 level increment to point to current cu 4x4 */
693 pu1_nbr_map += (unit_4x4_pos_x);
694 pu1_nbr_map += (unit_4x4_pos_y)*nbr_map_strd;
695 {
696 /* loops to set the flags for given size */
697 for(i = 0; i < unit_4x4_size_vt; i++)
698 {
699 memset(pu1_nbr_map, val, sizeof(UWORD8) * unit_4x4_size_hz);
700 /* row level updates */
701 pu1_nbr_map += nbr_map_strd;
702 }
703 }
704
705 return;
706 }
707