Coverage Report

Created: 2024-07-27 06:35

/src/libavc/decoder/svc/isvcd_compute_bs.c
Line
Count
Source (jump to first uncovered line)
1
/******************************************************************************
2
 *
3
 * Copyright (C) 2022 The Android Open Source Project
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at:
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 *
17
 *****************************************************************************
18
 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19
 */
20
/**
21
 *******************************************************************************
22
 * @file
23
 *  isvcd_compute_bs.c
24
 *
25
 * @brief
26
 *  This file contains bit flags and info on target layer.
27
 *
28
 * @author
29
 *  Kishore
30
 *
31
 * @par List of Functions:
32
 *  - isvcd_deblk_extract_bit_flags()
33
 *  - isvcd_fill_bs_ibl()
34
 *  - isvcd_compute_bs_non_mbaff_target_lyr_no_inter_layer()
35
 *  - isvcd_compute_bs_non_mbaff()
36
 *  - isvcd_compute_bs_non_mbaff_target_lyr()
37
 *  - isvcd_compute_bs_non_mbaff_medial_lyr()
38
 *
39
 * @remarks
40
 *  None
41
 *
42
 *******************************************************************************
43
 */
44
45
#include "ih264_typedefs.h"
46
#include "ih264_macros.h"
47
#include "ih264_platform_macros.h"
48
#include "isvcd_structs.h"
49
#include "ih264d_defs.h"
50
#include "ih264d_deblocking.h"
51
#include "string.h"
52
#include "ih264d_debug.h"
53
#include "ih264d_tables.h"
54
UWORD16 ih264d_update_csbp_8x8(UWORD16 u2_luma_csbp);
55
void ih264d_fill_bs2_horz_vert(UWORD32 *pu4_bs,        /* Base pointer of BS table */
56
                               WORD32 u4_left_mb_csbp, /* csbp of left mb */
57
                               WORD32 u4_top_mb_csbp,  /* csbp of top mb */
58
                               WORD32 u4_cur_mb_csbp,  /* csbp of current mb */
59
                               const UWORD32 *pu4_packed_bs2, const UWORD16 *pu2_4x4_v2h_reorder);
60
const UWORD32 g_au4_extract_set[NUM_SUB_MB_PARTS] = {0x00000000F, 0x0000000F0, 0x000000F00,
61
                                                     0x00000F000};
62
63
/** \brief extracts the bits from given offset and packs it to last 4 bits  */
64
UWORD16 isvcd_deblk_extract_bit_flags(UWORD16 u2_bit_field, WORD32 i4_initial_bit_mask)
65
84.5k
{
66
84.5k
    WORD32 i4_i;
67
84.5k
    WORD32 i4_bit_mask;
68
84.5k
    UWORD16 u2_result = 0;
69
70
84.5k
    i4_bit_mask = i4_initial_bit_mask;
71
72
422k
    for(i4_i = 0; i4_i < NUM_SUB_MB_PARTS; i4_i++)
73
338k
    {
74
338k
        WORD32 i4_bit;
75
        /* extract the bits of the last column 4x4 blocks */
76
338k
        if(0 == (i4_bit_mask & u2_bit_field))
77
332k
        {
78
332k
            i4_bit = 0;
79
332k
        }
80
6.16k
        else
81
6.16k
        {
82
6.16k
            i4_bit = 1;
83
6.16k
        }
84
        /* store the result */
85
338k
        u2_result |= i4_bit << i4_i;
86
338k
        i4_bit_mask <<= 4;
87
88
338k
    } /* end of loop over num sub Mb parts */
89
84.5k
    return (u2_result);
90
84.5k
}
91
92
/** \brief Fills the BS for edges falling on a IBL boundary  */
93
void isvcd_fill_bs_ibl(deblk_mb_t *ps_deblk_mb, UWORD8 u1_top_mb_type, UWORD8 u1_left_mb_type,
94
                       dec_mb_info_t *ps_cur_mb_info, UWORD16 *pu2_curr_res_luma_csbp,
95
                       UWORD16 *pu2_left_res_luma_csbp, UWORD16 *pu2_top_res_luma_csbp)
