Coverage Report

Created: 2025-07-09 06:41

/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
76.7k
{
66
76.7k
    WORD32 i4_i;
67
76.7k
    WORD32 i4_bit_mask;
68
76.7k
    UWORD16 u2_result = 0;
69
70
76.7k
    i4_bit_mask = i4_initial_bit_mask;
71
72
383k
    for(i4_i = 0; i4_i < NUM_SUB_MB_PARTS; i4_i++)
73
307k
    {
74
307k
        WORD32 i4_bit;
75
        /* extract the bits of the last column 4x4 blocks */
76
307k
        if(0 == (i4_bit_mask & u2_bit_field))
77
301k
        {
78
301k
            i4_bit = 0;
79
301k
        }
80
5.40k
        else
81
5.40k
        {
82
5.40k
            i4_bit = 1;
83
5.40k
        }
84
        /* store the result */
85
307k
        u2_result |= i4_bit << i4_i;
86
307k
        i4_bit_mask <<= 4;
87
88
307k
    } /* end of loop over num sub Mb parts */
89
76.7k
    return (u2_result);
90
76.7k
}
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
844k
{
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
844k
    UWORD16 u2_top_horz_nnz;
107
844k
    UWORD8 u1_top_mb_ibl, u1_left_mb_ibl;
108
844k
    UWORD32 i4_i, i4_edge;
109
844k
    UWORD8 u1_bs;
110
844k
    UWORD8 u1_cnd;
111
844k
    UWORD8 u1_top_intra;
112
844k
    UWORD8 u1_left_intra;
113
844k
    UWORD8 u1_p_nnz, u1_q_nnz;
114
844k
    UWORD8 u1_curr_mb_ibl;
115
844k
    UWORD32 *pu4_bs_table;
116
844k
    UWORD16 u2_curr_nnz;
117
844k
    UWORD8 u1_left_mb_nnz = 0, u1_left_nnz;
118
844k
    WORD32 i4_horz_start = 0;
119
844k
    WORD32 i4_vertical_start = 0;
120
121
844k
    pu4_bs_table = &(ps_deblk_mb->u4_bs_table[0]);
122
123
844k
    u1_top_mb_ibl = u1_top_mb_type & D_INTRA_IBL;
124
844k
    u1_left_mb_ibl = u1_left_mb_type & D_INTRA_IBL;
125
126
844k
    u1_curr_mb_ibl = ps_deblk_mb->u1_mb_type & D_INTRA_IBL;
127
128
844k
    u1_top_intra = u1_top_mb_type & D_INTRA_MB;
129
844k
    u1_left_intra = u1_left_mb_type & D_INTRA_MB;
130
131
    /* return if none of the current top and left is IBL */
132
844k
    if((0 == u1_curr_mb_ibl) && (0 == u1_top_mb_ibl) && (0 == u1_left_mb_ibl))
133
767k
    {
134
767k
        return;
135
767k
    }
136
137
    /* set up the vertical and horz MB edge skip flags */
138
76.7k
    if(0 != u1_curr_mb_ibl)
139
61.8k
    {
140
        /* if top is not IBL */
141
61.8k
        if(0 == u1_top_mb_ibl)
142
20.2k
        {
143
20.2k
            i4_horz_start = 1;
144
20.2k
        }
145
146
        /* if left in not IBL */
147
61.8k
        if(0 == u1_left_mb_ibl)
148
26.8k
        {
149
26.8k
            i4_vertical_start = 1;
150
26.8k
        }
151
61.8k
    }
152
153
    /*******************************************************/
154
    /* Fill BS for mb egdex assuming non IBL case          */
155
    /*******************************************************/
156
157
    /* only the  MB edges fall across IBL boundary */
158
76.7k
    if((0 != u1_curr_mb_ibl) || (0 != u1_top_mb_ibl) || (0 != u1_left_mb_ibl))
159
76.7k
    {
160
76.7k
        UWORD16 u2_temp, u2_i;
161
76.7k
        u2_temp = *pu2_left_res_luma_csbp;
162
383k
        for(u2_i = 0; u2_i < 4; u2_i++)
163
307k
        {
164
307k
            u1_left_mb_nnz |= ((u2_temp & 0x08) >> (3 - u2_i));
165
307k
            u2_temp >>= 4;
166
307k
        }
167
76.7k
        u2_curr_nnz = *pu2_curr_res_luma_csbp;
168
76.7k
        u2_top_horz_nnz = *pu2_top_res_luma_csbp >> 12;
169
170
        /* top is intra and not ibl */
171
76.7k
        if(0 != u1_top_intra)
172
2.61k
        {
173
2.61k
            pu4_bs_table[0] = 0x04040404;
174
2.61k
        }
175
        /* left is intra and not ibl */
176
76.7k
        if(0 != u1_left_intra)
177
2.03k
        {
178
2.03k
            pu4_bs_table[4] = 0x04040404;
179
2.03k
        }
180
181
        /* assume neighbours are inter and update bs */
182
183
        /* Edge = 0 means Vert Edges and Edge = 1 means Horz edges */
184
230k
        for(i4_edge = 0; i4_edge < 2; i4_edge++)
185
153k
        {
186
153k
            UWORD8 u1_p_nnz, u1_q_nnz;
187
153k
            UWORD32 u4_bs_edge = 0;
188
153k
            WORD32 i4_bit_mask;
189
153k
            WORD32 i4_curr_intra_flag;
190
153k
            WORD32 i4_neibor_intra_flag;
191
192
153k
            i4_curr_intra_flag = (0 != u1_curr_mb_ibl);
193
194
153k
            if(0 != i4_edge)
195
76.7k
            {
196
                /* Initialize for the TOP edge */
197
76.7k
                u1_p_nnz = (UWORD8) u2_top_horz_nnz;
198
76.7k
                u1_q_nnz = (UWORD8) (u2_curr_nnz & g_au4_extract_set[0]);
199
76.7k
                i4_neibor_intra_flag = (u1_top_mb_ibl || u1_top_intra);
200
76.7k
            }
201
76.7k
            else
202
76.7k
            {
203
76.7k
                u1_p_nnz = u1_left_mb_nnz;
204
76.7k
                u1_q_nnz = (UWORD8) isvcd_deblk_extract_bit_flags(u2_curr_nnz, 0x01);
205
76.7k
                i4_neibor_intra_flag = (u1_left_mb_ibl || u1_left_intra);
206
76.7k
            }
207
208
153k
            i4_bit_mask = 1;
209
            /* find bs of 4 edges */
210
767k
            for(i4_i = 0; i4_i < 4; i4_i++)
211
614k
            {
212
614k
                UWORD8 u1_p_nnz_temp, u1_q_nnz_temp;
213
214
614k
                u1_p_nnz_temp = (u1_p_nnz & i4_bit_mask);
215
614k
                u1_q_nnz_temp = (u1_q_nnz & i4_bit_mask);
216
217
614k
                u1_cnd = ((u1_p_nnz_temp && (!i4_neibor_intra_flag)) ||
218
614k
                          (u1_q_nnz_temp && (!i4_curr_intra_flag)));
219
220
614k
                u1_bs = u1_cnd ? 2 : 1;
221
222
                /* update the bs of the edge */
223
614k
                u4_bs_edge = (u4_bs_edge << 8) + u1_bs;
224
614k
                i4_bit_mask <<= 1;
225
226
614k
            } /* end of loop over blk edges */
227
228
            /* update the bs of edges */
229
153k
            if(i4_edge && !u1_top_intra)
230
74.1k
            {
231
74.1k
                pu4_bs_table[0] = u4_bs_edge;
232
74.1k
            }
233
79.4k
            else if(!i4_edge && !u1_left_intra)
234
74.7k
            {
235
74.7k
                pu4_bs_table[4] = u4_bs_edge;
236
74.7k
            }
237
153k
        } /* end of loop over v1 vetical and horizontal edge */
238
76.7k
    }
239
    /* current MB is IBL */
240
76.7k
    if(0 != u1_curr_mb_ibl)
241
61.8k
    {
242
61.8k
        UWORD16 u2_temp, u2_i;
243
61.8k
        WORD32 i4_bit_mask_edge = 1;
244
245
61.8k
        u1_left_mb_nnz = 0;
246
61.8k
        u2_temp = ps_cur_mb_info->ps_left_mb->u2_luma_csbp;
247
309k
        for(u2_i = 0; u2_i < 4; u2_i++)
248
247k
        {
249
247k
            u1_left_mb_nnz |= ((u2_temp & 0x08) >> (3 - u2_i));
250
247k
            u2_temp >>= 4;
251
247k
        }
252
61.8k
        u2_curr_nnz = ps_cur_mb_info->ps_curmb->u2_luma_csbp;
253
61.8k
        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
309k
        for(i4_edge = 0; i4_edge < 4; i4_edge++)
257
247k
        {
258
247k
            UWORD16 u2_curr_horz_nnz = 0;
259
247k
            WORD32 i4_bit_mask = 1;
260
261
247k
            u2_curr_horz_nnz = u2_curr_nnz & g_au4_extract_set[i4_edge];
262
263
247k
            u2_curr_horz_nnz = (u2_curr_horz_nnz >> (i4_edge * 4));
264
265
247k
            u1_left_nnz = (u1_left_mb_nnz & i4_bit_mask_edge);
266
267
1.23M
            for(i4_i = 0; i4_i < 4; i4_i++)
268
988k
            {
269
988k
                UWORD8 u1_curr_nnz, u1_top_nnz;
270
271
988k
                u1_curr_nnz = (u2_curr_horz_nnz & i4_bit_mask);
272
988k
                u1_top_nnz = (u2_top_horz_nnz & i4_bit_mask);
273
                /* update bs horizontal */
274
275
988k
                if(!((1 == i4_horz_start) && (0 == i4_edge)))
276
907k
                {
277
907k
                    u1_p_nnz = u1_top_nnz;
278
907k
                    u1_q_nnz = u1_curr_nnz;
279
907k
                    u1_cnd = !(u1_p_nnz || u1_q_nnz);
280
907k
                    u1_bs = u1_cnd ? 0 : 1;
281
907k
                    pu4_bs_table[i4_edge] = (pu4_bs_table[i4_edge] << 8) + u1_bs;
282
907k
                }
283
284
                /* update bs vertical */
285
988k
                if(!((1 == i4_vertical_start) && (0 == i4_i)))
286
881k
                {
287
881k
                    u1_p_nnz = u1_left_nnz;
288
881k
                    u1_q_nnz = u1_curr_nnz;
289
881k
                    u1_cnd = !(u1_p_nnz || u1_q_nnz);
290
881k
                    u1_bs = u1_cnd ? 0 : 1;
291
881k
                    pu4_bs_table[i4_i + 4] = (pu4_bs_table[i4_i + 4] << 8) + u1_bs;
292
881k
                }
293
                /* store the current nnz to left nnz */
294
988k
                u1_left_nnz = u1_curr_nnz;
295
988k
                i4_bit_mask <<= 1;
296
988k
            }
297
            /* store the current row nnz to top row nnz */
298
247k
            u2_top_horz_nnz = u2_curr_horz_nnz;
299
247k
            i4_bit_mask_edge <<= 1;
300
247k
        }
301
61.8k
    }
302
76.7k
    return;
303
844k
}
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
160k
{
328
160k
    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
329
    /* Mvpred and Nnz for top and Courrent */
330
160k
    mv_pred_t *ps_cur_mv_pred, *ps_top_mv_pred = NULL, *ps_left_mv_pred;
331
    /* deblk_mb_t Params */
332
160k
    deblk_mb_t *ps_cur_mb_params; /*< Parameters of current MacroBlock */
333
160k
    deblkmb_neighbour_t *ps_deblk_top_mb;
334
335
    /* Reference Index to POC mapping*/
336
160k
    void **apv_map_ref_idx_to_poc;
337
160k
    UWORD32 u4_leftmbtype;
338
339
160k
    UWORD16 u2_left_csbp, u2_top_csbp, u2_cur_csbp;
340
341
    /* Set of flags */
342
160k
    UWORD32 u4_cur_mb_intra, u1_top_mb_typ, u4_cur_mb_fld;
343
160k
    UWORD32 u1_cur_mb_type;
344
160k
    UWORD32 *pu4_bs_table;
345
346
    /* Neighbour availability */
347
    /* Initialization */
348
160k
    const UWORD32 u2_mbx = ps_cur_mb_info->u2_mbx;
349
160k
    const UWORD32 u2_mby = ps_cur_mb_info->u2_mby;
350
160k
    const UWORD32 u1_pingpong = u2_mbx & 0x01;
351
352
160k
    PROFILE_DISABLE_BOUNDARY_STRENGTH()
353
354
160k
    ps_deblk_top_mb = ps_dec->ps_deblk_top_mb + u2_mbx;
355
356
    /* Pointer assignment for Current DeblkMB, Current Mv Pred  */
357
160k
    ps_cur_mb_params = ps_dec->ps_deblk_mbn + u2_mbxn_mb;
358
160k
    ps_cur_mv_pred = ps_dec->ps_mv_cur + (u2_mbxn_mb << 4);
359
360
160k
    apv_map_ref_idx_to_poc = ps_dec->ppv_map_ref_idx_to_poc + 1;
361
160k
    u1_cur_mb_type = ps_cur_mb_params->u1_mb_type;
362
160k
    u1_top_mb_typ = ps_deblk_top_mb->u1_mb_type;
363
160k
    ps_deblk_top_mb->u1_mb_type = u1_cur_mb_type;
364
365
160k
    ps_cur_mb_params->u1_topmb_qp = ps_deblk_top_mb->u1_mb_qp;
366
160k
    ps_deblk_top_mb->u1_mb_qp = ps_cur_mb_params->u1_mb_qp;
367
160k
    ps_cur_mb_params->u1_left_mb_qp = ps_dec->deblk_left_mb[1].u1_mb_qp;
368
160k
    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
160k
    if(ps_cur_mb_params->u1_deblocking_mode & MB_DISABLE_FILTERING)
373
1.93k
    {
374
1.93k
        void **pu4_map_ref_idx_to_poc_l1 = apv_map_ref_idx_to_poc + POC_LIST_L0_TO_L1_DIFF;
375
1.93k
        {
376
            /* Store Parameter for Top MvPred refernce frame Address */
377
378
1.93k
            void **ppv_top_mv_pred_addr = ps_cur_mb_info->ps_curmb->u4_pic_addrress;
379
1.93k
            WORD8 *p1_refTop0 = (ps_cur_mv_pred + 12)->i1_ref_frame;
380
1.93k
            WORD8 *p1_refTop1 = (ps_cur_mv_pred + 14)->i1_ref_frame;
381
382
            /* Store Left addresses for Next Mb   */
383
1.93k
            void **ppv_left_mv_pred_addr = ps_dec->ps_left_mvpred_addr[!u1_pingpong][1].u4_add;
384
1.93k
            WORD8 *p1_refleft0 = (ps_cur_mv_pred + 3)->i1_ref_frame;
385
386
1.93k
            ppv_top_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refTop0[0]];
387
1.93k
            ppv_top_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refTop0[1]];
388
389
1.93k
            ppv_left_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
390
1.93k
            ppv_top_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
391
1.93k
            ppv_left_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
392
1.93k
            ppv_top_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
393
394
1.93k
            ppv_left_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refleft0[0]];