96
643k
{
97
    /*! Flow of the module is as follows                                  */
98
    /*! 1. checks if MB edge is falling on IBL boundary                   */
99
    /*! 2. if only Mb edge then it fills the BS based on INTRA or INTER
100
           stauts                                                         */
101
    /*! 3. if the current MB is IBL and neighbours are also neighbours
102
           then it uses the current layer t_coeff flag to decide the
103
           BS of a particular edge                                        */
104
    /*!4. fills the BS for all the edges in curretn MB if IBL             */
105
106
643k
    UWORD16 u2_top_horz_nnz;
107
643k
    UWORD8 u1_top_mb_ibl, u1_left_mb_ibl;
108
643k
    UWORD32 i4_i, i4_edge;
109
643k
    UWORD8 u1_bs;
110
643k
    UWORD8 u1_cnd;
111
643k
    UWORD8 u1_top_intra;
112
643k
    UWORD8 u1_left_intra;
113
643k
    UWORD8 u1_p_nnz, u1_q_nnz;
114
643k
    UWORD8 u1_curr_mb_ibl;
115
643k
    UWORD32 *pu4_bs_table;
116
643k
    UWORD16 u2_curr_nnz;
117
643k
    UWORD8 u1_left_mb_nnz = 0, u1_left_nnz;
118
643k
    WORD32 i4_horz_start = 0;
119
643k
    WORD32 i4_vertical_start = 0;
120
121
643k
    pu4_bs_table = &(ps_deblk_mb->u4_bs_table[0]);
122
123
643k
    u1_top_mb_ibl = u1_top_mb_type & D_INTRA_IBL;
124
643k
    u1_left_mb_ibl = u1_left_mb_type & D_INTRA_IBL;
125
126
643k
    u1_curr_mb_ibl = ps_deblk_mb->u1_mb_type & D_INTRA_IBL;
127
128
643k
    u1_top_intra = u1_top_mb_type & D_INTRA_MB;
129
643k
    u1_left_intra = u1_left_mb_type & D_INTRA_MB;
130
131
    /* return if none of the current top and left is IBL */
132
643k
    if((0 == u1_curr_mb_ibl) && (0 == u1_top_mb_ibl) && (0 == u1_left_mb_ibl))
133
559k
    {
134
559k
        return;
135
559k
    }
136
137
    /* set up the vertical and horz MB edge skip flags */
138
84.5k
    if(0 != u1_curr_mb_ibl)
139
72.4k
    {
140
        /* if top is not IBL */
141
72.4k
        if(0 == u1_top_mb_ibl)
142
18.5k
        {
143
18.5k
            i4_horz_start = 1;
144
18.5k
        }
145
146
        /* if left in not IBL */
147
72.4k
        if(0 == u1_left_mb_ibl)
148
28.8k
        {
149
28.8k
            i4_vertical_start = 1;
150
28.8k
        }
151
72.4k
    }
152
153
    /*******************************************************/
154
    /* Fill BS for mb egdex assuming non IBL case          */
155
    /*******************************************************/
156
157
    /* only the  MB edges fall across IBL boundary */
158
84.5k
    if((0 != u1_curr_mb_ibl) || (0 != u1_top_mb_ibl) || (0 != u1_left_mb_ibl))
159
84.5k
    {
160
84.5k
        UWORD16 u2_temp, u2_i;
161
84.5k
        u2_temp = *pu2_left_res_luma_csbp;
162
422k
        for(u2_i = 0; u2_i < 4; u2_i++)
163
338k
        {
164
338k
            u1_left_mb_nnz |= ((u2_temp & 0x08) >> (3 - u2_i));
165
338k
            u2_temp >>= 4;
166
338k
        }
167
84.5k
        u2_curr_nnz = *pu2_curr_res_luma_csbp;
168
84.5k
        u2_top_horz_nnz = *pu2_top_res_luma_csbp >> 12;
169
170
        /* top is intra and not ibl */
171
84.5k
        if(0 != u1_top_intra)
172
2.31k
        {
173
2.31k
            pu4_bs_table[0] = 0x04040404;
174
2.31k
        }
175
        /* left is intra and not ibl */
176
84.5k
        if(0 != u1_left_intra)
177
1.94k
        {
178
1.94k
            pu4_bs_table[4] = 0x04040404;
179
1.94k
        }
180
181
        /* assume neighbours are inter and update bs */
182
183
        /* Edge = 0 means Vert Edges and Edge = 1 means Horz edges */
184
253k
        for(i4_edge = 0; i4_edge < 2; i4_edge++)
185
169k
        {
186
169k
            UWORD8 u1_p_nnz, u1_q_nnz;
187
169k
            UWORD32 u4_bs_edge = 0;
188
169k
            WORD32 i4_bit_mask;
189
169k
            WORD32 i4_curr_intra_flag;
190
169k
            WORD32 i4_neibor_intra_flag;
191
192
169k
            i4_curr_intra_flag = (0 != u1_curr_mb_ibl);
193
194
169k
            if(0 != i4_edge)
195
84.5k
            {
196
                /* Initialize for the TOP edge */
197
84.5k
                u1_p_nnz = (UWORD8) u2_top_horz_nnz;
198
84.5k
                u1_q_nnz = (UWORD8) (u2_curr_nnz & g_au4_extract_set[0]);
199
84.5k
                i4_neibor_intra_flag = (u1_top_mb_ibl || u1_top_intra);
200
84.5k
            }
201
84.5k
            else
202
84.5k
            {
203
84.5k
                u1_p_nnz = u1_left_mb_nnz;
204
84.5k
                u1_q_nnz = (UWORD8) isvcd_deblk_extract_bit_flags(u2_curr_nnz, 0x01);
205
84.5k
                i4_neibor_intra_flag = (u1_left_mb_ibl || u1_left_intra);
206
84.5k
            }
207
208
169k
            i4_bit_mask = 1;
209
            /* find bs of 4 edges */
210
845k
            for(i4_i = 0; i4_i < 4; i4_i++)
211
676k
            {
212
676k
                UWORD8 u1_p_nnz_temp, u1_q_nnz_temp;
213
214
676k
                u1_p_nnz_temp = (u1_p_nnz & i4_bit_mask);
215
676k
                u1_q_nnz_temp = (u1_q_nnz & i4_bit_mask);
216
217
676k
                u1_cnd = ((u1_p_nnz_temp && (!i4_neibor_intra_flag)) ||
218
676k
                          (u1_q_nnz_temp && (!i4_curr_intra_flag)));
219
220
676k
                u1_bs = u1_cnd ? 2 : 1;
221
222
                /* update the bs of the edge */
223
676k
                u4_bs_edge = (u4_bs_edge << 8) + u1_bs;
224
676k
                i4_bit_mask <<= 1;
225
226
676k
            } /* end of loop over blk edges */
227
228
            /* update the bs of edges */
229
169k
            if(i4_edge && !u1_top_intra)
230
82.2k
            {
231
82.2k
                pu4_bs_table[0] = u4_bs_edge;
232
82.2k
            }
233
86.8k
            else if(!i4_edge && !u1_left_intra)
234
82.6k
            {
235
82.6k
                pu4_bs_table[4] = u4_bs_edge;
236
82.6k
            }
237
169k
        } /* end of loop over v1 vetical and horizontal edge */
238
84.5k
    }
239
    /* current MB is IBL */
240
84.5k
    if(0 != u1_curr_mb_ibl)
241
72.4k
    {
242
72.4k
        UWORD16 u2_temp, u2_i;
243
72.4k
        WORD32 i4_bit_mask_edge = 1;
244
245
72.4k
        u1_left_mb_nnz = 0;
246
72.4k
        u2_temp = ps_cur_mb_info->ps_left_mb->u2_luma_csbp;
247
362k
        for(u2_i = 0; u2_i < 4; u2_i++)
248
289k
        {
249
289k
            u1_left_mb_nnz |= ((u2_temp & 0x08) >> (3 - u2_i));
250
289k
            u2_temp >>= 4;
251
289k
        }
252
72.4k
        u2_curr_nnz = ps_cur_mb_info->ps_curmb->u2_luma_csbp;
253
72.4k
        u2_top_horz_nnz = ps_cur_mb_info->ps_top_mb->u2_luma_csbp >> 12;
254
        /* all are IBL edges then use only t_coeff of current layer*/
255
        /* loop over all edges */
256
362k
        for(i4_edge = 0; i4_edge < 4; i4_edge++)
257
289k
        {
258
289k
            UWORD16 u2_curr_horz_nnz = 0;
259
289k
            WORD32 i4_bit_mask = 1;
260
261
289k
            u2_curr_horz_nnz = u2_curr_nnz & g_au4_extract_set[i4_edge];
262
263
289k
            u2_curr_horz_nnz = (u2_curr_horz_nnz >> (i4_edge * 4));
264
265
289k
            u1_left_nnz = (u1_left_mb_nnz & i4_bit_mask_edge);
266
267
1.44M
            for(i4_i = 0; i4_i < 4; i4_i++)
268
1.15M
            {
269
1.15M
                UWORD8 u1_curr_nnz, u1_top_nnz;
270
271
1.15M
                u1_curr_nnz = (u2_curr_horz_nnz & i4_bit_mask);
272
1.15M
                u1_top_nnz = (u2_top_horz_nnz & i4_bit_mask);
273
                /* update bs horizontal */
274
275
1.15M
                if(!((1 == i4_horz_start) && (0 == i4_edge)))
276
1.08M
                {
277
1.08M
                    u1_p_nnz = u1_top_nnz;
278
1.08M
                    u1_q_nnz = u1_curr_nnz;
279
1.08M
                    u1_cnd = !(u1_p_nnz || u1_q_nnz);
280
1.08M
                    u1_bs = u1_cnd ? 0 : 1;
281
1.08M
                    pu4_bs_table[i4_edge] = (pu4_bs_table[i4_edge] << 8) + u1_bs;
282
1.08M
                }
283
284
                /* update bs vertical */
285
1.15M
                if(!((1 == i4_vertical_start) && (0 == i4_i)))
286
1.04M
                {
287
1.04M
                    u1_p_nnz = u1_left_nnz;
288
1.04M
                    u1_q_nnz = u1_curr_nnz;
289
1.04M
                    u1_cnd = !(u1_p_nnz || u1_q_nnz);
290
1.04M
                    u1_bs = u1_cnd ? 0 : 1;
291
1.04M
                    pu4_bs_table[i4_i + 4] = (pu4_bs_table[i4_i + 4] << 8) + u1_bs;
292
1.04M
                }
293
                /* store the current nnz to left nnz */
294
1.15M
                u1_left_nnz = u1_curr_nnz;
295
1.15M
                i4_bit_mask <<= 1;
296
1.15M
            }
297
            /* store the current row nnz to top row nnz */
298
289k
            u2_top_horz_nnz = u2_curr_horz_nnz;
299
289k
            i4_bit_mask_edge <<= 1;
300
289k
        }
301
72.4k
    }
302
84.5k
    return;
303
643k
}
304
305
/*****************************************************************************/
306
/*                                                                           */
307
/*  Function Name : isvcd_compute_bs_non_mbaff_target_lyr_no_inter_layer     */
308
/*                                                                           */
309
/*  Description   : This function computes the pointers of left,top & current*/
310
/*                : Nnz, MvPred & deblk_mb_t and supplies to FillBs function */
311
/*                : for Boundary Strength Calculation                        */
312
/*  Inputs        : <What inputs does the function take?>                    */
313
/*  Processing    : This functions calls deblock MB in the MB increment order*/
314
/*                                                                           */
315
/*  Outputs       : Produces the Boundary Strength for Current Mb            */
316
/*  Returns       : None                                                     */
317
/*                                                                           */
318
/*  Revision History:                                                        */
319
/*                                                                           */
320
/*         DD MM YYYY   Author(s)       Changes (Describe the changes made)  */
321
/*         06 09 2021   Kishore                                              */
322
/*****************************************************************************/
323
324
void isvcd_compute_bs_non_mbaff_target_lyr_no_inter_layer(svc_dec_lyr_struct_t *ps_svc_lyr_dec,
325
                                                          dec_mb_info_t *ps_cur_mb_info,
326
                                                          const UWORD16 u2_mbxn_mb)