395
1.93k
            ppv_left_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refleft0[1]];
396
            /* Storing the leftMbtype for next Mb */
397
1.93k
            ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type;
398
1.93k
        }
399
400
1.93k
        return;
401
1.93k
    }
402
403
    /* Flag for extra left Edge */
404
158k
    ps_cur_mb_params->u1_single_call = 1;
405
406
    /* Update the Left deblk_mb_t and Left MvPred Parameters           */
407
158k
    if(!u2_mbx)
408
17.0k
    {
409
17.0k
        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
17.0k
        ps_left_mv_pred = ps_dec->ps_mv_cur + 3;
415
17.0k
    }
416
141k
    else
417
141k
    {
418
141k
        u4_leftmbtype = ps_dec->deblk_left_mb[1].u1_mb_type;
419
420
        /* Come to Left Most Edge of the MB */
421
141k
        ps_left_mv_pred =
422
141k
            (u2_mbxn_mb) ? ps_dec->ps_mv_cur + ((u2_mbxn_mb - 1) << 4) + 3 : ps_dec->ps_mv_left + 3;
423
141k
    }
424
425
158k
    if(!u2_mby) u1_top_mb_typ = 0;
426
427
    /* MvPred Pointer Calculation */
428
158k
    ps_top_mv_pred = ps_cur_mv_pred - (ps_dec->u2_frm_wd_in_mbs << 4) + 12;