327
109k
{
328
109k
    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
329
    /* Mvpred and Nnz for top and Courrent */
330
109k
    mv_pred_t *ps_cur_mv_pred, *ps_top_mv_pred = NULL, *ps_left_mv_pred;
331
    /* deblk_mb_t Params */
332
109k
    deblk_mb_t *ps_cur_mb_params; /*< Parameters of current MacroBlock */
333
109k
    deblkmb_neighbour_t *ps_deblk_top_mb;
334
335
    /* Reference Index to POC mapping*/
336
109k
    void **apv_map_ref_idx_to_poc;
337
109k
    UWORD32 u4_leftmbtype;
338
339
109k
    UWORD16 u2_left_csbp, u2_top_csbp, u2_cur_csbp;
340
341
    /* Set of flags */
342
109k
    UWORD32 u4_cur_mb_intra, u1_top_mb_typ, u4_cur_mb_fld;
343
109k
    UWORD32 u1_cur_mb_type;
344
109k
    UWORD32 *pu4_bs_table;
345
346
    /* Neighbour availability */
347
    /* Initialization */
348
109k
    const UWORD32 u2_mbx = ps_cur_mb_info->u2_mbx;
349
109k
    const UWORD32 u2_mby = ps_cur_mb_info->u2_mby;
350
109k
    const UWORD32 u1_pingpong = u2_mbx & 0x01;
351
352
109k
    PROFILE_DISABLE_BOUNDARY_STRENGTH()
353
354
109k
    ps_deblk_top_mb = ps_dec->ps_deblk_top_mb + u2_mbx;
355
356
    /* Pointer assignment for Current DeblkMB, Current Mv Pred  */
357
109k
    ps_cur_mb_params = ps_dec->ps_deblk_mbn + u2_mbxn_mb;
358
109k
    ps_cur_mv_pred = ps_dec->ps_mv_cur + (u2_mbxn_mb << 4);
359
360
109k
    apv_map_ref_idx_to_poc = ps_dec->ppv_map_ref_idx_to_poc + 1;
361
109k
    u1_cur_mb_type = ps_cur_mb_params->u1_mb_type;
362
109k
    u1_top_mb_typ = ps_deblk_top_mb->u1_mb_type;
363
109k
    ps_deblk_top_mb->u1_mb_type = u1_cur_mb_type;
364
365
109k
    ps_cur_mb_params->u1_topmb_qp = ps_deblk_top_mb->u1_mb_qp;
366
109k
    ps_deblk_top_mb->u1_mb_qp = ps_cur_mb_params->u1_mb_qp;
367
109k
    ps_cur_mb_params->u1_left_mb_qp = ps_dec->deblk_left_mb[1].u1_mb_qp;
368
109k
    ps_dec->deblk_left_mb[1].u1_mb_qp = ps_cur_mb_params->u1_mb_qp;
369
370
    /* if no deblocking required for current Mb then continue */
371
    /* Check next Mbs   in Mb group                           */
372
109k
    if(ps_cur_mb_params->u1_deblocking_mode & MB_DISABLE_FILTERING)
373
769
    {
374
769
        void **pu4_map_ref_idx_to_poc_l1 = apv_map_ref_idx_to_poc + POC_LIST_L0_TO_L1_DIFF;
375
769
        {
376
            /* Store Parameter for Top MvPred refernce frame Address */
377
378
769
            void **ppv_top_mv_pred_addr = ps_cur_mb_info->ps_curmb->u4_pic_addrress;
379
769
            WORD8 *p1_refTop0 = (ps_cur_mv_pred + 12)->i1_ref_frame;
380
769
            WORD8 *p1_refTop1 = (ps_cur_mv_pred + 14)->i1_ref_frame;
381
382
            /* Store Left addresses for Next Mb   */
383
769
            void **ppv_left_mv_pred_addr = ps_dec->ps_left_mvpred_addr[!u1_pingpong][1].u4_add;
384
769
            WORD8 *p1_refleft0 = (ps_cur_mv_pred + 3)->i1_ref_frame;
385
386
769
            ppv_top_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refTop0[0]];
387
769
            ppv_top_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refTop0[1]];
388
389
769
            ppv_left_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
390
769
            ppv_top_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
391
769
            ppv_left_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
392
769
            ppv_top_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
393
394
769
            ppv_left_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refleft0[0]];
395
769
            ppv_left_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refleft0[1]];
396
            /* Storing the leftMbtype for next Mb */
397
769
            ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type;
398
769
        }
399
400
769
        return;
401
769
    }
402
403
    /* Flag for extra left Edge */
404
109k
    ps_cur_mb_params->u1_single_call = 1;
405
406
    /* Update the Left deblk_mb_t and Left MvPred Parameters           */
407
109k
    if(!u2_mbx)
408
14.5k
    {
409
14.5k
        u4_leftmbtype = 0;
410
411
        /* Initialize the ps_left_mv_pred with Junk but Valid Location */
412
        /* to avoid invalid memory access                           */
413
        /* this is read only pointer                                */
414
14.5k
        ps_left_mv_pred = ps_dec->ps_mv_cur + 3;
415
14.5k
    }
416
94.5k
    else
417
94.5k
    {
418
94.5k
        u4_leftmbtype = ps_dec->deblk_left_mb[1].u1_mb_type;
419
420
        /* Come to Left Most Edge of the MB */
421
94.5k
        ps_left_mv_pred =
422
94.5k
            (u2_mbxn_mb) ? ps_dec->ps_mv_cur + ((u2_mbxn_mb - 1) << 4) + 3 : ps_dec->ps_mv_left + 3;
423
94.5k
    }
424
425
109k
    if(!u2_mby) u1_top_mb_typ = 0;
426
427
    /* MvPred Pointer Calculation */
428
109k
    ps_top_mv_pred = ps_cur_mv_pred - (ps_dec->u2_frm_wd_in_mbs << 4) + 12;
429
430
109k
    u4_cur_mb_intra = u1_cur_mb_type & D_INTRA_MB;
431
109k
    u4_cur_mb_fld = !!(u1_cur_mb_type & D_FLD_MB);
432
    /* Compute BS function */
433
109k
    pu4_bs_table = ps_cur_mb_params->u4_bs_table;
434
435
109k
    u2_cur_csbp = ps_cur_mb_info->ps_curmb->u2_luma_csbp;
436
109k
    u2_left_csbp = ps_cur_mb_info->ps_left_mb->u2_luma_csbp;
437
109k
    u2_top_csbp = ps_cur_mb_info->ps_top_mb->u2_luma_csbp;
438
    /* Compute BS function */
439
109k
    if((ps_dec->ps_cur_sps->u1_profile_idc == HIGH_PROFILE_IDC) ||
440
109k
       (ps_dec->ps_cur_sps->u1_profile_idc == SCALABLE_HIGH_PROFILE_IDC) ||
441
109k
       (ps_dec->ps_cur_sps->u1_profile_idc == SCALABLE_BASELINE_PROFILE_IDC))
442
65.4k
    {
443
65.4k
        if(ps_cur_mb_info->u1_tran_form8x8 == 1)
444
36.5k
        {
445
36.5k
            u2_cur_csbp = ih264d_update_csbp_8x8(ps_cur_mb_info->ps_curmb->u2_luma_csbp);
446
36.5k
        }
447
448
65.4k
        if(ps_cur_mb_info->ps_left_mb->u1_tran_form8x8 == 1)
449
34.5k
        {
450
34.5k
            u2_left_csbp = ih264d_update_csbp_8x8(ps_cur_mb_info->ps_left_mb->u2_luma_csbp);
451
34.5k
        }
452
453
65.4k
        if(ps_cur_mb_info->ps_top_mb->u1_tran_form8x8 == 1)
454
24.1k
        {
455
24.1k
            u2_top_csbp = ih264d_update_csbp_8x8(ps_cur_mb_info->ps_top_mb->u2_luma_csbp);
456
24.1k
        }
457
65.4k
    }
458
109k
    if(u4_cur_mb_intra)
459
109k
    {
460
109k
        pu4_bs_table[4] = 0x04040404;
461
109k
        pu4_bs_table[0] = u4_cur_mb_fld ? 0x03030303 : 0x04040404;
462
109k
        pu4_bs_table[1] = 0x03030303;
463
109k
        pu4_bs_table[2] = 0x03030303;
464
109k
        pu4_bs_table[3] = 0x03030303;
465
109k
        pu4_bs_table[5] = 0x03030303;
466
109k
        pu4_bs_table[6] = 0x03030303;
467
109k
        pu4_bs_table[7] = 0x03030303;
468
109k
    }
469
0
    else
470
0
    {
471
0
        UWORD32 u4_is_non16x16 = !!(u1_cur_mb_type & D_PRED_NON_16x16);
472
0
        UWORD32 u4_is_b = ps_dec->u1_B;
473
474
0
        ih264d_fill_bs2_horz_vert(pu4_bs_table, u2_left_csbp, u2_top_csbp, u2_cur_csbp,
475
0
                                  (const UWORD32 *) (gau4_ih264d_packed_bs2),
476
0
                                  (const UWORD16 *) (gau2_ih264d_4x4_v2h_reorder));
477
478
0
        if(u4_leftmbtype & D_INTRA_MB) pu4_bs_table[4] = 0x04040404;
479
480
0
        if(u1_top_mb_typ & D_INTRA_MB) pu4_bs_table[0] = u4_cur_mb_fld ? 0x03030303 : 0x04040404;
481
482
0
        ps_dec->pf_fill_bs1[u4_is_b][u4_is_non16x16](
483
0
            ps_cur_mv_pred, ps_top_mv_pred, apv_map_ref_idx_to_poc, pu4_bs_table, ps_left_mv_pred,
484
0
            &(ps_dec->ps_left_mvpred_addr[u1_pingpong][1]),
485
0
            ps_cur_mb_info->ps_top_mb->u4_pic_addrress, (4 >> u4_cur_mb_fld));
486
0
    }
487
488
109k
    {
489
109k
        void **pu4_map_ref_idx_to_poc_l1 = apv_map_ref_idx_to_poc + POC_LIST_L0_TO_L1_DIFF;
490
109k
        {
491
            /* Store Parameter for Top MvPred refernce frame Address */
492
493
109k
            void **ppv_top_mv_pred_addr = ps_cur_mb_info->ps_curmb->u4_pic_addrress;
494
109k
            WORD8 *p1_refTop0 = (ps_cur_mv_pred + 12)->i1_ref_frame;
495
109k
            WORD8 *p1_refTop1 = (ps_cur_mv_pred + 14)->i1_ref_frame;
496
497
            /* Store Left addresses for Next Mb   */
498
109k
            void **ppv_left_mv_pred_addr = ps_dec->ps_left_mvpred_addr[!u1_pingpong][1].u4_add;
499
109k
            WORD8 *p1_refleft0 = (ps_cur_mv_pred + 3)->i1_ref_frame;
500
501
109k
            ppv_top_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refTop0[0]];
502
109k
            ppv_top_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refTop0[1]];