429
430
158k
    u4_cur_mb_intra = u1_cur_mb_type & D_INTRA_MB;
431
158k
    u4_cur_mb_fld = !!(u1_cur_mb_type & D_FLD_MB);
432
    /* Compute BS function */
433
158k
    pu4_bs_table = ps_cur_mb_params->u4_bs_table;
434
435
158k
    u2_cur_csbp = ps_cur_mb_info->ps_curmb->u2_luma_csbp;
436
158k
    u2_left_csbp = ps_cur_mb_info->ps_left_mb->u2_luma_csbp;
437
158k
    u2_top_csbp = ps_cur_mb_info->ps_top_mb->u2_luma_csbp;
438
    /* Compute BS function */
439
158k
    if((ps_dec->ps_cur_sps->u1_profile_idc == HIGH_PROFILE_IDC) ||
440
158k
       (ps_dec->ps_cur_sps->u1_profile_idc == SCALABLE_HIGH_PROFILE_IDC) ||
441
158k
       (ps_dec->ps_cur_sps->u1_profile_idc == SCALABLE_BASELINE_PROFILE_IDC))
442
73.9k
    {
443
73.9k
        if(ps_cur_mb_info->u1_tran_form8x8 == 1)
444
53.5k
        {
445
53.5k
            u2_cur_csbp = ih264d_update_csbp_8x8(ps_cur_mb_info->ps_curmb->u2_luma_csbp);
446
53.5k
        }
447
448
73.9k
        if(ps_cur_mb_info->ps_left_mb->u1_tran_form8x8 == 1)
449
50.3k
        {
450
50.3k
            u2_left_csbp = ih264d_update_csbp_8x8(ps_cur_mb_info->ps_left_mb->u2_luma_csbp);
451
50.3k
        }
452
453
73.9k
        if(ps_cur_mb_info->ps_top_mb->u1_tran_form8x8 == 1)
454
44.4k
        {
455
44.4k
            u2_top_csbp = ih264d_update_csbp_8x8(ps_cur_mb_info->ps_top_mb->u2_luma_csbp);
456
44.4k
        }
457
73.9k
    }
458
158k
    if(u4_cur_mb_intra)
459
158k
    {
460
158k
        pu4_bs_table[4] = 0x04040404;
461
158k
        pu4_bs_table[0] = u4_cur_mb_fld ? 0x03030303 : 0x04040404;
462
158k
        pu4_bs_table[1] = 0x03030303;
463
158k
        pu4_bs_table[2] = 0x03030303;
464
158k
        pu4_bs_table[3] = 0x03030303;
465
158k
        pu4_bs_table[5] = 0x03030303;
466
158k
        pu4_bs_table[6] = 0x03030303;
467
158k
        pu4_bs_table[7] = 0x03030303;
468
158k
    }
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
158k
    {
489
158k
        void **pu4_map_ref_idx_to_poc_l1 = apv_map_ref_idx_to_poc + POC_LIST_L0_TO_L1_DIFF;
490
158k
        {
491
            /* Store Parameter for Top MvPred refernce frame Address */
492
493
158k
            void **ppv_top_mv_pred_addr = ps_cur_mb_info->ps_curmb->u4_pic_addrress;
494
158k
            WORD8 *p1_refTop0 = (ps_cur_mv_pred + 12)->i1_ref_frame;
495
158k
            WORD8 *p1_refTop1 = (ps_cur_mv_pred + 14)->i1_ref_frame;
496
497
            /* Store Left addresses for Next Mb   */
498
158k
            void **ppv_left_mv_pred_addr = ps_dec->ps_left_mvpred_addr[!u1_pingpong][1].u4_add;
499
158k
            WORD8 *p1_refleft0 = (ps_cur_mv_pred + 3)->i1_ref_frame;
500
501
158k
            ppv_top_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refTop0[0]];
502
158k
            ppv_top_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refTop0[1]];