503
504
109k
            ppv_left_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
505
109k
            ppv_top_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
506
109k
            ppv_left_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
507
109k
            ppv_top_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
508
509
109k
            ppv_left_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refleft0[0]];
510
109k
            ppv_left_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refleft0[1]];
511
512
            /* Storing the leftMbtype for next Mb */
513
109k
            ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type;
514
109k
        }
515
109k
    }
516
517
    /* For transform 8x8 disable deblocking of the intrernal edges of a 8x8 block */
518
109k
    if(ps_cur_mb_info->u1_tran_form8x8)
519
36.5k
    {
520
36.5k
        pu4_bs_table[1] = 0;
521
36.5k
        pu4_bs_table[3] = 0;
522
36.5k
        pu4_bs_table[5] = 0;
523
36.5k
        pu4_bs_table[7] = 0;
524
36.5k
    }
525
109k
}
526
/*****************************************************************************/
527
/*                                                                           */
528
/*  Function Name : isvcd_compute_bs_non_mbaff                               */
529
/*                                                                           */
530
/*  Description   : This function computes the pointers of left,top & current*/
531
/*                : Nnz, MvPred & deblk_mb_t and supplies to FillBs function */
532
/*                : for Boundary Strength Calculation                        */
533
/*  Inputs        : <What inputs does the function take?>                    */
534
/*  Processing    : This functions calls deblock MB in the MB increment order*/
535
/*                                                                           */
536
/*  Outputs       : Produces the Boundary Strength for Current Mb            */
537
/*  Returns       : None                                                     */
538
/*                                                                           */
539
/*  Revision History:                                                        */
540
/*                                                                           */
541
/*         DD MM YYYY   Author(s)       Changes (Describe the changes made)  */
542
/*         06 09 2021   Kishore                                              */
543
/*****************************************************************************/
544
545
void isvcd_compute_bs_non_mbaff(svc_dec_lyr_struct_t *ps_svc_lyr_dec, dec_mb_info_t *ps_cur_mb_info,
546
                                const UWORD16 u2_mbxn_mb)
547
21.3k
{
548
21.3k
    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
549
21.3k
    ps_dec->pf_compute_bs(ps_dec, ps_cur_mb_info, u2_mbxn_mb);
550
21.3k
}
551
/*****************************************************************************/
552
/*                                                                           */
553
/*  Function Name : isvcd_compute_bs_non_mbaff_target_lyr                    */
554
/*                                                                           */
555
/*  Description   : This function computes the pointers of left,top & current*/
556
/*                : Nnz, MvPred & deblk_mb_t and supplies to FillBs function */
557
/*                : for Boundary Strength Calculation                        */
558
/*  Inputs        : <What inputs does the function take?>                    */
559
/*  Processing    : This functions calls deblock MB in the MB increment order*/
560
/*                                                                           */
561
/*  Outputs       : Produces the Boundary Strength for Current Mb            */
562
/*  Returns       : None                                                     */
563
/*                                                                           */
564
/*  Revision History:                                                        */
565
/*                                                                           */
566
/*         DD MM YYYY   Author(s)       Changes (Describe the changes made)  */
567
/*         06 09 2021   Kishore                                              */
568
/*****************************************************************************/
569
570
void isvcd_compute_bs_non_mbaff_target_lyr(svc_dec_lyr_struct_t *ps_svc_lyr_dec,
571
                                           dec_mb_info_t *ps_cur_mb_info, const UWORD16 u2_mbxn_mb)
572
180k
{
573
180k
    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
574
    /* Mvpred and Nnz for top and Courrent */
575
180k
    mv_pred_t *ps_cur_mv_pred, *ps_top_mv_pred = NULL, *ps_left_mv_pred;
576
    /* deblk_mb_t Params */
577
180k
    deblk_mb_t *ps_cur_mb_params; /*< Parameters of current MacroBlock */
578
180k
    deblkmb_neighbour_t *ps_deblk_top_mb;
579
580
    /* Reference Index to POC mapping*/
581
180k
    void **apv_map_ref_idx_to_poc;
582
180k
    UWORD32 u4_leftmbtype;
583
180k
    UWORD16 u2_left_csbp, u2_top_csbp, u2_cur_csbp;
584
585
    /* Set of flags */
586
180k
    UWORD32 u4_cur_mb_intra, u1_top_mb_typ, u4_cur_mb_fld;
587
180k
    UWORD32 u4_cur_mb_ibl;
588
180k
    UWORD32 u1_cur_mb_type;
589
180k
    UWORD32 *pu4_bs_table;
590
591
180k
    UWORD16 *pu2_curr_res_luma_csbp;
592
180k
    UWORD16 *pu2_left_res_luma_csbp;
593
180k
    UWORD16 *pu2_top_res_luma_csbp;
594
595
    /* Neighbour availability */
596
    /* Initialization */
597
180k
    const UWORD32 u2_mbx = ps_cur_mb_info->u2_mbx;
598
180k
    const UWORD32 u2_mby = ps_cur_mb_info->u2_mby;
599
180k
    const UWORD32 u1_pingpong = u2_mbx & 0x01;
600
601
180k
    PROFILE_DISABLE_BOUNDARY_STRENGTH()
602
603
180k
    ps_deblk_top_mb = ps_dec->ps_deblk_top_mb + u2_mbx;
604
605
    /* Pointer assignment for Current DeblkMB, Current Mv Pred  */
606
180k
    ps_cur_mb_params = ps_dec->ps_deblk_mbn + u2_mbxn_mb;
607
180k
    ps_cur_mv_pred = ps_dec->ps_mv_cur + (u2_mbxn_mb << 4);
608
609
    /*Pointer assignment for Residual NNZ */
610
180k
    pu2_curr_res_luma_csbp = ps_svc_lyr_dec->pu2_frm_res_luma_csbp + ps_cur_mb_info->u2_mbx;
611
180k
    pu2_curr_res_luma_csbp += ps_cur_mb_info->u2_mby * ps_svc_lyr_dec->i4_frm_res_luma_csbp_stride;
612
613
180k
    pu2_left_res_luma_csbp = pu2_curr_res_luma_csbp - (ps_cur_mb_info->u2_mbx != 0);
614
180k
    pu2_top_res_luma_csbp = pu2_curr_res_luma_csbp - ((ps_cur_mb_info->u2_mby != 0) *
615
180k
                                                      ps_svc_lyr_dec->i4_frm_res_luma_csbp_stride);
616
617
180k
    apv_map_ref_idx_to_poc = ps_dec->ppv_map_ref_idx_to_poc + 1;
618
180k
    u1_cur_mb_type = ps_cur_mb_params->u1_mb_type;
619
180k
    u1_top_mb_typ = ps_deblk_top_mb->u1_mb_type;
620
180k
    ps_deblk_top_mb->u1_mb_type = u1_cur_mb_type;
621
622
180k
    ps_cur_mb_params->u1_topmb_qp = ps_deblk_top_mb->u1_mb_qp;
623
180k
    ps_deblk_top_mb->u1_mb_qp = ps_cur_mb_params->u1_mb_qp;
624
180k
    ps_cur_mb_params->u1_left_mb_qp = ps_dec->deblk_left_mb[1].u1_mb_qp;
625
180k
    ps_dec->deblk_left_mb[1].u1_mb_qp = ps_cur_mb_params->u1_mb_qp;
626
627
    /* if no deblocking required for current Mb then continue */
628
    /* Check next Mbs   in Mb group                           */
629
180k
    if(ps_cur_mb_params->u1_deblocking_mode & MB_DISABLE_FILTERING)
630
2.36k
    {
631
2.36k
        void **pu4_map_ref_idx_to_poc_l1 = apv_map_ref_idx_to_poc + POC_LIST_L0_TO_L1_DIFF;
632
633
        /* Store Parameter for Top MvPred refernce frame Address */
634
2.36k
        void **ppv_top_mv_pred_addr = ps_cur_mb_info->ps_curmb->u4_pic_addrress;
635
2.36k
        WORD8 *p1_refTop0 = (ps_cur_mv_pred + 12)->i1_ref_frame;
636
2.36k
        WORD8 *p1_refTop1 = (ps_cur_mv_pred + 14)->i1_ref_frame;
637
638
        /* Store Left addresses for Next Mb   */
639
2.36k
        void **ppv_left_mv_pred_addr = ps_dec->ps_left_mvpred_addr[!u1_pingpong][1].u4_add;
640
2.36k
        WORD8 *p1_refleft0 = (ps_cur_mv_pred + 3)->i1_ref_frame;
641
642
2.36k
        ppv_top_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refTop0[0]];
643
2.36k
        ppv_top_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refTop0[1]];