503
504
158k
            ppv_left_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
505
158k
            ppv_top_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
506
158k
            ppv_left_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
507
158k
            ppv_top_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
508
509
158k
            ppv_left_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refleft0[0]];
510
158k
            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
158k
            ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type;
514
158k
        }
515
158k
    }
516
517
    /* For transform 8x8 disable deblocking of the intrernal edges of a 8x8 block */
518
158k
    if(ps_cur_mb_info->u1_tran_form8x8)
519
53.5k
    {
520
53.5k
        pu4_bs_table[1] = 0;
521
53.5k
        pu4_bs_table[3] = 0;
522
53.5k
        pu4_bs_table[5] = 0;
523
53.5k
        pu4_bs_table[7] = 0;
524
53.5k
    }
525
158k
}
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
4.06k
{
548
4.06k
    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
549
4.06k
    ps_dec->pf_compute_bs(ps_dec, ps_cur_mb_info, u2_mbxn_mb);
550
4.06k
}
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
211k
{
573
211k
    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
574
    /* Mvpred and Nnz for top and Courrent */
575
211k
    mv_pred_t *ps_cur_mv_pred, *ps_top_mv_pred = NULL, *ps_left_mv_pred;
576
    /* deblk_mb_t Params */
577
211k
    deblk_mb_t *ps_cur_mb_params; /*< Parameters of current MacroBlock */
578
211k
    deblkmb_neighbour_t *ps_deblk_top_mb;
579
580
    /* Reference Index to POC mapping*/
581
211k
    void **apv_map_ref_idx_to_poc;
582
211k
    UWORD32 u4_leftmbtype;
583
211k
    UWORD16 u2_left_csbp, u2_top_csbp, u2_cur_csbp;
584
585
    /* Set of flags */
586
211k
    UWORD32 u4_cur_mb_intra, u1_top_mb_typ, u4_cur_mb_fld;
587
211k
    UWORD32 u4_cur_mb_ibl;
588
211k
    UWORD32 u1_cur_mb_type;
589
211k
    UWORD32 *pu4_bs_table;
590
591
211k
    UWORD16 *pu2_curr_res_luma_csbp;
592
211k
    UWORD16 *pu2_left_res_luma_csbp;
593
211k
    UWORD16 *pu2_top_res_luma_csbp;
594
595
    /* Neighbour availability */
596
    /* Initialization */
597
211k
    const UWORD32 u2_mbx = ps_cur_mb_info->u2_mbx;
598
211k
    const UWORD32 u2_mby = ps_cur_mb_info->u2_mby;
599
211k
    const UWORD32 u1_pingpong = u2_mbx & 0x01;
600
601
211k
    PROFILE_DISABLE_BOUNDARY_STRENGTH()
602
603
211k
    ps_deblk_top_mb = ps_dec->ps_deblk_top_mb + u2_mbx;
604
605
    /* Pointer assignment for Current DeblkMB, Current Mv Pred  */
606
211k
    ps_cur_mb_params = ps_dec->ps_deblk_mbn + u2_mbxn_mb;
607
211k
    ps_cur_mv_pred = ps_dec->ps_mv_cur + (u2_mbxn_mb << 4);
608
609
    /*Pointer assignment for Residual NNZ */
610
211k
    pu2_curr_res_luma_csbp = ps_svc_lyr_dec->pu2_frm_res_luma_csbp + ps_cur_mb_info->u2_mbx;
611
211k
    pu2_curr_res_luma_csbp += ps_cur_mb_info->u2_mby * ps_svc_lyr_dec->i4_frm_res_luma_csbp_stride;
612
613
211k
    pu2_left_res_luma_csbp = pu2_curr_res_luma_csbp - (ps_cur_mb_info->u2_mbx != 0);
614
211k
    pu2_top_res_luma_csbp = pu2_curr_res_luma_csbp - ((ps_cur_mb_info->u2_mby != 0) *
615
211k
                                                      ps_svc_lyr_dec->i4_frm_res_luma_csbp_stride);
616
617
211k
    apv_map_ref_idx_to_poc = ps_dec->ppv_map_ref_idx_to_poc + 1;
618
211k
    u1_cur_mb_type = ps_cur_mb_params->u1_mb_type;
619
211k
    u1_top_mb_typ = ps_deblk_top_mb->u1_mb_type;
620
211k
    ps_deblk_top_mb->u1_mb_type = u1_cur_mb_type;
621
622
211k
    ps_cur_mb_params->u1_topmb_qp = ps_deblk_top_mb->u1_mb_qp;
623
211k
    ps_deblk_top_mb->u1_mb_qp = ps_cur_mb_params->u1_mb_qp;
624
211k
    ps_cur_mb_params->u1_left_mb_qp = ps_dec->deblk_left_mb[1].u1_mb_qp;
625
211k
    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
211k
    if(ps_cur_mb_params->u1_deblocking_mode & MB_DISABLE_FILTERING)
630
13.3k
    {
631
13.3k
        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
13.3k
        void **ppv_top_mv_pred_addr = ps_cur_mb_info->ps_curmb->u4_pic_addrress;
635
13.3k
        WORD8 *p1_refTop0 = (ps_cur_mv_pred + 12)->i1_ref_frame;
636
13.3k
        WORD8 *p1_refTop1 = (ps_cur_mv_pred + 14)->i1_ref_frame;
637
638
        /* Store Left addresses for Next Mb   */
639
13.3k
        void **ppv_left_mv_pred_addr = ps_dec->ps_left_mvpred_addr[!u1_pingpong][1].u4_add;
640
13.3k
        WORD8 *p1_refleft0 = (ps_cur_mv_pred + 3)->i1_ref_frame;
641
642
13.3k
        ppv_top_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refTop0[0]];
643
13.3k
        ppv_top_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refTop0[1]];
644
645
13.3k
        ppv_left_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
646
13.3k
        ppv_top_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
647
13.3k
        ppv_left_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
648
13.3k
        ppv_top_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
649
650
13.3k
        ppv_left_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refleft0[0]];
651
13.3k
        ppv_left_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refleft0[1]];
652
        /* Storing the leftMbtype for next Mb */
653
13.3k
        ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type;
654
655
13.3k
        return;
656
13.3k
    }
657
658
    /* Flag for extra left Edge */
659
197k
    ps_cur_mb_params->u1_single_call = 1;
660
661
    /* Update the Left deblk_mb_t and Left MvPred Parameters           */
662
197k
    if(!u2_mbx)
663
56.2k
    {
664
56.2k
        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
56.2k
        ps_left_mv_pred = ps_dec->ps_mv_cur + 3;
670
56.2k
    }
671
141k
    else
672
141k
    {
673
141k
        u4_leftmbtype = ps_dec->deblk_left_mb[1].u1_mb_type;
674
675
        /* Come to Left Most Edge of the MB */
676
141k
        ps_left_mv_pred =
677
141k
            (u2_mbxn_mb) ? ps_dec->ps_mv_cur + ((u2_mbxn_mb - 1) << 4) + 3 : ps_dec->ps_mv_left + 3;
678
141k
    }