644
645
2.36k
        ppv_left_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
646
2.36k
        ppv_top_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
647
2.36k
        ppv_left_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
648
2.36k
        ppv_top_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
649
650
2.36k
        ppv_left_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refleft0[0]];
651
2.36k
        ppv_left_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refleft0[1]];
652
        /* Storing the leftMbtype for next Mb */
653
2.36k
        ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type;
654
655
2.36k
        return;
656
2.36k
    }
657
658
    /* Flag for extra left Edge */
659
178k
    ps_cur_mb_params->u1_single_call = 1;
660
661
    /* Update the Left deblk_mb_t and Left MvPred Parameters           */
662
178k
    if(!u2_mbx)
663
50.7k
    {
664
50.7k
        u4_leftmbtype = 0;
665
666
        /* Initialize the ps_left_mv_pred with Junk but Valid Location */
667
        /* to avoid invalid memory access                           */
668
        /* this is read only pointer                                */
669
50.7k
        ps_left_mv_pred = ps_dec->ps_mv_cur + 3;
670
50.7k
    }
671
127k
    else
672
127k
    {
673
127k
        u4_leftmbtype = ps_dec->deblk_left_mb[1].u1_mb_type;
674
675
        /* Come to Left Most Edge of the MB */
676
127k
        ps_left_mv_pred =
677
127k
            (u2_mbxn_mb) ? ps_dec->ps_mv_cur + ((u2_mbxn_mb - 1) << 4) + 3 : ps_dec->ps_mv_left + 3;
678
127k
    }
679
680
178k
    if(!u2_mby) u1_top_mb_typ = 0;
681
682
    /* MvPred Pointer Calculation */
683
178k
    ps_top_mv_pred = ps_cur_mv_pred - (ps_dec->u2_frm_wd_in_mbs << 4) + 12;
684
178k
    u4_cur_mb_intra = u1_cur_mb_type & D_INTRA_MB;
685
178k
    u4_cur_mb_ibl = u1_cur_mb_type & D_INTRA_IBL;
686
178k
    u4_cur_mb_fld = !!(u1_cur_mb_type & D_FLD_MB);
687
    /* Compute BS function */
688
178k
    pu4_bs_table = ps_cur_mb_params->u4_bs_table;
689
690
178k
    u2_cur_csbp = ps_cur_mb_info->ps_curmb->u2_luma_csbp;
691
178k
    u2_left_csbp = ps_cur_mb_info->ps_left_mb->u2_luma_csbp;
692
178k
    u2_top_csbp = ps_cur_mb_info->ps_top_mb->u2_luma_csbp;
693
    /* Compute BS function */
694
178k
    if((ps_dec->ps_cur_sps->u1_profile_idc == HIGH_PROFILE_IDC) ||
695
178k
       (ps_dec->ps_cur_sps->u1_profile_idc == SCALABLE_HIGH_PROFILE_IDC) ||
696
178k
       (ps_dec->ps_cur_sps->u1_profile_idc == SCALABLE_BASELINE_PROFILE_IDC))
697
91.6k
    {
698
91.6k
        if(ps_cur_mb_info->u1_tran_form8x8 == 1)
699
6.91k
        {
700
6.91k
            u2_cur_csbp = ih264d_update_csbp_8x8(ps_cur_mb_info->ps_curmb->u2_luma_csbp);
701
6.91k
            ps_cur_mb_info->ps_curmb->u2_luma_csbp = u2_cur_csbp;
702
6.91k
        }
703
91.6k
    }
704
178k
    u2_cur_csbp |= *pu2_curr_res_luma_csbp;
705
178k
    u2_left_csbp |= *pu2_left_res_luma_csbp;
706
178k
    u2_top_csbp |= *pu2_top_res_luma_csbp;
707
708
178k
    if(u4_cur_mb_intra)
709
11.2k
    {
710
11.2k
        pu4_bs_table[4] = 0x04040404;
711
11.2k
        pu4_bs_table[0] = u4_cur_mb_fld ? 0x03030303 : 0x04040404;
712
11.2k
        pu4_bs_table[1] = 0x03030303;
713
11.2k
        pu4_bs_table[2] = 0x03030303;
714
11.2k
        pu4_bs_table[3] = 0x03030303;
715
11.2k
        pu4_bs_table[5] = 0x03030303;
716
11.2k
        pu4_bs_table[6] = 0x03030303;
717
11.2k
        pu4_bs_table[7] = 0x03030303;
718
11.2k
    }
719
167k
    else