679
680
197k
    if(!u2_mby) u1_top_mb_typ = 0;
681
682
    /* MvPred Pointer Calculation */
683
197k
    ps_top_mv_pred = ps_cur_mv_pred - (ps_dec->u2_frm_wd_in_mbs << 4) + 12;
684
197k
    u4_cur_mb_intra = u1_cur_mb_type & D_INTRA_MB;
685
197k
    u4_cur_mb_ibl = u1_cur_mb_type & D_INTRA_IBL;
686
197k
    u4_cur_mb_fld = !!(u1_cur_mb_type & D_FLD_MB);
687
    /* Compute BS function */
688
197k
    pu4_bs_table = ps_cur_mb_params->u4_bs_table;
689
690
197k
    u2_cur_csbp = ps_cur_mb_info->ps_curmb->u2_luma_csbp;
691
197k
    u2_left_csbp = ps_cur_mb_info->ps_left_mb->u2_luma_csbp;
692
197k
    u2_top_csbp = ps_cur_mb_info->ps_top_mb->u2_luma_csbp;
693
    /* Compute BS function */
694
197k
    if((ps_dec->ps_cur_sps->u1_profile_idc == HIGH_PROFILE_IDC) ||
695
197k
       (ps_dec->ps_cur_sps->u1_profile_idc == SCALABLE_HIGH_PROFILE_IDC) ||
696
197k
       (ps_dec->ps_cur_sps->u1_profile_idc == SCALABLE_BASELINE_PROFILE_IDC))
697
91.8k
    {
698
91.8k
        if(ps_cur_mb_info->u1_tran_form8x8 == 1)
699
10.1k
        {
700
10.1k
            u2_cur_csbp = ih264d_update_csbp_8x8(ps_cur_mb_info->ps_curmb->u2_luma_csbp);
701
10.1k
            ps_cur_mb_info->ps_curmb->u2_luma_csbp = u2_cur_csbp;
702
10.1k
        }
703
91.8k
    }
704
197k
    u2_cur_csbp |= *pu2_curr_res_luma_csbp;
705
197k
    u2_left_csbp |= *pu2_left_res_luma_csbp;
706
197k
    u2_top_csbp |= *pu2_top_res_luma_csbp;
707
708
197k
    if(u4_cur_mb_intra)
709
8.60k
    {
710
8.60k
        pu4_bs_table[4] = 0x04040404;
711
8.60k
        pu4_bs_table[0] = u4_cur_mb_fld ? 0x03030303 : 0x04040404;
712
8.60k
        pu4_bs_table[1] = 0x03030303;
713
8.60k
        pu4_bs_table[2] = 0x03030303;
714
8.60k
        pu4_bs_table[3] = 0x03030303;
715
8.60k
        pu4_bs_table[5] = 0x03030303;
716
8.60k
        pu4_bs_table[6] = 0x03030303;
717
8.60k
        pu4_bs_table[7] = 0x03030303;
718
8.60k
    }