720
167k
    {
721
167k
        isvcd_fill_bs_ibl(ps_cur_mb_params, u1_top_mb_typ, u4_leftmbtype, ps_cur_mb_info,
722
167k
                          pu2_curr_res_luma_csbp, pu2_left_res_luma_csbp, pu2_top_res_luma_csbp);
723
724
167k
        if(!u4_cur_mb_ibl)
725
118k
        {
726
118k
            UWORD32 u4_is_non16x16 = !!(u1_cur_mb_type & D_PRED_NON_16x16);
727
118k
            UWORD32 u4_is_b = ps_dec->u1_B;
728
118k
            UWORD32 u4_bs_0, u4_bs_4;
729
730
118k
            u4_bs_0 = pu4_bs_table[0];
731
118k
            u4_bs_4 = pu4_bs_table[4];
732
733
118k
            ih264d_fill_bs2_horz_vert(pu4_bs_table, u2_left_csbp, u2_top_csbp, u2_cur_csbp,
734
118k
                                      (const UWORD32 *) (gau4_ih264d_packed_bs2),
735
118k
                                      (const UWORD16 *) (gau2_ih264d_4x4_v2h_reorder));
736
737
118k
            if(u4_leftmbtype & D_INTRA_MB)
738
1.08k
            {
739
1.08k
                pu4_bs_table[4] = 0x04040404;
740
1.08k
            }
741
117k
            else if(u4_leftmbtype & D_INTRA_IBL)
742
2.79k
            {
743
2.79k
                pu4_bs_table[4] = u4_bs_4;
744
2.79k
            }
745
746
118k
            if(u1_top_mb_typ & D_INTRA_MB)
747
934
            {
748
934
                pu4_bs_table[0] = u4_cur_mb_fld ? 0x03030303 : 0x04040404;
749
934
            }
750
117k
            else if(u1_top_mb_typ & D_INTRA_IBL)
751
4.78k
            {
752
4.78k
                pu4_bs_table[0] = u4_bs_0;
753
4.78k
            }
754
755
118k
            ps_dec->pf_fill_bs1[u4_is_b][u4_is_non16x16](
756
118k
                ps_cur_mv_pred, ps_top_mv_pred, apv_map_ref_idx_to_poc, pu4_bs_table,
757
118k
                ps_left_mv_pred, &(ps_dec->ps_left_mvpred_addr[u1_pingpong][1]),
758
118k
                ps_cur_mb_info->ps_top_mb->u4_pic_addrress, (4 >> u4_cur_mb_fld));
759
118k
        }
760
167k
    }
761
762
178k
    {
763
178k
        void **pu4_map_ref_idx_to_poc_l1 = apv_map_ref_idx_to_poc + POC_LIST_L0_TO_L1_DIFF;
764
        /* Store Parameter for Top MvPred refernce frame Address */
765
178k
        void **ppv_top_mv_pred_addr = ps_cur_mb_info->ps_curmb->u4_pic_addrress;
766
178k
        WORD8 *p1_refTop0 = (ps_cur_mv_pred + 12)->i1_ref_frame;
767
178k
        WORD8 *p1_refTop1 = (ps_cur_mv_pred + 14)->i1_ref_frame;
768
769
        /* Store Left addresses for Next Mb   */
770
178k
        void **ppv_left_mv_pred_addr = ps_dec->ps_left_mvpred_addr[!u1_pingpong][1].u4_add;
771
178k
        WORD8 *p1_refleft0 = (ps_cur_mv_pred + 3)->i1_ref_frame;
772
773
178k
        ppv_top_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refTop0[0]];
774
178k
        ppv_top_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refTop0[1]];
775
776
178k
        ppv_left_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
777
178k
        ppv_top_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
778
178k
        ppv_left_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
779
178k
        ppv_top_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
780
781
178k
        ppv_left_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refleft0[0]];
782
178k
        ppv_left_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refleft0[1]];
783
784
        /* Storing the leftMbtype for next Mb */
785
178k
        ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type;
786
178k
    }
787
788
    /* For transform 8x8 disable deblocking of the intrernal edges of a 8x8 block */
789
178k
    if(ps_cur_mb_info->u1_tran_form8x8)
790
14.4k
    {
791
14.4k
        pu4_bs_table[1] = 0;
792
14.4k
        pu4_bs_table[3] = 0;
793
14.4k
        pu4_bs_table[5] = 0;
794
14.4k
        pu4_bs_table[7] = 0;
795
14.4k
    }
796
178k
}
797
798
/*****************************************************************************/
799
/*                                                                           */
800
/*  Function Name : isvcd_compute_bs_non_mbaff_medial_lyr                    */
801
/*                                                                           */
802
/*  Description   : This function computes the pointers of left,top & current*/
803
/*                : Nnz, MvPred & deblk_mb_t and supplies to FillBs function */
804
/*                : for Boundary Strength Calculation                        */
805
/*  Inputs        : <What inputs does the function take?>                    */
806
/*  Processing    : This functions calls deblock MB in the MB increment order*/
807
/*                                                                           */
808
/*  Outputs       : Produces the Boundary Strength for Current Mb            */
809
/*  Returns       : None                                                     */
810
/*                                                                           */
811
/*  Revision History:                                                        */
812
/*                                                                           */
813
/*         DD MM YYYY   Author(s)       Changes (Describe the changes made)  */
814
/*         06 09 2021   Kishore                                              */
815
/*****************************************************************************/
816
817
void isvcd_compute_bs_non_mbaff_medial_lyr(svc_dec_lyr_struct_t *ps_svc_lyr_dec,
818
                                           dec_mb_info_t *ps_cur_mb_info, const UWORD16 u2_mbxn_mb)
819
0
{
820
0
    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
821
    /* deblk_mb_t Params */
822
0
    deblk_mb_t *ps_cur_mb_params; /*< Parameters of current MacroBlock */
823
0
    deblkmb_neighbour_t *ps_deblk_top_mb;
824
0
    UWORD32 u4_leftmbtype;
825
0
    UWORD16 u2_cur_csbp;
826
827
    /* Set of flags */
828
0
    UWORD32 u4_cur_mb_intra, u1_top_mb_typ, u4_cur_mb_fld;
829
0
    UWORD32 u1_cur_mb_type;
830
0
    UWORD32 *pu4_bs_table;
831
0
    UWORD32 mb_type_intra = 0;
832
833
0
    UWORD16 *pu2_curr_res_luma_csbp;
834
0
    UWORD16 *pu2_left_res_luma_csbp;
835
0
    UWORD16 *pu2_top_res_luma_csbp;
836
837
    /* Neighbour availability */
838
0
    const UWORD32 u2_mbx = ps_cur_mb_info->u2_mbx;
839
0
    const UWORD32 u2_mby = ps_cur_mb_info->u2_mby;
840
841
0
    PROFILE_DISABLE_BOUNDARY_STRENGTH()
842
843
0
    ps_deblk_top_mb = ps_dec->ps_deblk_top_mb + u2_mbx;
844
845
    /* Pointer assignment for Current DeblkMB, Current Mv Pred  */
846
0
    ps_cur_mb_params = ps_dec->ps_deblk_mbn + u2_mbxn_mb;
847
848
    /*Pointer assignment for Residual NNZ */
849
0
    pu2_curr_res_luma_csbp = ps_svc_lyr_dec->pu2_frm_res_luma_csbp + ps_cur_mb_info->u2_mbx;
850
0
    pu2_curr_res_luma_csbp += ps_cur_mb_info->u2_mby * ps_svc_lyr_dec->i4_frm_res_luma_csbp_stride;
851
852
0
    pu2_left_res_luma_csbp = pu2_curr_res_luma_csbp - (ps_cur_mb_info->u2_mbx != 0);
853
0
    pu2_top_res_luma_csbp = pu2_curr_res_luma_csbp - ((ps_cur_mb_info->u2_mby != 0) *
854
0
                                                      ps_svc_lyr_dec->i4_frm_res_luma_csbp_stride);
855
856
0
    u1_cur_mb_type = ps_cur_mb_params->u1_mb_type;
857
0
    u1_top_mb_typ = ps_deblk_top_mb->u1_mb_type;
858
0
    ps_deblk_top_mb->u1_mb_type = u1_cur_mb_type;
859
860
0
    ps_cur_mb_params->u1_topmb_qp = ps_deblk_top_mb->u1_mb_qp;
861
0
    ps_deblk_top_mb->u1_mb_qp = ps_cur_mb_params->u1_mb_qp;
862
0
    ps_cur_mb_params->u1_left_mb_qp = ps_dec->deblk_left_mb[1].u1_mb_qp;
863
0
    ps_dec->deblk_left_mb[1].u1_mb_qp = ps_cur_mb_params->u1_mb_qp;
864
865
    /* if no deblocking required for current Mb then continue */
866
    /* Check next Mbs   in Mb group                           */
867
0
    if(ps_cur_mb_params->u1_deblocking_mode & MB_DISABLE_FILTERING)
868
0
    {
869
        /* Storing the leftMbtype for next Mb */
870
0
        ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type;
871
0
        return;
872
0
    }
873
874
    /* Flag for extra left Edge */
875
0
    ps_cur_mb_params->u1_single_call = 1;
876
877
    /* Update the Left deblk_mb_t */
878
0
    if(!u2_mbx)
879
0
    {
880
0
        u4_leftmbtype = 0;
881
0
    }
882
0
    else
883
0
    {
884
0
        u4_leftmbtype = ps_dec->deblk_left_mb[1].u1_mb_type;
885
0
    }
886
887
0
    if(!u2_mby) u1_top_mb_typ = 0;
888
889
0
    u4_cur_mb_intra = u1_cur_mb_type & D_INTRA_MB;
890
0
    u4_cur_mb_fld = !!(u1_cur_mb_type & D_FLD_MB);
891
    /* Compute BS function */
892
0
    pu4_bs_table = ps_cur_mb_params->u4_bs_table;
893
894
0
    u2_cur_csbp = ps_cur_mb_info->ps_curmb->u2_luma_csbp;
895
    /* Compute BS function */
896
0
    if((ps_dec->ps_cur_sps->u1_profile_idc == HIGH_PROFILE_IDC) ||
897
0
       (ps_dec->ps_cur_sps->u1_profile_idc == SCALABLE_HIGH_PROFILE_IDC) ||
898
0
       (ps_dec->ps_cur_sps->u1_profile_idc == SCALABLE_BASELINE_PROFILE_IDC))
899
0
    {
900
0
        if(ps_cur_mb_info->u1_tran_form8x8 == 1)
901
0
        {
902
0
            u2_cur_csbp = ih264d_update_csbp_8x8(ps_cur_mb_info->ps_curmb->u2_luma_csbp);
903
0
            ps_cur_mb_info->ps_curmb->u2_luma_csbp = u2_cur_csbp;
904
0
        }
905
0
    }
906
0
    u2_cur_csbp |= *pu2_curr_res_luma_csbp;
907
908
0
    if(u4_cur_mb_intra)
909
0
    {
910
0
        pu4_bs_table[4] = 0x04040404;
911
0
        pu4_bs_table[0] = u4_cur_mb_fld ? 0x03030303 : 0x04040404;
912
0
        pu4_bs_table[1] = 0x03030303;
913
0
        pu4_bs_table[2] = 0x03030303;
914
0
        pu4_bs_table[3] = 0x03030303;
915
0
        pu4_bs_table[5] = 0x03030303;
916
0
        pu4_bs_table[6] = 0x03030303;
917
0
        pu4_bs_table[7] = 0x03030303;
918
0
    }
919
0
    else
920
0
    {
921
0
        isvcd_fill_bs_ibl(ps_cur_mb_params, u1_top_mb_typ, u4_leftmbtype, ps_cur_mb_info,
922
0
                          pu2_curr_res_luma_csbp, pu2_left_res_luma_csbp, pu2_top_res_luma_csbp);
923
0
    }
924
925
0
    mb_type_intra = (u1_top_mb_typ & D_INTRA_MB) || (u1_top_mb_typ & D_INTRA_IBL);
926
927
    /* if Top MB or current MB is INTER */
928
0
    if(!mb_type_intra)
929
0
    {
930
0
        pu4_bs_table[0] = 0;
931
        /* disable the processing of top edge  */
932
0
        ps_cur_mb_params->u1_deblocking_mode |= MB_DISABLE_TOP_EDGE;
933
0
    }
934
935
0
    mb_type_intra = (u4_leftmbtype & D_INTRA_MB) || (u4_leftmbtype & D_INTRA_IBL);
936
    /* if Left MB current MB is INTER */
937
0
    if(!mb_type_intra)
938
0
    {
939
0
        pu4_bs_table[4] = 0;
940
        /* disable the processing of left edge  */
941
0
        ps_cur_mb_params->u1_deblocking_mode |= MB_DISABLE_LEFT_EDGE;
942
0
    }
943
944
    /* overwrite the BS 0 values for corner cases */
945
0
    if(0 == u2_mbx)
946
0
    {
947
0
        pu4_bs_table[4] = 0;
948
0
    }
949
0
    if(0 == u2_mby)
950
0
    {
951
0
        pu4_bs_table[0] = 0;
952
0
    }
953
954
    /* Storing the leftMbtype for next Mb */
955
0
    ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type;
956
957
    /* For transform 8x8 disable deblocking of the intrernal edges of a 8x8 block */
958
0
    if(ps_cur_mb_info->u1_tran_form8x8)
959
0
    {
960
0
        pu4_bs_table[1] = 0;
961
0
        pu4_bs_table[3] = 0;
962
0
        pu4_bs_table[5] = 0;
963
0
        pu4_bs_table[7] = 0;
964
0
    }
965
0
}