719
189k
    else
720
189k
    {
721
189k
        isvcd_fill_bs_ibl(ps_cur_mb_params, u1_top_mb_typ, u4_leftmbtype, ps_cur_mb_info,
722
189k
                          pu2_curr_res_luma_csbp, pu2_left_res_luma_csbp, pu2_top_res_luma_csbp);
723
724
189k
        if(!u4_cur_mb_ibl)
725
153k
        {
726
153k
            UWORD32 u4_is_non16x16 = !!(u1_cur_mb_type & D_PRED_NON_16x16);
727
153k
            UWORD32 u4_is_b = ps_dec->u1_B;
728
153k
            UWORD32 u4_bs_0, u4_bs_4;
729
730
153k
            u4_bs_0 = pu4_bs_table[0];
731
153k
            u4_bs_4 = pu4_bs_table[4];
732
733
153k
            ih264d_fill_bs2_horz_vert(pu4_bs_table, u2_left_csbp, u2_top_csbp, u2_cur_csbp,
734
153k
                                      (const UWORD32 *) (gau4_ih264d_packed_bs2),
735
153k
                                      (const UWORD16 *) (gau2_ih264d_4x4_v2h_reorder));
736
737
153k
            if(u4_leftmbtype & D_INTRA_MB)
738
1.13k
            {
739
1.13k
                pu4_bs_table[4] = 0x04040404;
740
1.13k
            }
741
152k
            else if(u4_leftmbtype & D_INTRA_IBL)
742
3.38k
            {
743
3.38k
                pu4_bs_table[4] = u4_bs_4;
744
3.38k
            }
745
746
153k
            if(u1_top_mb_typ & D_INTRA_MB)
747
1.39k
            {
748
1.39k
                pu4_bs_table[0] = u4_cur_mb_fld ? 0x03030303 : 0x04040404;
749
1.39k
            }
750
151k
            else if(u1_top_mb_typ & D_INTRA_IBL)
751
4.71k
            {
752
4.71k
                pu4_bs_table[0] = u4_bs_0;
753
4.71k
            }
754
755
153k
            ps_dec->pf_fill_bs1[u4_is_b][u4_is_non16x16](
756
153k
                ps_cur_mv_pred, ps_top_mv_pred, apv_map_ref_idx_to_poc, pu4_bs_table,
757
153k
                ps_left_mv_pred, &(ps_dec->ps_left_mvpred_addr[u1_pingpong][1]),
758
153k
                ps_cur_mb_info->ps_top_mb->u4_pic_addrress, (4 >> u4_cur_mb_fld));
759
153k
        }
760
189k
    }
761
762
197k
    {
763
197k
        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
197k
        void **ppv_top_mv_pred_addr = ps_cur_mb_info->ps_curmb->u4_pic_addrress;
766
197k
        WORD8 *p1_refTop0 = (ps_cur_mv_pred + 12)->i1_ref_frame;
767
197k
        WORD8 *p1_refTop1 = (ps_cur_mv_pred + 14)->i1_ref_frame;
768
769
        /* Store Left addresses for Next Mb   */
770
197k
        void **ppv_left_mv_pred_addr = ps_dec->ps_left_mvpred_addr[!u1_pingpong][1].u4_add;
771
197k
        WORD8 *p1_refleft0 = (ps_cur_mv_pred + 3)->i1_ref_frame;
772
773
197k
        ppv_top_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refTop0[0]];
774
197k
        ppv_top_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refTop0[1]];
775
776
197k
        ppv_left_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
777
197k
        ppv_top_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
778
197k
        ppv_left_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
779
197k
        ppv_top_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
780
781
197k
        ppv_left_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refleft0[0]];
782
197k
        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
197k
        ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type;
786
197k
    }
787
788
    /* For transform 8x8 disable deblocking of the intrernal edges of a 8x8 block */
789
197k
    if(ps_cur_mb_info->u1_tran_form8x8)
790
15.9k
    {
791
15.9k
        pu4_bs_table[1] = 0;
792
15.9k
        pu4_bs_table[3] = 0;
793
15.9k
        pu4_bs_table[5] = 0;
794
15.9k
        pu4_bs_table[7] = 0;
795
15.9k
    }
796
197k
}
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
}